0
5.7kviews
Write short note on RMI Execution

Mumbai University > Information Technology > Sem 6 > Distributed System

Marks: 5 Marks

Year: May 2016

1 Answer
1
39views

The Java RMI (Remote Method Invocation) is a package for writing and executing distributed Java programs. The Java RMI provides a framework for developing and running servers (server objects). The services (methods) provided by those server objects can be accessed by clients in a way similar to method invocation. I.e. Java RMI hides almost all aspects of the distribution and provides a uniform way by which objects (distributed or not) may be accessed.

Writing Java programs using RMI can be described by the following steps:

  1. write server interface(s),
  2. write server implementation,
  3. generate server skeleton and client stub,
  4. write client implementation.

Executing distributed Java programs using RMI can be described by the following steps:

  1. start the rmi registry,
  2. start the server object,
  3. run the client(s).

Running the example.

The first thing to do when running Java programs using RMI is to start the rmi registry:

install:~> rmiregistry &

[1] 1449

install:~>

Next, the server must be started:

install:~> java examples.rmi.RMIServer

Registering as: "RMIServer"

RMIServer ready...

Finally, the client may be started and the setup tested:

install:~> java examples.rmi.RMIClient install.cs.aau.dk

Looking up: rmi://install.cs.aau.dk/RMIServer

String in server: Foobar

install:~>

(where install is the name of the machine you are using)

In case you are getting security errors, the following small hack should be able to deal with it. Put the following peice of text in a file called Grant.java and place it in the working directory:

grant

{

permission java.security.AllPermission;

};

And use it in the following way:

java -Djava.security.policy=Grant.java

examples.rmi.RMIClient install.cs.aau.dk

Please log in to add an answer.