Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rmiregistry vs sun.rmi.RegistryImpl 1

Status
Not open for further replies.

sedj

Programmer
Aug 6, 2002
5,610
Has anyone ever noticed this problem before :

Start up thr rmiregistry.
Run your RMI server.
See the server barf because of a ClassNotFoundException, because it cannot find the _Stub class.

Shut down the rmiregistry.
Run the registry class by doing a "java sun.rmi.RegistryImpl"
Run the RMI server class, and all is well.

Its most frustrating - anyone any idea why ?
 
I had this problem before. You should run the server like this:

java -Djava.rmi.server.codebase=file:///theClassPathDir...
-Djava.security.policy=policyFile.pol TheServerImpl

Use -Djava.rmi.server.codebase instead of -classpath

Ion Filipski
1c.bmp
 
Does that always fix it ? I noticed on the Sun bugbase, this kind of problem has been around since 1998 !
 
In fact it was the only way I could start server under an already running rmiregistry.

Ion Filipski
1c.bmp
 
Hmmm. As fate would have it, I've just started getting this problem again - and your -Dcodebase option fails to work. Damn. Its going live soon !

Any other ideas ?

Cheers
 
Got a workaround - start and stop the rmiregistry and server until it works. Its pretty lame though considering this was logged as a bug in 1998 !
 
1. I don't know if -Djava.rmi.server.codebase is the same with -Dcodebase, in my opinion is not the same. But you pass there the classpath as a web link.
2. The policy file(-Djava.security.policy=...) there is not optional. For testing purposes you can use a policy file with following content:

grant {
// Allow everything for now
permission java.security.AllPermission;
};

The policy file should be located in classpath of application.

Ion Filipski
1c.bmp
 
I wasn't doing -Dcodebase - I was just being lazy with the post.

But ... I was being dumb, and giving my codebase as /a/b/c whereas it should have benn /a/b/c/d.jar . Fool !

Incidentally, for me, it works with or without the security policy switch.

Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top