Java and Corba

Integrating Java and CORBA: A programmer's perspective

Before you can start, download and unzip this zip-File to an arbitrary directory (we will refer to this directory as <dir>). Add <dir> to your classpath (set classpath=<dir>;%classpath%). You should also have JDK 1.3 (available online at http://java.sun.com/j2se/1.3/) installed on your machine. Make sure that the directories containing  the JDK binaries (eg. C:\jdk1.3\bin;C:\jdk1.3\jre\bin) are in your PATH. If not, do so by entering set path=C:\jdk1.3\bin;C:\jdk1.3\jre\bin;%path%.

The RMI Example

  1. Change into directory:cd <dir>
  2. Compile the classes: javac example\rmi\*.java; javac example\rmi\ui\*.java
  3. Generate stubs and skeletons: rmic example.rmi.ChatRoomImp; rmic example.rmi.UserImp
  4. Start the RMI naming service: rmiregistry.exe
  5. Start a chat room server: java example.rmi.ChatRoomImp <name to register>

  6. (This blocks your current command window. Therefore, you may prefix the command with start to allow a new command window to be created)
  7. Start a chat client: java example.rmi.ui.ChatClient

  8. (A window like the one below should open)
  9. Provide the URL of the chat room server (eg.rmi://<host>/<name to register>) and your desired username

The RMI-over-IIOP Example

  1. Change into directory:>cd <dir>
  2. Compile the classes: javac example\rmiiiop\*.java; javac example\rmiiiop\ui\*.java
  3. Generate stubs and ties: rmic -iiop example.rmiiiop.ChatRoomImp; rmic -iiop example.rmiiiop.UserImp
  4. Start the transient naming service: tnameserv.exe
  5. Start a chat room server (one line):

  6. java -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory \\
         -Djava.naming.provider.url=iiop://localhost:900 \\
          example.rmiiiop.ChatRoomImp <name to register>
    (This blocks your current command window. Therefore, you may prefix the command with start to allow a new command window to be created)
  7. Start a chat client (one line):

  8. java -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory \\
         -Djava.naming.provider.url=iiop://localhost:900 \\
          example.rmiiiop.ui.ChatClient
    (A window like the one below should open)
  9. Provide the name of the chat room server specified on server startup (<name to register>) and your desired username

Java RMI and CORBA Resources

Java Remote Method Invocation (RMI) Homepage http://java.sun.com/j2se/1.3/docs/guide/rmi/index.html
RMI Specifications http://java.sun.com/j2se/1.3/docs/guide/rmi/spec/rmiTOC.html
RMI Tutorials http://java.sun.com/j2se/1.3/docs/guide/rmi/getstart.doc.html
http://java.sun.com/j2se/1.3/docs/guide/rmi/rmisocketfactory.doc.html
http://java.sun.com/j2se/1.3/docs/guide/rmi/activation.html
OMG Homepage http://www.omg.org/
RMI over IIOP at Sun http://java.sun.com/products/rmi-iiop/index.html
CORBA Language Mapping Specifications http://www.omg.org/technology/documents/formal/corba_language_mapping_specifica.htm
Java IDL http://java.sun.com/j2se/1.3/docs/guide/idl/index.html
RMI over IIOP at IBM http://www.ibm.com/java/jdk/rmi-iiop/
CORBA Technology and the Java Platform http://java.sun.com/j2ee/corba/
Objects-by-Value Specification ftp://ftp.omg.org/pub/docs/orbos/98-01-18.pdf