|
RMI-IIOPHello SampleCopyright © 1999 Sun Microsystems, Inc.
|
Note: Don't forget to set up a security policy file. See the following section for instructions.
The RMI section in the Java Tutorial contains a discussion of policy files.grant { permission java.security.AllPermission; };
cp $JAVA_HOME/demo/rmi-iiop/hello/*.java .
javac *.java
cd ..
rmic hello.RemoteHelloServer
rmic -iiop hello.RemoteHelloServer
rmiregistryStart the registry in its own window. Remember to run rmi-iiop in the new window before running the registry.
tnameserv -ORBInitialPort 1050
java -Djava.rmi.server.codebase=http://aslan.narnia.com/java/ -Djava.security.policy=policy -Djava.naming.factory.initial=com.sun.jndi.rmi.registry.RegistryContextFactory hello.RemoteHelloServer
java -Djava.rmi.server.codebase=http://aslan.narnia.com/java/ -Djava.security.policy=policy -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory -Djava.naming.provider.url=iiop://aslan.narnia.com:1050 hello.RemoteHelloServer
java -Djava.rmi.server.codebase=http://aslan.narnia.com/java/ -Djava.security.policy=policy -Djava.naming.factory.initial=com.sun.jndi.rmi.registry.RegistryContextFactory hello.RemoteHelloApplication aslan.narnia.com
java -Djava.rmi.server.codebase=http://aslan.narnia.com/java/ -Djava.security.policy=policy -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory -Djava.naming.provider.url=iiop://aslan.narnia.com:1050 hello.RemoteHelloApplication aslan.narnia.com:1050
appletviewer http://aslan.narnia.com/jrmp.html
appletviewer http://aslan.narnia.com/iiop.html
Exception | Probable Cause |
---|---|
java.lang.ClassCastException | The stub class file cannot be found in the client class path |
java.lang.NoClassDefFound | The interface class file cannot be found in the client class path |
java.rmi.ConnectException | Either the server has not been started or you are running a client for the wrong protocol |