This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Distributed Java and the fly likes RMI registry not working if I invoke it from command line Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "RMI registry not working if I invoke it from command line" Watch "RMI registry not working if I invoke it from command line" New topic
Author

RMI registry not working if I invoke it from command line

Krishna Akkineni
Greenhorn

Joined: Aug 28, 2001
Posts: 2
Hi,
when I invoke rmiregistry from command line
(Win'NT) i am getting following exception.
Apparently Naming.rebind is failing.
(All programs including rmid, rmiregistry, RMI activation
setup program are running on local host).
Strangely, If I create rmiregistry programatically, then it
is working. After going through the API documentation, I notice
that LocateRegistry.createRegistry() creates as well as EXPORTS
Registry.
What is meant by exporting RMI registry. If we invoke RMI registry, are not we exporting it?
I tried for 2 days with all permutations and finally
posting this. If some one knew this problem please
help me.
Thanks for reading.
Krishna
Exception trace:
--------------------------------------------------
java.lang.ClassNotFoundException: com.zen.policy.DistPDP.DistPDPImpl_Stub
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Unknown Source)
at com.zen.policy.DistPDP.DistPDPSetup.<init>(DistPDP/DistPDPSetup.java:411)
at com.zen.policy.PSDistPDP.<init>(PSDistPDP.java:51)
at com.zen.policy.PSDistPDP.main(PSDistPDP.java:30)
--------------
Armita Bansal
Greenhorn

Joined: Aug 21, 2001
Posts: 8
Include the Folder Path for your package in the "CLASSPATH" Env Variable of NT.
Krishna Akkineni
Greenhorn

Joined: Aug 28, 2001
Posts: 2
Thanks Armita. Your pin-pointed reply shot the problem.
It is working if I follows your sugestion.
But I have a contradicting understanding now.
SUN's documentation says following:
--------------
Note: Before you start the rmiregistry, you must make sure that the shell or window in which you will run the registry either
has no CLASSPATH set or has a CLASSPATH that does not include the path to any classes that you want downloaded to your
client, including the stubs for your remote object implementation classes.
If you start the rmiregistry, and it can find your stub classes in its CLASSPATH, it will ignore the server's
java.rmi.server.codebase property, and as a result, your client(s) will not be able to download the stub code for your
remote object
---------
So, If I follow above mentioned text then I am facing the same old problem. If I don't follow (i.e., If I keep classpath
to my classes), then will there be any problems that were
mentioned in the above text.
Thanks Once again.
Krishna
Originally posted by Armita Bansal:
Include the Folder Path for your package in the "CLASSPATH" Env Variable of NT.

Lovelesh Sharma
Greenhorn

Joined: Jun 12, 2009
Posts: 3
After successfully started registry when i am going to run my server class file It is giving me this error:
anyone can help me in this.

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: com.lnt.User
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:466)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
at java.lang.Thread.run(Thread.java:595)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Unknown Source)
at com.lnt.User_Server.main(User_Server.java:14)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: com.lnt.User
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:375)
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:466)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassNotFoundException: com.lnt.User
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at sun.rmi.server.LoaderHandler.loadProxyInterfaces(LoaderHandler.java:707)
at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:651)
at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:588)
at java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:628)
at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:294)
at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:238)
at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1499)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1462)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1698)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1304)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:349)
... 9 more
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RMI registry not working if I invoke it from command line
 
Similar Threads
Problem with RMI - Your advice requested
SSLHandshakeException
Problem Executing RMI-IIOP Example : Provided by Sun
SSLHandshakeException
Ignorant RMI question??? Design choice