Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Rebind error and java.rmi.server.codebase

843793Oct 17 2007 — edited Oct 18 2007
My RMI server application creates the RMI registry and binds some remote objects to this registry, programatically.
There is no problem with the following code:

Registry registry = LocateRegistry.createRegistry(1099);
registry.rebind("XXX", remoteObject);

but if I don't want to use this "registry" reference provided by the createRegistry.

I have two possible alternatives:

Registry registry = LocateRegistry.getRegistry("XXX.XXX.XXX.XXX", 1099);
registry.rebind("XXX", remoteObject);

or

Naming.rebind("//XXX.XXX.XXX.XXX:1099/XXX", remoteObject);

Both alternatives raise the following exception:

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: XXXXXXXXXXXXXX_Stub

What's the difference?. Because the stub classes (generated by rmic) are in the classpath of the application.

This problem is solved if I include the system property java.rmi.server.codebase pointing to the stub classpath. But this approach is rather ugly.

Can I use the Naming.rebind or the LocateRegistry.getRegistry without the java.rmi.server.codebase property?

Thanks in advance,
Jaime
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 15 2007
Added on Oct 17 2007
3 comments
253 views