RMI



กก

  • Define RMI Interface
  • import java.rmi.Remote;

    import java.rmi.RemoteException;

    public interface Hello extends Remote{

      public void Hello();
    }

  • Write Implementation file
  • public class HelloImpl implements Hello{

       public void Hello(){
        System.out.println("Hello!");

       }
    }

  • Compile source File and Generate RMI Files
  • After compile your source file, please use the following command in console mode

       rmic -iiop HelloImpl

    After generation, you will find two new files in your class folder

    1: _Hello_stub.class

    2: _HelloImpl_Tie.class

  • Define Description
  • //*file:service.xml

    <?xml version="1.0"?>
    <service id="RMIService">
     <components>
      <component id="Hello" type="rmi">
       <jndi>Hello</jndi>
       <class>HelloImp</class>
     </component>
     </components>
    </service>

  • Deploy RMI Jar
  • Make a jar file include all class files and description file, then put the jar to Jmin deploy folder


    Copyright © 2006 . All Rights Reserved.