ClassNotFoundException

Hello,

Can anyone tell me why when I try to register the RMI Server the following runtime exception occurs:

========================

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

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

java.lang.ClassNotFoundException: serverperf.ServerInterface

.....

=========================

[FACTS]

1. I start rmiregistry as required;

2. On another computer it works!

3. ServerInterface class file is present.

Please advise - what could be the reason.

Thanks!

[650 byte] By [ACVa] at [2007-11-27 7:42:31]
# 1
What we need in this forum is a F.A.Q. section, like the Concurrency Forum.You must be the millionth person asking this question. Search the forum.
cooper6a at 2007-7-12 19:23:24 > top of Java-index,Core,Core APIs...
# 2
> 3. ServerInterface class file is present.but it is in the CLASSPATH of the client? and the Registry? or niether but available via the codebase if you're using that feature?
ejpa at 2007-7-12 19:23:24 > top of Java-index,Core,Core APIs...
# 3

First of all, thanks for you attention.

1. I don't think I need the interface .class in the classpath. I did the same thing on another machine without changing anything in CLASSPATH.

2. I've searched the forum, but still nothing related to this. Today I'll try again. :)

3. I'm not using codebase since I lnow it works without.

Maybe it is a security issue? I'll post all the stacktrace if you mind.

-

D:\ACV\JAVA\ServerPerf\build\classes>start rmiregistry

D:\ACV\JAVA\ServerPerf\build\classes>java serverperf.Main

Nu gasesc nica!

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

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

java.lang.ClassNotFoundException: serverperf.ServerInterface

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(Unknown Source)

at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)

at sun.rmi.server.UnicastRef.invoke(Unknown Source)

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

at serverperf.Main.main(Main.java:40)

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

java.lang.ClassNotFoundException: serverperf.ServerInterface

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: serverperf.ServerInterface

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.loadProxyInterfaces(LoaderHandler.java:711)

at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:655)

at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:592)

at java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:628)

at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:294)

at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:238)

at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1531)

at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1493)

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

ACVa at 2007-7-12 19:23:24 > top of Java-index,Core,Core APIs...
# 4
> 1. I don't think I need the interface .class in the classpath.Of course you do. That's what the exception is telling you.> I did the same thing on another machine> without changing anything in CLASSPATH.Must have already been in the classpath.
ejpa at 2007-7-12 19:23:24 > top of Java-index,Core,Core APIs...
# 5
Ok, Thanks, I'll try that and tell you the results
ACVa at 2007-7-12 19:23:24 > top of Java-index,Core,Core APIs...
# 6
Sorry, but it doesn't care of CLASSPATH, I ran the program with NetBeans (which works with absolute paths) - the same thing. Ok, don't bother to reply - seems that it is my stupid fault. Keep on trying.Thanks to everyone - when I solve it I'll post here for everybody to know.
ACVa at 2007-7-12 19:23:24 > top of Java-index,Core,Core APIs...
# 7

You could always try doing something about the CLASSPATH as suggested hours ago.

As a last resort of course. Try everything else first. It's probably more interesting to try to prove wrong the people who are trying to help you than to actually take their advice. Not as productive, but who cares?

ejpa at 2007-7-12 19:23:24 > top of Java-index,Core,Core APIs...
# 8
Thanks ejp,I am re-installing java now, seems that something went wrong when I upgraded to jdk 1.6But of course I have been trying to follow your advices.
ACVa at 2007-7-12 19:23:24 > top of Java-index,Core,Core APIs...
# 9

Amazing!

I''ve just reinstalled Java (1.6) and everything works fine!

All I did :

1. Uninstall Java (JDK and JRE);

2. Run jdk setup;

3. Add PATH variable = ....\jdk\bin ;

4. Restart the computer.

I think it was an upgrade issue from 1.5 to 1.6. However, it didn't work on 1.5 that's why I had decided to update to 1.6.

This was the solution. Thanks to everyone who tried to help me!

see ya

ACVa at 2007-7-12 19:23:24 > top of Java-index,Core,Core APIs...