Search the Web for JAVA Answers:

Search the Web for more JAVA Answers:
Hint: Press Ctrl+ to increase the font size of this blog and Ctrl- to decrease the font size of this blog.

RMI Answers

1.  What is RMI?
Answer: Java Remote Method Invocation (Java RMI) enables the programmer to create distributed Java technology-based to Java technology-based applications, in which the methods of remote Java objects can be invoked from other Java virtual machines, possibly on different hosts. RMI uses object serialization to marshal and unmarshal parameters and does not truncate types, supporting true object-oriented polymorphism.
-----------------------------------------------------------------
2. How many types of protocol implementations does RMI have?
Answer:  RMI has at least three protocol implementations:
- Java Remote Method Protocol(JRMP),
- Internet Inter ORB Protocol(IIOP),
- Jini Extensible Remote Invocation(JERI).
These are alternatives, not part of the same thing, All three are indeed layer 6 protocols from the earlier OSI reference model.
-----------------------------------------------------------------
3. Does RMI-IIOP support dynamic downloading of classes?
Answer: No, RMI-IIOP doesn't support dynamic downloading of the classes as it is done with CORBA in DII (Dynamic Interface Invocation).Actually RMI-IIOP combines the usability of Java Remote Method Invocation (RMI) with the interoperability of the Internet Inter-ORB Protocol (IIOP).So in order to attain this interoperability between RMI and CORBA,some of the features that are supported by RMI but not CORBA and vice versa are eliminated from the RMI-IIOP specification.
-----------------------------------------------------------------
4. Does RMI-IIOP support code downloading for Java objects sent by value across an IIOP connection in the same way as RMI does across a JRMP connection?
Answer: Yes. The JDK 1.2 support the dynamic class loading.
-----------------------------------------------------------------
5. Can RMI and Corba based applications interact ?
Answer Yes they can. RMI is available with IIOP as the transport protocol instead of JRMP.
-----------------------------------------------------------------
6. Assume an application needs security permissions granted before the application can talk to the database. How do you go about setting the permissions? Give an example of setting the permission in Tomcat and stand alone java program.
Answer:

In Tomcat:
Add security permission to catalina.policy file located under /conf/ 
Add the following lines:
 grant codeBase "file:${catalina.home}/webapps/MyContext/-"
{
permission java.security.AllPermission;
};

In stand alone java application:
Create a .policy file that points to the code base where the application resides.
grant codebase "file:c:/source/java/-"
{
permission java.security.AllPermission;
};

java -Djava.security.policy=.policy com.test.MyClass