• Post Reply Bookmark Topic Watch Topic
  • New Topic

Server exception when calling Naming.rebind()

 
Rudy Rusli
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm new at RMI and seem couldn't figure out a solution to my problem.
I'm calling Naming.rebind(...) in my code and got the exception below.
I'm not sure what's going on. Could somebody please advice?

com.myPackage.myClassRemote (this is not the original name) is my remote interface that is going to be used by clients side.

Thanks in advance for all the help.
~ Rudy ~

-------------------------------------------------------------

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: com.myPackage.myClassRemote
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(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:343)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
.....
.....
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you specifying the codebase property?

If you are using the codebase property, make sure it is correct, and make sure it ends with a slash ("/").
 
Rudy Rusli
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When specifying codebase i only include the implementation classes and not the remote interface itself. Is this correct?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll need the remote interface itself too - the implementation extends the interface, thus anyone getting a reference to the implementation needs a reference to the interface too. I'm assuming that your client is provided this interface along with whatever classes it needs to run. However, you're having this problem because you're attempting to bind to the RMI registry (itself an RMI server class) and it's missing a class (in this case the remote interface) to "make sense" of the object that it's getting a reference to when you bind into the registry.
 
Rudy Rusli
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works now
Thanks!

Rudy
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!