CS 696 Emerging Technologies: Java Distributed Computing Spring Semester, 1999 Activation & rohan |
||
---|---|---|
© 1999, All Rights Reserved, SDSU & Roger Whitney San Diego State University -- This page last updated 11-Mar-99 |
rmid & Port Number
Server Side
How does your Server registration program find rmid if it is not on the standard port?
Solution 1 Set the system property java.rmi.activation.port in the JVM what registers the server
Solution 2 Use the rmid registry
package whitney.rmi.examples.activation; import java.rmi.*; import java.rmi.activation.*; import java.util.Properties; public class RegisterHelloServer { public static void main(String[] args) throws Exception { System.setSecurityManager(new RMISecurityManager()); Properties policyFileLocation = new Properties(); policyFileLocation.put("java.security.policy", "/export/home/whitney/.java.policy"); ActivationGroupDesc.CommandEnvironment ace = null; ActivationGroupDesc exampleGroup = new ActivationGroupDesc(policyFileLocation, ace); ActivationSystem localActivationSystem; localActivationSystem = (ActivationSystem) Naming.lookup("//:6753/java.rmi.activation.ActivationSystem"); ActivationGroupID agi = localActivationSystem.registerGroup(exampleGroup);
RegisterHelloServer Continued
System.out.println( "after register group" ); ActivationGroup.createGroup(agi, exampleGroup, 0); String classLocation = "file:/export/home/whitney/java/classes/"; String serverClass = "whitney.rmi.examples.activation.HelloServer"; MarshalledObject data = null; ActivationDesc desc = new ActivationDesc(serverClass, classLocation, data); Hello mri = (Hello)Activatable.register(desc); System.out.println("Got the stub for the HelloServer"); Naming.rebind("//:6754/HelloServer", mri); System.out.println("Exported HelloServer"); System.exit(0); } }
rmid & Port NumberClient Side
The hostname and port number of rmid is part of the stub downloaded to the client when it contacts the rmiregistry.
rmid is responsible for setting this information in the stub
On rohan this information is not set correctly.
You can use the –C-D and –J-D flags to set the correct value.
rmid -C-Djava.rmi.server.hostname=rohan.sdsu.edu -J-Djava .rmi.server.hostname=rohan.sdsu.edu -port 6753 &
However, there is still a problem on rohan.
At this time on rohan or moria