Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to use RMI objects in a servlet

843793Apr 30 2009 — edited May 5 2009
Hi,
I have just run the example RMI program in the java tutorial in my linux pc. Also I have another method to just echo a string back. It works fine when calling from command line.

Now I want to write a servlet that get a string when POSTed and call the RMI objects echo method and display the returned string.

I use Tomcat-5.0 which is installed in /usr/local. I moved the remote object interface jar to the common/lib folder and import the interface in my Servlet. I use the following statements inside the servlet to get the RMI object reference.
 
            Registry registry = LocateRegistry.getRegistry("localhost");
            Rser comp = (Rser) registry.lookup("rmiser");
When i use this in my servlet the tomcat stops working.

Also I don't know how to specify the code base and security policy which I use in command prompt when calling RMI object.

Pls suggest me what to do and also specify any resources that explain this task step by step.

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 2 2009
Added on Apr 30 2009
12 comments
302 views