• Post Reply Bookmark Topic Watch Topic
  • New Topic

NoClassDefFoundError while RMI bind  RSS feed

 
Chandar S Vel
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All
I am writting a small rmi application and this is how my directory structure look like
com/rmi/graphservice
has two classes
(1) TaskInterface (Interface)
(2) TaskService (Implementation class)
com/util/common
(1) Binder (Binds all the remote object to the registry)
I have the make file as follows
javac *.java
rmic TaskService
It successfully created the stub & skeleton.

After that I compiled the Binder.java which is a class that will Bind all the remote objects into the RMIRegistry.
The function of the Binder is "it reads the properties file which has the names of the RemoteService and instantiates the Remote Object and later binds it into the RMI Registry after doing the UnicastRemoteObject.exportObject".

I tried running the Binder
java com.util.common.Binder
I was getting an exception NoClassDefFoundError.
Exception in thread "main" java.lang.NoClassDefFoundError: com/rmi/graphservice/TaskService_Skel (wrong name: TaskService_Skel)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at sun.rmi.server.RemoteProxy.loadClassFromClass(RemoteProxy.java:194)
at sun.rmi.server.RemoteProxy.getSkeleton(RemoteProxy.java:163)
at sun.rmi.server.UnicastServerRef.setSkeleton(UnicastServerRef.java:148)
at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:122)
at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:109)
at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:278)
at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:181)
at java.rmi.server.UnicastRemoteObject.exportObject(UnicastRemoteObject.java:158)
at com.util.common.Binder.<init>(Binder.java:60)
at com.util.common.Binder.main(Binder.java:169)
Can someone help me on this.
Thanks
Chandar S Vel.
 
imran anwar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
the problem is with your classpath settings. note that you need to run the
java com.util.common.Binder
from the parent folder of com. i.e, your current folder shud be com folder's parent folder. let me know if that helped.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!