Hi, I am trying to set up a servlet as an rmi client. My rmi server runs on a remote machine. I have the rmi server up and running. Now I am trying to write a servler client to talk to this server which exists on a remote machine. I am developing servlet in my desktop using eclipse and tomcat.
It sounds like the user, under which your container is running doesn't have sufficient permissions to access the the network resource in question.
Personally, I wouldn't do this directly in a servlet. I would make the RMI client a plain old Java object that can be instanciated by any interface (command line, servlet, etc...) to have it's methods called. This will make debugging things like this much easier.
I believe for this I have to set up a codebase. My server runs in an UNIX machine. I read in an article that place the rmi classes[or jar file with rmi stub etc classes] in a directory which can be accessed via http.
and then use -Djava.rmi.server.codebase property from client side. Has anyone tried this ?
Hi, that second error message looks to be a classpath problem.
Make sure the library containing the stubs is included in the classpath when starting up RMIRegistry. I would recommend just doing a simple set and export of the CLASSPATH before starting up RMIRegistry.
Joined: Jan 05, 2007
Hi This is what I do for starting up rmi registry. CLASSPATH=$CLASSPATH:$HOME/classes: export CLASSPATH
and then I start rmiregistry like this: nohup rmiregistry -J-mx128m -J-ms16m -J-oss1m -J-ss1m \ -J-Djava.rmi.dgc.leaseValue=123400000 \ -J-Djava.rmi.server.logCalls=true 3444> \ RmiRegistry3444.log 2>&1 & sleep 10
I dont specify any codebase when I start rmiregistry. Again this is on a remote machine.
Any suggestions ?
Joined: Jan 05, 2007
Can any experts help me please ?
I have displayed the way my registry gets started. This rmi server is in a remote machine.
I have my servlet which runs in my tomcat.
I tried putting the server's stub files etc as jar file in Unix server's public_html directory and setting-Djava.rmi.server.codebase=http://test.xx.com/username/public_html/test.jar in my tomcat's configuration.
Still I get lots of exceptions, Unmarshalling exception etc.