Results 1 to 8 of 8
  1. #1
    guest_user is offline Member
    Join Date
    May 2011
    Posts
    47
    Rep Power
    0

    Default What is wrong with my classpath?

    I have an rmi server(HelloWorldServer) and client(HelloWorldClient). The rmi server implements a remote interface(HelloWorldInterface). These 3 classes are part of the same java package(helloworldrmi) and I have created a jar file containing the 3 classes, helloworldrmi.jar

    My classpath is -cp path/to/helloworldrmi.jar

    When I try to run it using
    java -cp path/to/helloworldrmi.jar helloworldrmi.HelloWorldServer

    It throws a ClassNotFoundException exception saying helloworldrmi.HelloWorldInterface is not found

    What's wrong?

    I'm trying this on a windows machine, on a linux machine, it works just fine

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,387
    Rep Power
    25

    Default

    Please post the full text of the error message.
    Where is the class: helloworldrmi.HelloWorldInterface
    Is there a copy laying around on the linux machine that is not there on Windows?

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,997
    Rep Power
    19

    Default

    Also show us the contents of the jar file.
    Did you jar the folder, or just the 3 classes?

  4. #4
    guest_user is offline Member
    Join Date
    May 2011
    Posts
    47
    Rep Power
    0

    Default

    Quote Originally Posted by Tolls View Post
    Also show us the contents of the jar file.
    Did you jar the folder, or just the 3 classes?
    in the jar file:
    META-INF contains manifest.mf
    helloworldrmi contains HelloWorldClient.class HelloWorldServer.class HelloWorldInterface.class

  5. #5
    guest_user is offline Member
    Join Date
    May 2011
    Posts
    47
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    Please post the full text of the error message.
    Where is the class: helloworldrmi.HelloWorldInterface
    Is there a copy laying around on the linux machine that is not there on Windows?
    helloworldrmi.HelloWorldInterface is in the jar file
    error message:

    RemoteException occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
    tion is:
    java.lang.ClassNotFoundException: helloworldrmi.HelloWorldInterface
    java.rmi.ServerException: RemoteException occurred in server thread; nested exce
    ption is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
    tion is:
    java.lang.ClassNotFoundException: helloworldrmi.HelloWorldInterface
    at sun.rmi.server.UnicastServerRef.oldDispatch(Unicas tServerRef.java:396
    )
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastSe rverRef.java:250)
    at sun.rmi.transport.Transport$1.run(Transport.java:1 59)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport. java:155)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages( TCPTransport.java:5
    35)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run0(TCPTranspor
    t.java:790)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run(TCPTransport
    .java:649)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExec
    utor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor
    .java:908)
    at java.lang.Thread.run(Thread.java:662)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceiv edFromServer(Unknow
    n Source)
    at sun.rmi.transport.StreamRemoteCall.executeCall(Unk nown Source)
    at sun.rmi.server.UnicastRef.invoke(Unknown Source)
    at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
    at java.rmi.Naming.rebind(Unknown Source)
    at helloworldrmi.HelloWorldServer.main(HelloWorldServ er.java:59)
    Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested ex
    ception is:
    java.lang.ClassNotFoundException: helloworldrmi.HelloWorldInterface
    at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknow n Source)
    at sun.rmi.server.UnicastServerRef.oldDispatch(Unicas tServerRef.java:386
    )
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastSe rverRef.java:250)
    at sun.rmi.transport.Transport$1.run(Transport.java:1 59)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport. java:155)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages( TCPTransport.java:5
    35)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run0(TCPTranspor
    t.java:790)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandl er.run(TCPTransport
    .java:649)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(ThreadPoolExec
    utor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor
    .java:908)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: java.lang.ClassNotFoundException: helloworldrmi.HelloWorldInterface
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 47)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at sun.rmi.server.LoaderHandler.loadProxyInterfaces(L oaderHandler.java:7
    11)
    at sun.rmi.server.LoaderHandler.loadProxyClass(Loader Handler.java:655)
    at sun.rmi.server.LoaderHandler.loadProxyClass(Loader Handler.java:592)
    at java.rmi.server.RMIClassLoader$2.loadProxyClass(RM IClassLoader.java:6
    28)
    at java.rmi.server.RMIClassLoader.loadProxyClass(RMIC lassLoader.java:294
    )
    at sun.rmi.server.MarshalInputStream.resolveProxyClas s(MarshalInputStrea
    m.java:238)
    at java.io.ObjectInputStream.readProxyDesc(ObjectInpu tStream.java:1530)
    at java.io.ObjectInputStream.readClassDesc(ObjectInpu tStream.java:1492)
    at java.io.ObjectInputStream.readOrdinaryObject(Objec tInputStream.java:1
    731)
    at java.io.ObjectInputStream.readObject0(ObjectInputS tream.java:1328)
    at java.io.ObjectInputStream.readObject(ObjectInputSt ream.java:350)
    ... 12 more

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,387
    Rep Power
    25

    Default

    Looks like everything is there???
    Whoops. Got it.

  7. #7
    guest_user is offline Member
    Join Date
    May 2011
    Posts
    47
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    Looks like everything is there???
    Whoops. Got it.
    so what's the problem?

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,997
    Rep Power
    19

    Default

    What is your code doing here:
    at helloworldrmi.HelloWorldServer.main(HelloWorldServ er.java:59)
    ?
    Because if you're just starting up a server I'm wondering why it's trying to unmarshall something.

Similar Threads

  1. Replies: 4
    Last Post: 06-11-2013, 01:37 AM
  2. Replies: 1
    Last Post: 05-03-2011, 02:28 AM
  3. Classpath
    By jojo in forum New To Java
    Replies: 5
    Last Post: 02-04-2010, 10:04 PM
  4. Classpath on mac osx
    By jacobb in forum JDBC
    Replies: 0
    Last Post: 06-12-2008, 09:41 PM
  5. Set classPath?
    By rgbosque in forum New To Java
    Replies: 3
    Last Post: 02-07-2008, 02:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •