aspose file tools*
The moose likes Distributed Java and the fly likes RMI: ClassNotFoundException for STUB class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "RMI: ClassNotFoundException for STUB class" Watch "RMI: ClassNotFoundException for STUB class" New topic
Author

RMI: ClassNotFoundException for STUB class

Hardik Raja
Ranch Hand

Joined: Feb 07, 2006
Posts: 117
Dear JavaRanchers,

I am trying to implement a simple RMI application; It compiles successfully but I get an exception during execution. From the exception excerpt (see highlighted part in COMPLETE EXCEPTION below) it seems that the stub class(Iward.Hri.Remote.RemoteNotifyImplementation_Stub) is not found, but I did include its path in the classpath (so I guess the JVM should be able to find it).

I am not able to figure out the cause of this exception.

Could anyone please provide some input on this?

***IMPORTANT NOTE***
Please find below the exception during runtime as well as the actual code for your reference.

Also I have created the stub/skeleton as follows,
C:\>rmic -vcompat Iward.Hri.Remote.RemoteNotifyImplementation

and Stubs and skeletons are generated properly and included in the classpath

Kind regards,
Hardik Raja




  • COMPLETE EXCEPTION

  • java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: Iward.Hri.Remote.RemoteNotifyImplementation_Stub

    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:396)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250)
    at sun.rmi.transport.Transport$1.run(Transport.java:159)
    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:535)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
    at java.lang.Thread.run(Thread.java:619)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:359)
    at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
    at java.rmi.Naming.rebind(Naming.java:160)
    at Iward.Hri.Remote.RemoteNotifyImplementation.main(RemoteNotifyImplementation.java:36)
    Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
    java.lang.ClassNotFoundException: Iward.Hri.Remote.RemoteNotifyImplementation_Stub
    at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:386)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250)
    at sun.rmi.transport.Transport$1.run(Transport.java:159)
    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:535)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: java.lang.ClassNotFoundException: Iward.Hri.Remote.RemoteNotifyImplementation_Stub
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:434)
    at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
    at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
    at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
    at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
    ... 12 more
    BUILD STOPPED (total time: 9 seconds)



  • INTERFACE : RemoteNotifyInterface.java




  • INTERFACE IMPLEMENTATION : RemoteNotifyImplementation.java

  • zul' Zorander
    Greenhorn

    Joined: Aug 12, 2009
    Posts: 21
    did you start the rmi registry???
    Vijitha Kumara
    Bartender

    Joined: Mar 24, 2008
    Posts: 3775

    Hardik Raja wrote:...
    Also I have created the stub/skeleton as follows,
    C:\>rmic -vcompat Iward.Hri.Remote.RemoteNotifyImplementation
    and Stubs and skeletons are generated properly and included in the classpath


    First of all, you don't need to generate stubs etc.. yourself. Which JDK are you using ?


    SCJP 5 | SCWCD 5
    [How to ask questions] [Twitter]
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: RMI: ClassNotFoundException for STUB class
     
    Similar Threads
    Classpath Issue
    Exceptions in Rmi program
    cant run java file from command line but works with .sh file??
    Eclipse wont run my RMI program?
    HFJ - RMI issues.