I have tried 55 ways from Sunday to use the codebase property on my server startup, but I can't ever get it to work. I keep getting the stupid UnMarshall and ClassNotFound exceptions, because rmiregistry doesn't know where to find my stub class. My command line looks like this:
java -Djava.rmi.server.codebase=file://c:\pathname\server.jar suncertify.server.FBNServer
It never works and I have tried multiple variations of the format (I'm assuming that the server and rmiregistry will be running on the same machine).
The only other solution I have is to set the CLASSPATH to my jar files before starting rmiregistry.
I'd really like to figure out the codebase problem, but as I have an alternate solution, I'm running out of patience, as everything else for the project is completely tested and ready for upload.
Any quick ideas on how to fix the codebase problem or should I just use the other solution?
Originally posted by Michael Morris:
Forget about codebase and CLASSPATH and don't require that the registry be started before starting the server. You can start the registry from your server with LocateRegistry.createRegistry(port).
Hope this helps,
I'll try this and see if I can get it to work. Just one question: If I start rmiregistry from the server, does it use the CLASSPATH variable that was set for the server program? Is that how it knows where to find the stub class?
but it was my understanding that if the registry had access to stubs via the classpath, it was a bad thing. The registry could only download code if it had access via the codebase.
I'm curious: does using somehow interpret the classpath for the server into a codebase under the covers?
... somehow interpret the classpath for the server into a codebase under the covers?
I don't know for sure. You may need to direct this question to the Distributed Java forum where there are those who understand the more esoteric features of RMI. There is nothing in the javadocs that indicates the mechanisms that LocateRegistry uses to locate classes. But if there is no codebase set then isn't the codebase . (the user directory)? If that's the case then I suppose that the answer is yes.
1) You can either start the RMI Registry in a seperate console window and set the CLASSPATH env value before starting the registry
2) Use LocateRegistry and RMI Registry can find the _Stub using the CLASSPATH for the server startup.
When no codebase is used, the remote object is marshalled and annotated with null for the codebase from the RMI Server to the RMI Reigstry. Also this applies to the marshalling from RMI Registry to the client. Hope that helps.
Use LocateRegistry and RMI Registry can find the _Stub using the CLASSPATH for the server startup
Seems like this is a better choice for the assignment because it will result in fewer steps that the evaluator would have to take to get your assignment up and running.
Guess you could use codebase and a file URL, but that would require your having tedious instructions in your readme in order to have the evaluator specify the correct location.
"And I told Dom too because they�ve moved my desk four times. I used to be by the window, where I could see the squirrels and they were merry..."
I am just curious, what makes this quote so spectacular that you decided to use it as your signature? By this standard, every one of my posts here (well, almost every one) should be engraved some place.
I chose it to add a less-serious tone to things I say. Not that any other signature here is too serious, there are some very insightful ones out there. Some very funny ones too.
My actual favorite quote is
True nobility and strength comes not from being superior to other people, but from being superior to your former self.
A Zen teaching. I'm not a Zen master by any stretch and thought that a quote like this may be heavy-handed if given as a signature.
Thoughts? Got a kick out of your engraving idea.
So, in a sense, your posts have been engraved somewhere.
[ August 16, 2002: Message edited by: Erick Reid ]