• Post Reply Bookmark Topic Watch Topic
  • New Topic

fundamental RMI server ClassNotFoundExceptions  RSS feed

 
Carl Schwarcz
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to resurrect some of my old RMI code and running into problems where the bind() throws a ClassNotFoundException for the remote interface. The old code ran on a older JDK and an older version of Windows.

Any help you could offer would be GREATLY appreciated.

I'm running on Windows XP Pro with 5.0 of the JDK. I've done my best to turn off any firewall, ani-virus, and Internet worm (Norton) checking.

I've tried to reduce it a trivial case:
* Message: an interface that extends Remote
* MessageImpl: a class that implements Message and extends
UnicatseRemoteObject.
* MessageServer: a class with a main method that:
a) creates an instance of MessageImpl
b) does a bind passing a name and the above instance.

All this is compiled and in a single jar.
I start the rmiregistry and run the Server.


However, I still get:

java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: Message
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:385)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the full command you are using to launch this? It sounds like a classpath issue may be involved...
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm getting exactly the same.
The rmic compiler that ships with 1.5 does not generate the Skeleton class for some reason.
This causes the server class to terminate with the error shown stating that the Stub class cannot be found.

So both the rmic and the reported error message are in error here it seems (unless rmic should be used differently under 1.5 from previous releases, something not apparent from the documentation).

The exact same code works fine under 1.4 using the same commandlines for java, javac, and rmic.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, according to the release notes the non-generation of the skeleton classes is intentional.
Remains the question how to get the RMI servers to run...
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After some testing and reading:
With Java 1.5 you should not run rmic at all.

Just compile and run the server and client applications (of course do have the rmiregistry running) and all should work (network trouble excluded of course, I've not yet been able to get the Sun tutorial to work).
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
addition: depending on the way the remote server and service are coded you may need to generate the stub after all.

If you get a bind error because of no stub when you've not run rmic, run it.
If you get an error after running it, delete the stub
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!