I have a RMI Server and Client programs. My Server program creates the RMI
Registry and creates the remote object,binds it to the registry. There are
2 jar files. Server jar and client jar file. Client jar file has stub,skeleton,
interface and client classes. Server Jar also has the all the classes including
Stub and Skeleton. Once I start the server in one JVM and start the client
in another JVM and when I try to connect to the server it throws the ClassNotFoundException
: _Stub not found... I'm not using the dynamic class downloading. The commands
that I use are.. java -Djava.security.policy=server.policy -jar server.jar
commandlineparams java -cp client.jar -jar client.jar commandlineparams.
Client doesn't find stub class.

My server jar has both stub and skeleton, my client jar also has stub and
skeleton. Client only requires the Stub. I'm not using Dynamic downloading.
My Server program has a method startServer(int port)that creates the registry
and binds the remote object to it.

java.rmi.registry.LocateRegistry.createRegistry(port) ;
registry = LocateRegistry.getRegistry(port);

I don't explicitly start the RMIRegistry. Once I start my server program
that creates the RMIRegistry. If I start my client and try to connect to
the server it throws UnMarshalException: ClassNotFoundException _Stub not
Here is the exact exception

C:\Project>java -cp c:\project\fnbserver.jar -Djava.security.policy=server.policy
com.myserver.MapServer c:\project\d.db 5001
com.myserver.FNBMapAdapter_Stub[RemoteStub [ref: [endpoint:[](remote),objID:[0]]]]
Type EXIT to shutdown the server.


C:\TEMP\Junk>java -cp .;C:\JDK1.3\JRE\LIB\RT.JAR;;C:\JDK1.3\JRE\LIB\JAWS.JAR;;C:\JDK1.3\JRE\LIB\I18N.JAR;;C:\JDK 1.3\JRE\LIB\SUNRSASIGN.JAR;;C:\JDK1.3\LIBD\TOOLS.JAR;;c:\temp\junk\client.jar
-Djava.security.policy=client.policy -jar fnbclient.jar localhost c:\temp\db.db

Program Output:
error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: com.myserver.FNBMapAdapter_Stub
at com.myclient.NetworkDataAccess.getRemoteReference(com/mycli
at com.myclient.DataModel.getDataAccessObject(com/myclient/Dat
at com.myclient.EventHandler.actionPerformed(com/myclient/Even
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknow
n Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

From the above logged messages, the RMI server is up running on 5001 port
(Registry is created and running on 5001) and also it binds the rempte object
to the name (FNBRemoteMap). But when the client tries to invoke the remote
object using "rmi://localhost:5001/FNBRemoteMap" it fails and throws the
ClassNotFoundExcpetion error unmarshalling....
But it is in the client.jar file and client.jar file is in the classpath.
But still it is not getting the Stub file from the JAR how do we make it
work? Thanks for your responses. com/myserver/FNBMapAdapter_Stub and com/myserver/FNBMapAdapter_Skel
are the RMIC generated classes and are in both server.jar and client.jar