Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlets and RMI

 
Varun Rupela
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi:
Can a Servlet access a method remotely, using RMI (and use the returned data in its output)?
Thanks.
 
ralph roper
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. In summary this is how you do it.
Create your RMI server class, implementation class and interface class and then compile with javac and rmic. rmic will create the skeleton and stub classes. Copy the skeleton, stub and interface classes to the client. Start the rmiregistry process and then run your server class.
On the client your servlet will need to bind to the registry service running on the server. Once this is done you can call the remote methods in your servlet.
Sun has a good rmi tutorial if you need more detail.
regards,
Ralph
 
Varun Rupela
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ralph !!
Varun.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic