SDSU CS 696 Emerging Technologies: Java Distributed Computing
Spring Semester, 1999
Activation & rohan
Previous    Lecture Notes Index    Next    
© 1999, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 11-Mar-99

Contents of Doc 14, Activation & rohan


References


Java Remote Method Invocation Specification, chapter 7 & pp. 122
Local HTML Copy: http://www-rohan.sdsu.edu/java/jdk1.2/docs/guide/rmi/spec/rmiTOC.doc.html
Sun HTML Site: http://java.sun.com/products/jdk/1.2/docs/guide/rmi/spec/rmiTOC.doc.html

rmid documentation
Sun Copy: http://java.sun.com/products/jdk/1.2/docs/tooldocs/solaris/rmid.html
Private communication & rmi mailing list


Doc 14, Activation & rohan Slide # 2

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


Doc 14, Activation & rohan Slide # 3
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);

Doc 14, Activation & rohan Slide # 4
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);
      }
   }

Doc 14, Activation & rohan Slide # 5
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

Do not use the above flags
Do not test your clients remotely on servers implementing the Activatable interface

Copyright ©, All rights reserved.
1999 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.

Previous    visitors since 11-Mar-99    Next