Search

Saturday, June 6, 2015

java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlObject [Solved]

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlObject error means that your Java program needed a class called org.apache.xmlbeans.XmlObject but JVM is not able to find that in your application's CLASSPATH. You can see the actual cause of this error is "java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlObject". Most probable reason of this error could be a missing JAR file. In order to solve this error you need to first find out which JAR file this class belongs. If you look at the error message its clearly saying that its from xmlbeans package, it means this class belongs to XMLBeans library. Sometime its not obvious in that case I suggest you to take advantage of your IDE e.g. Eclipse, Netbeans or IntelliJ IDEA. In Eclipse, you can search for a particular class using Eclipse shortcut Ctrl + T and then entering the name of the class. You just need to enter name, no need to enter fully qualified name which includes package. Eclipse will display all the JAR, which have class files with same name, but in order to use this feature, your application needs to be setup in Eclipse with all its dependency. If that's not the case then just Google it and you will find which library this JAR belongs to. Now coming back to our original problem, how to fix java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlObject error? Simple, just include xmlbeans-2.6.0.jar into your program's CLASSPATH. BTW, there is just one difficultly, how do you choose the right version of JAR? Let's find out in next paragraph.
Read more »

No comments:

Post a Comment