Callback stub class not found
Hi there
This is my first time with RMI, so don't be hard on me ;) I've already looked at some topic, but didn't find a solution for my problem.. Well, the forum search is appalling, so it could very well be out there... Here it goes:
I have a modular system:
- a server, getting events from devices
- a client module
The modules connect to the server via RMI, and they can receive the events they apply for
So i have the following interfaces (I simplified it a bit):
publicinterface ModuleRegisterextends Remote{
publicvoid register(Module module)throws RemoteException;
publicvoid register(Module module,int[] accept)throws RemoteException;
publicvoid unRegister(Module module)throws RemoteException;
It has in implementation on the server side. And this interface:
publicinterface Moduleextends Remote{
public String getName()throws RemoteException;
publiclong getIdentification()throws RemoteException;
publicvoid receiveEvent(Packet packet)throws RemoteException;
}
The module interface has a client implementation. Obviously, Packet is another interface and is implemented at the Server
publicinterface Packetextends Remote{
publicbyte[] getData()throws RemoteException;
publicint getID()throws RemoteException;
publicint getSize()throws RemoteException;
public InetSocketAddress getRemoteAddress()throws RemoteException;
}
Okay now, Thats about it.
The Test module looks like this:
publicclass TestModuleextends UnicastRemoteObjectimplements Module{
public TestModule()throws RemoteException{
super(0);
}
privatestaticfinallong serialVersionUID = -<xxxxxxxxxx>L;
publiclong getIdentification()throws RemoteException{
return 12321321564564;
}
public String getName()throws RemoteException{
return"testmodule";
}
publicvoid receiveEvent(Packet packet)
throws RemoteException{
System.out.println("received packet with id ["+packet.getID()+"] and size ["+packet.getSize()+"]");
}
The server starts, an seems to run fine. The RMI inspector shows that the ModuleRegister is exported nicely.
So now the client connects to the RMI server (at the moment localhost). After some security problems I run against this problem:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: com.foo.testmodule.TestModule_Stub
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:325)
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:466)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
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 com.foo.udpserver.net.ModuleManager_Stub.register(Unknown Source)
at com.foo.testmodule.Test.serviceAdded(Test.java:55)
at javax.jmdns.JmDNS.updateRecord(JmDNS.java:909)
at javax.jmdns.JmDNS.handleResponse(JmDNS.java:994)
at javax.jmdns.JmDNS.access$900(JmDNS.java:25)
at javax.jmdns.JmDNS$SocketListener.run(JmDNS.java:1139)
at java.lang.Thread.run(Unknown Source)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: com.foo.testmodule.TestModule_Stub
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:285)
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:466)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassNotFoundException: com.foo.testmodule.TestModule_Stub
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.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1543)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1465)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1698)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1304)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:349)
at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:290)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:279)
The big question is: why can't the TestModule stub be found. All stubs were generated my the eclipse RMI plugin. I also see it in the client class folder, but it appears that the server cannot load the stub?
Why is this? Did I miss something?
I'm using JDK 1.5...

