1 Reply Latest reply on Sep 14, 2013 8:26 PM by wheleph

    RMI Tutorial Error

    Fernando Costa

      I'm trying to complete the RMI tutorial [An Overview of RMI Applications], but it is not working properly. I want to register the remote object (ComputeEngine.java) using an EC2 AIM virtual server instance and access it through a client (ComputePi.java) running on my ultrabook. I've compiled the server code and started the RMI registry sucessfully, but when i try to register the remote object, i receive a ClasseNotFoundException exception:

       

      [root@ip-172-31-19-0 tutorial]# java -cp /home/ec2-user/java/rmi/tutorial/src:/home/ec2-user/java/rmi/tutorial/lib/compute.jar

      -Djava.rmi.server.codebase=http://<PUBLIC_IP>:8080/rmi/tutorial/lib/compute.jar

      -Djava.rmi.server.hostname=<PUBLIC_IP>

      -Djava.security.policy=server.policy

      engine.ComputeEngine &

      [4] 27190

      [root@ip-172-31-19-0 tutorial]# ComputeEngine exception:

      java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:

              java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:

              java.lang.ClassNotFoundException: compute.Compute

              at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:419)

              at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:267)

              at sun.rmi.transport.Transport$1.run(Transport.java:177)

              at sun.rmi.transport.Transport$1.run(Transport.java:174)

              at java.security.AccessController.doPrivileged(Native Method)

              at sun.rmi.transport.Transport.serviceCall(Transport.java:173)

              at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)

              at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)

              at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

              at java.lang.Thread.run(Thread.java:724)

              at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:273)

              at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:251)

              at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:377)

              at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)

              at engine.ComputeEngine.main(ComputeEngine.java:61)

       

      I have found many discussions treating about this error, but no one helped me to fix it.

       

       

       

      What am i doing wrong?

       

       

       

      PS.: I have no variable CLASSPATH defined. Tomcat installation is fine  (directory listing enabled). Files are avaliable at "codebase" location as expected.