Using JDK 1.1
In JDK 1.1, stub classes are assigned a hash value based on characteristics of the remote class, such as its name and the interfaces that it implements. In JDK 1.2 and higher, every stub class is assigned a hash value of 2.
In JDK 1.2 and higher, each method is also assigned a hash value based on the signature of that method. Remote calls pass this hash value to identify the correct method to call. Because the stub protocol has changed, the stub generation has also changed.
The new RMIC stub generation program shipped with JDK 1.2 and higher generates three different types of stubs:
JDK 1.1 compliant stubs
JDK 1.1 stubs do not contain the method hash values.
JDK 1.2 compliant stubs
JDK 1.2 and higher stubs contain the method hash values. Also, JDK 1.2 has obsoleted some RMI API and the JDK 1.2 and higher stubs do not reference the obsoleted RMI API.
Hybrid stubs that can support both versions
The hybrid stubs can act as either JDK 1.1 stubs or JDK 1.2 and higher stubs. The hybrid stubs determine the correct stub protocol based on which version of Java the local VM is running.
Changing the stub protocol version for JDK 1.1
The SstRmiMarshalingConfiguration has an attribute, stubProtocolVersion. The stubProtocolVersion attribute is used when marshalling a request or unmarshalling a request. Set this attribute to either SstRmiConstants::SstRmiStubVersion1, if you are using JDK 1.1, or SstRmiConstants::SstRmiStubVersion2, if you are using JDK 1.2 and higher. The default is SstRmiVersion2.
In order to use the same mappings for JDK 1.1 and JDK 1.2 and higher, set the stub mappings to the JDK 1.1 hash value. When marshalling a request, this hash value is used when the stubProtocolVersion of the marshaling configuration is SstRmiStubVersion1. When the stubProtocolVersion of the marshaling configuration is SstRmiVersion2, the stub mapping hash value for JDK 1.1 is ignored and the hash value of 2 is used.
Java security for JDK 1.2 and higher
For Java 1.2 and higher, the Java security manager must grant access to the ports that RMI uses. Otherwise, when you try to bind a remote object to the RMI Registry, an error is returned. An example java.policy file is as follows:
grant {
permission java.net.SocketPermission "*:1024-65535",
"connect,accept";
permission java.net.SocketPermission "*:80",
"connect";
permission java.lang.RuntimePermission "accessDeclaredMembers";
};
Start Java with the --D option as follows:
java -Djava.security.policy=java.policy <my.class.with.Main()>
Migrating method mappings to JDK 1.2 and higher
In order for Smalltalk to use RMI with JDK 1.2 and higher, Smalltalk must know the method hash information. If you are using JDK 1.1, the method hash value is ignored.
The mapping migration utility searches the image for existing JDK 1.1 mappings and gives the user an option to update these to the new JDK 1.2 mapping. Run the migration utility by loading the SstRmiMigration application and executing the following code:
SstRmiMigration runMigration
Last modified date: 01/29/2015