A
Andre Raue
Hello,
I just started to build a small RMI example for testing purpose.
everything works fine on Windoze. But when I try to start the Server
on Linux I get the exception shown below. I'm using Java SDK 1.4.2_04
on both machines. You'll find my server class and policy file below.
I would be glad about some help...
Greetings
Andre
Exception:
-----------------------------------
~/java/test > java -jar ByteGetterServer.jar
ByteGetterServer exception: error during JRMP connection establishment;
nested exception is:
java.net.SocketTimeoutException: Read timed out
java.rmi.ConnectIOException: error during JRMP connection establishment;
nested exception is:
java.net.SocketTimeoutException: Read timed out
at
sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:274)
at
sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:313)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at
test.java.basics.rmi.server.ByteGetterServer.main(ByteGetterServer.java:47)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
at java.io.DataInputStream.readByte(DataInputStream.java:331)
at
sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:215)
... 5 more
-------------------------------
Server class:
-------------------------------
package test.java.basics.rmi.server;
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import test.java.basics.rmi.ByteGetter;
public class ByteGetterServer
extends UnicastRemoteObject
implements ByteGetter {
protected ByteGetterServer() throws RemoteException {
super();
}
public byte[] getBytes() throws RemoteException {
byte[] someBytes = "Hallo".getBytes();
return someBytes;
}
public static void main(String[] args) {
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
try {
ByteGetter aByteGetter = new ByteGetterServer();
Naming.rebind("rmi://localhost/ByteGetter", aByteGetter);
System.out.println("ByteGetter-Server gestartet!");
} catch (Exception e) {
System.err.println("ByteGetterServer exception: " + e.getMessage());
e.printStackTrace();
}
}
}
I just started to build a small RMI example for testing purpose.
everything works fine on Windoze. But when I try to start the Server
on Linux I get the exception shown below. I'm using Java SDK 1.4.2_04
on both machines. You'll find my server class and policy file below.
I would be glad about some help...
Greetings
Andre
Exception:
-----------------------------------
~/java/test > java -jar ByteGetterServer.jar
ByteGetterServer exception: error during JRMP connection establishment;
nested exception is:
java.net.SocketTimeoutException: Read timed out
java.rmi.ConnectIOException: error during JRMP connection establishment;
nested exception is:
java.net.SocketTimeoutException: Read timed out
at
sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:274)
at
sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:313)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at
test.java.basics.rmi.server.ByteGetterServer.main(ByteGetterServer.java:47)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
at java.io.DataInputStream.readByte(DataInputStream.java:331)
at
sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:215)
... 5 more
-------------------------------
Server class:
-------------------------------
package test.java.basics.rmi.server;
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import test.java.basics.rmi.ByteGetter;
public class ByteGetterServer
extends UnicastRemoteObject
implements ByteGetter {
protected ByteGetterServer() throws RemoteException {
super();
}
public byte[] getBytes() throws RemoteException {
byte[] someBytes = "Hallo".getBytes();
return someBytes;
}
public static void main(String[] args) {
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
try {
ByteGetter aByteGetter = new ByteGetterServer();
Naming.rebind("rmi://localhost/ByteGetter", aByteGetter);
System.out.println("ByteGetter-Server gestartet!");
} catch (Exception e) {
System.err.println("ByteGetterServer exception: " + e.getMessage());
e.printStackTrace();
}
}
}