1 Reply Latest reply on Oct 18, 2010 10:35 PM by EJP

    Loaded serializable objects.

      Hi,I have a question.This is the tutorials: http://download.oracle.com/javase/6/docs/technotes/guides/rmi/codebase.html
      (3.2 How codebase is used in Java RMI
      Like applets, the classes needed to execute remote method calls can be downloaded from "file:///" URLs, but like applets, a "file:///" URL generally requires that the client and the server reside on the same physical host, unless the file system referred to by the URL is made available using some other protocol, such as NFS.
      Generally, the classes needed to execute remote method calls should be made accessible from a network resource, such as an HTTP or FTP server.)
      Is this really true?
      I tried the follow http://download.oracle.com/javase/tutorial/rmi/index.html
      On two computer use winxp professional os connect together.
      Directory structure:server
      Java –Djava.rmi.server.codebase=file:/c:/JavaRmi/classes/ -Djava.security.policy=policy engine.ComputeEngine

      Server successful.

      Directory structure:client

      java -Djava.rmi.server.codebase=file:/c:/JavaRmi/classes/ -Djava.security.policy=policy client.ComputePi <hostname> 2
      But Error at client.

          java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 
          java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: 
          java.lang.ClassNotFoundException: client.Pi
          at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
          at sun.rmi.transport.Transport$1.run(Unknown Source)
          at java.security.AccessController.doPrivileged(Native Method)
          at sun.rmi.transport.Transport.serviceCall(Unknown Source)
          at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
          at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
          at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
          at java.lang.Thread.run(Unknown Source)
          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:160)
          at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194)
          at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148)
          at $Proxy0.executeTask(Unknown Source)
      the class client.Pi is loaded by server from client's file system
      My File System is NTFS ,is not NFS.So orcurred error?
        • 1. Re: Loaded serializable objects.
          Clever but that's not the idea. Replicating the same file structure on all clients doesn't constitute a codebase, sorry. If you've going to do that why not just use the classpath feature? The idea is that the same codebase is available to all clients in the network, and also to the Registry, which I'm pretty certain is the cause of this error (Registry.bind() or Registry.rebind() will be in the stack trace lower down). In the case of a file: codebase it needs to be a shared directory.
          Is this really true?
          Yes, or else a shared directory as stated above.
          1 person found this helpful