Java RMI

Does anyone know the disadvantages of Java RMI? Thanks in advance!!!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Advantages of RMI are many, but the main disadvantages are:

RMI is a Java only communication protocol - it is not a general communications standard that can be interfaced to and used from any language. You have to be using Java to use RMI to transport your data and objects (unlike CORBA for example, which is designed to be interfaced to and used from any programming language).

It also does not provide a fully featured protocol for communicating between all registered processes - you can only invoke the methods declared in the interface you specify - so there is no real time communication between the client and the server (such as general messageing or event handling).

This leaves RMI as a very spartan interface to use in it's basic form as it does it's job well, but really you need to extend it's functionality to make it more genuinely useful for general applications.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
beneflexAuthor Commented:
Thanks Jod!
I read Jason Hunter's excellent book on Servlets where he talks abt Servlets and RMI ,what is the use of having them both?

I mean servlet acts as a Client or sometimes as a Server?Pls expalin?

To quote:

What an applet is to a browser, a servlet is to a server. In simple terms, servlets are Java programs that are executed inside a server, usually, but not necessarily, a web server. Servlets can do anything a cgi script can do and usually faster, since cgi-script start-up overhead is avoided, and the Java intrerpreter is embedded in the web-server.

Servlets are an extension to your Web Server to create dynamic html that can display web pages that change based on data in a database or the current user or the time or whatever.

When you request a page from a web server then if that page is partly or totally created by a servlet then the web server will load the servlet and using http requests will return a page or data within a page to the client browser.

For example, a servlet could be used to create a shopping basket application that tracked the current user and showed the details of items they may want to purchase on your site by displaying these in the web page.

Previously, this would be done with CGI programs which are generally not portable, can be slow and often don't provide many advanced features for web pages.

However, Servlets are not limited to this and have full access to all the Java API so Jason Hunters book provides examples of how to extend servlets to use RMI to communicate with applets in order to provide more features and a greater level of communication with the client browser.

The link below has lots of info to help clarify things.

A simple servlet looks like this:


import javax.servlet.*;
import javax.servlet.http.*;

 * This is a simple example of an HTTP Servlet.  It responds to the GET
 * and HEAD methods of the HTTP protocol.
public class SimpleServlet extends HttpServlet {

    public void doGet (HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException
        ServletOutputStream out = res.getOutputStream();

      // set content type and other response header fields first

      // then write the data of the response
        out.println("<HEAD><TITLE> SimpleServlet Output </TITLE></HEAD><BODY>");
      out.println("<h1> SimpleServlet Output </h1>");
      out.println("<P>This is output from SimpleServlet.");

    public String getServletInfo() {
        return "A simple servlet";

It responds to certain methods of the HTTP protocol that could be invoked by the browser when you open a page. In this case, it dynamically creates a page and displays it by passing the html text out through the HttpServletResponse outputstream which is passed into the doGet method.

Servlets can also be extended to do things when buttons are pressed on html forms or to be embedded in parts of an existing html page.

However there are a limited number of ways to communicate with a servlet over HTTP, so using RMI will allow you to invoke various methods in the servlet
that could provide more advanced functions.

Also it is easier to write and use Servlets than develop standalone Applications which run on the server, so you can use RMI to communicate with the servlet which can then have (nearly) all the functionality of a server based application which communicates with your Applet.

The only limitation is that servlets have no user interface of their own, but this is not really a problem with server side services.
Thanx ,will read it and let u know.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.