Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Ignoring a crimson.jar which is in the /lib/ext folder of the JRE.

843834Mar 29 2007 — edited Mar 30 2007
My RCP plugin uses Xerces to parse XML files. To do this, I have Xerces jars in my classpath, and all looks fine.

But, if crimson.jar is put in the /lib/ext folder of the JRE (1.5.0_11), then when I use getTextContent() method of an instance of org.w3c.dom.Node interface, I realize that the crimson implementation was used rather than the Xerces one, because I get
java.lang.AbstractMethodError: org.apache.crimson.tree.ElementNode.getTextContent()Ljava/lang/String
The class name of the DocumentBuilderFactory which gets used is

org.apache.crimson.jaxp.DocumentBuilderFactoryImpl

and if I simply take crimson.jar away from lib/ext folder of the JRE, then the class name of the DocumentBuilderFactory which is used is

org.apache.xerces.jaxp.DocumentBuilderFactoryImpl

which I suppose is the Xerces implementation coming from the Xerces jars in my classpath. I need this one to be always used, regardless of whether crimson.jar is in the lib/ext folder of the JRE or not, because the implementation in crimson.jar causes the java.lang.AbstractMethodError. How should I do ?

Currently I'm doing
System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl")
, but setting this system property has some side effects and I'm not sure it is the proper way.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 27 2007
Added on Mar 29 2007
5 comments
1,422 views