The RMISecurityManager
Class
The RMISecurityManager is a subclass
of the java.lang.SecurityManager class.
It is used to set the security policies that govern the behavior of
stub and skeleton classes. If a security manager is not set, an application
will not be able to export objects over the network. By default, JVM
does not allow an application to load classes dynamically, unless the
application has set up its own security manager. The security manager
throws an AccessException to indicate
that the caller does not have permission to perform the action requested
by the method call.
To use the RMISecurityManager
in your application , add the following statement to your code:
System.setSecurityManager(new RMISecurityManager());
Constructor
- public RMISecurityManager()
- The security manager is set by using the System.setSecurityManager()
method.
The RMIClassLoader
Class
A class loader is necessary for loading classes. This includes loading
classes, locally or remotely. The RMIClassLoader
provides static methods for loading classes from a network location.
It first attempts to locate classes locally. If the classes are not
found locally, it loads them from a network location.
Methods
- public static ClassLoader
getClassLoader(String codebase) - This method returns
a class loader that loads classes from the given codebase URL
path.
- public static Class loadClass(String
codebase, String name) - It loads a class from a codebase URL
path

RMI heavily depends on the Object serialization mechanism to transmit
data from one JVM to another JVM. One of the central and unique features
of RMI is its ability to download the code of an object(s) class if
the class is not defined in the receiver(s) virtual machine. For
dynamic class loading:
- A security manager must be installed.
- The java.rmi.server.codebase property
must be specified, so that the stub class can be dynamically downloaded
to the registry and then to the client.
|