R
Robin
I'm not sure I understand the exceptions being thrown here. I need a
connection between two servers and I chose to use RMI. Whenever I try
to run the code that starts the "RMI Server" I am getting an exception.
I will post the code, and then the exceptions. Hopefully someone can
see an error - I cannot.
Interface:
public interface G2RemoteInterface extends Remote {
public InquiryConfig getConfig(String configFile) throws
RemoteException;
public Response makeRequest(G2Request request) throws
RemoteException;
}
Implementation:
public class G2Remote implements G2RemoteInterface, Serializable {
private static final long serialVersionUID = 2530016775139934837L;
public G2Remote() throws RemoteException {
System.out.println("G2Remote Object Constructed");
}
public InquiryConfig getConfig(String configFile) throws
RemoteException {
InquiryConfig config = new InquiryConfig();
try {
config.load(configFile);
} catch (Exception e) {
e.printStackTrace();
}
return config;
}
public Response makeRequest(G2Request request) throws RemoteException
{
try {
return request.runDataHandler();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
Server to launch this:
public class G2RemoteServer {
public static void main(String[] args) {
try {
//System.out.println("feh");
Naming.rebind("G2Remote", new G2Remote());
System.out.println("G2 Remote Server running...");
} catch (Exception e) {
e.printStackTrace();
}
}
}
I do have rmiregistry running before the server is ever called. When I
do run it, I get this error:
G2Remote Object Constructed
java.rmi.ServerException: RemoteException occurred in server thread;
nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested
exception is:
java.lang.ClassNotFoundException:
tpc.circulation.discus.g2.remote.G2Remote
at
sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:385)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)
at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown
Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Unknown Source)
at
tpc.circulation.discus.g2.remote.G2RemoteServer.main(G2RemoteServer.java:26)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments;
nested exception is:
java.lang.ClassNotFoundException:
tpc.circulation.discus.g2.remote.G2Remote
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at
sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:375)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassNotFoundException:
tpc.circulation.discus.g2.remote.G2Remote
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:430)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
at
sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
at
java.ibjectInputStream.readNonProxyDesc(ObjectInputStream.java:1538)
at
java.ibjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at
java.ibjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
at java.ibjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.ibjectInputStream.readObject(ObjectInputStream.java:339)
... 9 more
I hope someone can help.
Cheers,
Robin
connection between two servers and I chose to use RMI. Whenever I try
to run the code that starts the "RMI Server" I am getting an exception.
I will post the code, and then the exceptions. Hopefully someone can
see an error - I cannot.
Interface:
public interface G2RemoteInterface extends Remote {
public InquiryConfig getConfig(String configFile) throws
RemoteException;
public Response makeRequest(G2Request request) throws
RemoteException;
}
Implementation:
public class G2Remote implements G2RemoteInterface, Serializable {
private static final long serialVersionUID = 2530016775139934837L;
public G2Remote() throws RemoteException {
System.out.println("G2Remote Object Constructed");
}
public InquiryConfig getConfig(String configFile) throws
RemoteException {
InquiryConfig config = new InquiryConfig();
try {
config.load(configFile);
} catch (Exception e) {
e.printStackTrace();
}
return config;
}
public Response makeRequest(G2Request request) throws RemoteException
{
try {
return request.runDataHandler();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
Server to launch this:
public class G2RemoteServer {
public static void main(String[] args) {
try {
//System.out.println("feh");
Naming.rebind("G2Remote", new G2Remote());
System.out.println("G2 Remote Server running...");
} catch (Exception e) {
e.printStackTrace();
}
}
}
I do have rmiregistry running before the server is ever called. When I
do run it, I get this error:
G2Remote Object Constructed
java.rmi.ServerException: RemoteException occurred in server thread;
nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested
exception is:
java.lang.ClassNotFoundException:
tpc.circulation.discus.g2.remote.G2Remote
at
sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:385)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)
at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown
Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Unknown Source)
at
tpc.circulation.discus.g2.remote.G2RemoteServer.main(G2RemoteServer.java:26)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments;
nested exception is:
java.lang.ClassNotFoundException:
tpc.circulation.discus.g2.remote.G2Remote
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at
sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:375)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassNotFoundException:
tpc.circulation.discus.g2.remote.G2Remote
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:430)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
at
sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
at
java.ibjectInputStream.readNonProxyDesc(ObjectInputStream.java:1538)
at
java.ibjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at
java.ibjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
at java.ibjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.ibjectInputStream.readObject(ObjectInputStream.java:339)
... 9 more
I hope someone can help.
Cheers,
Robin