Reputation: 7590
I'm getting a really weird error (for me). We'd added a new dependency to the project's pom file. The jar file are in the project (downloaded from the repository) and we can see all all the class files and the source code.
We added some code in our program to create some classes defined in the new jar file. The code compiles without errors and the war file deploy in the webserver (websphere) without problems too.
But when debugging the program we found an java.lang.NoClassDefFoundError
exception when we try to create the first object from the new jar file.
Today I found that the jar file have been compiled with jdk 1.7 and all our projects is compiled using 1.6 jdk. I see the jdk used to compile the jar file in the manifest file. Is this info correct ? The difference between jdks used in jar file and my project could cause the problem ?
I checked that the jar file definition exists in classpath and websphere server was rebooted several times.
Stacktrace :
Caused by: java.lang.ClassNotFoundException: cnaf.verificateurbiciban.ws.v1.VerificateurbicibanV1ServiceCnaf
at java.net.URLClassLoader.findClass(URLClassLoader.java:423)
at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:191)
at java.lang.ClassLoader.loadClass(ClassLoader.java:660)
at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:111)
at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62)
at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:510)
at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:542)
at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:542)
at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
... 56 more
Upvotes: 0
Views: 1485
Reputation: 487
Problem might be cause by JRE version you are using to execute your code: if you are using JRE 1.6 it would not execute bytecode compiled for JRE 1.7. JRE 1.7 would perfectly run both 1.6 and 1.7 bytecode. Try to switch to JRE 1.7 or higher.
Upvotes: 1