Context:
when running Netbeans under JDK 1.5.X or later, when one jsp file is opened and being saved, following exception is thrown:
java.lang.AbstractMethodError: org. customer.xerces.dom.DeferredDocumentImpl.setDocumentURI(Ljava/lang/String;)V
o make a long story short:
- Method
public void setDocumentURI(String documentURI);
was added to the org.w3c.dom.Document interface
in J2SE 1.5 (it was not present in J2SE 1.4).
- The new method is implemented by
com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl
(in J2SE 1.5), but not by
org.apache.xerces.dom.DeferredDocumentImpl
in xercesImpl.jar
- javax.xml.parsers.DocumentBuilderFactory in J2SE 1.5 will instantiate
factories of type "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"
for webapps bundling xercesImpl.jar, due to the presence of the
META-INF/services/javax.xml.parsers.DocumentBuilderFactory resource
in that JAR, which specifies
"org.apache.xerces.jaxp.DocumentBuilderFactoryImpl" as the factory
type to be instantiated.
Instructing the WebappClassLoader to avoid loading any symbols from
"org.apache.xerces" (and hoping it would fallback to
"com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl")
won't solve the problem.
I've arrived at a fix, which is to define a system property with name
javax.xml.parsers.DocumentBuilderFactory
and specify
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
as its value.
Friday, June 6, 2008
Subscribe to:
Posts (Atom)