Monday, April 28, 2008

NoClassDefFoundError: com/sun/org/apache/xerces/internal/dom/DocumentImpl

java.lang.NoClassDefFoundError: com/sun/org/apache/xerces/internal/dom/DocumentImpl
at java.lang.ClassLoader.defineClass0(Native Method)
..........
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.(SOAPPartImpl.java:63)
at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.(SOAPPart1_1Impl.java:29)
at com.sun.xml.messaging.saaj.soap.ver1_1.Message1_1Impl.getSOAPPart(Message1_1Impl.java:52)
at

Cause: Missing a class
Solution:
There are two versions of the xercesImpl.jar that define the different classes in different packages. These packages are the following:

com.sun.org.apache
org.apache

The DocumentImpl class is defined in the following packages of each corresponding jar:
com.sun.org.apache.exerces.internal.dom
org.apache.xerces.dom

The jar that contains the DocumentImpl of the NoClassDefFoundError is contained in the first jar. Please include this jar in the classpath before the second version of the jar.

Reference:
http://mail-archives.apache.org/mod_mbox/xerces-j-users/200407.mbox/%3C40F0D3AD.3050201@sun.com%3E

2 comments:

Anonymous said...

Thanks for the post. I was having problems with this just now, and a quick google search brought up your blog post. I ended up having to add the xerxes.jar in addition to the xerxesImpl.jar

Anonymous said...

Replace by :

org.apache.xerces.dom.DOMImplementationSourceImpl