• Post Reply Bookmark Topic Watch Topic
  • New Topic

Need help figuring out RMI Exceptions  RSS feed

 
Matt Senecal
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got a Java app that I have set up as a boot process on a Solaris 8 machine, using Java 1.3.1. When run, the app throws the following exception (I have the output directed to a file):

reading: myapp.server.MyServerImpl_Stub
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: myapp.server.MyServerImpl_Stub
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: myapp.server.MyServerImpl_Stub
java.lang.ClassNotFoundException: myapp.server.MyServerImpl_Stub
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:354)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)

It seems to be that there is a problem with the Naming.rebind() call, but for the life of me I can't figure out what. I don't understand why the ClassNotFoundException is thrown, either (but that may be related to the Naming.rebind() call). This app is contained in a JAR file, and it contains the class file that it claims is missing.
The application was compiled and run on the same machine, using the same JRE (1.3.1). Anyone know what might be the problem here?
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Usually it's not a problem with the class but the interface it implements. If the registry can't see the interface for the stub, it can't "find" the class. I teach a fair number of distributed programming courses, and this is by far the most common oversight in setting up RMI.
Interpreting exceptions in a distributed program is one of the more challnegign aspects of writing them. I find it helpful to think through each role's perspective on the code -- the server, the lookup service (rmiregistry) and the client, one at a time.
One reason RMI books encourage you to turn on verbosity and run each role in a different window -- assuming you're doing this all on one machine -- is to help negotiate the three different perspectives on the code you now have. Takes a bit of getting used to.
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!