Reputation: 2843
NoClassDefFoundError gives me different kinds of messages in different contexts
By contexts, I mean,
Context 1:
If I remove the sapjco3.jar
, the message is
java.lang.NoClassDefFoundError: com/xxx/xxx/AbapException
Context 2: If I add the jar file in the webapp lib, the message is
java.lang.NoClassDefFoundError: com.xxx.xxx.CpicDriver
I understand java.lang.NoClassDefFoundError
is thrown when a class is not found during runtime.
but why there is a difference in representing the class in the message, ie with a slash (path) and dot (package)?
Upvotes: 2
Views: 311
Reputation: 5614
If you look at javadoc for NoClassDefFoundError exception, you'll see it has two constructor, one of which is accepting a message as parameter.
So formatting of the name for the class not found is depending on the code throwing the exception .
I don't know sapjco, but maybe the two classes are loaded by differents class loaders...
Upvotes: 2
Reputation: 792
Seems like java.lang.NoClassDefFoundError: com/xxx/xxx/AbapException is missing. This is not in sapjco3.jar.
Suppose a.class and b.class are required and order of loading is a,b. if a and b are not in classpath you will first get a is missing. if a is added in the class path you will get b is missing. Hope that is clear.
Upvotes: 0