RMI is designed to be extensible at runtime, and in particular it supports the notion of socket factories, which are pluggable objects with a responsibility for manufacturing network socket connections. A default socket factory is installed when RMI starts up, which simply uses regular unencrypted TCP connections to communicate RMI method calls and their results. However, other socket factories can be optionally installed. Socket factories control how RMI endpoints communicate at the raw byte-stream level. They have no effect on the higher-level operation of RMI, such as method calls and thread usage.
You can designate a Java class that is instantiated and used as RMI’s socket factory. This permits transparent use of third-party vendor socket factory implementations by RMI, and thus by client/server RMI communication. This supports such features as:
Secure sockets (SSL)
Tunneling—for example, RMI via firewall proxies
RMI-over-SSL can be useful in cases where a secure server needs to be contacted by authorized entities outside the firewall, or where security behind the firewall is an issue.
Configuring an Alternate Socket Factory
The component /atg/dynamo/server/RmiInitialization
(of class atg.server.rmi.RmiInitialization
) is responsible for performing RMI configuration prior to starting the Oracle Commerce Platform RMI server. It provides two ways to specify the socket factory class to be used:
You can use the
RMISocketFactory
property to specify a Nucleus component that is an instance of a socket factory class.You can use the
RMISocketFactoryClass
property to specify a socket factory class directly.
In general, specifying a Nucleus component is preferable, because you can easily configure the component through a properties file. Specifying a class directly is a useful alternative, if, for example, you are using a preconfigured RMI socket factory implementation obtained from a third-party vendor.
To configure an alternate socket factory:
Install the third party vendor package that contains the factory and place the vendor code into the CLASSPATH.
On the server, set the
RMISocketFactoryClass
property of the/atg/dynamo/server/RmiInitialization
component to the name of the socket factory class to be used. Or create a properties file for a Nucleus component that is an instance of the socket factory class, and set theRMISocketFactory
property to the Nucleus address of this component.Edit the client’s startup script to add the following to the JAVA_ARGS line:
-Drmi.socket.factory.class=classname
where
classname
is the name of the socket factory class.
To debug a socket factory at runtime, use vendor-supplied debugging switches if available. You can also use the Java argument -Djava.rmi.server.logCalls=true
to force all RMI method calls to be logged to the console.