Issues with the Arbortext JVM class loader

From AdeptersWiki

Jump to: navigation, search

Answered by: Mohan Kumar
Last Updated: 2006-06-18

Problem

I am using java SAXBuilder in one of my java wizards, which in turn is called by EPIC. The application works find in WSAD. I copied the required jars to run this application for eg: jdom.jar,xml-apis.jar, saxpath.jar,jaxen-jdom.jar,xalan.jar in the custom/lib folder. When this is called ACL, I get the following error:

org.jdom.JDOMException: Could not load org.apache.xerces.parsers.SAXParser:
SAX2 driver class org.apache.xerces.parsers.SAXParser not found:
org/apache/xerces/parsers/SAXParser.

I wonder if anyone has similar problem and is ready to help me.

The code snippet is:

SAXBuilder saxBuilder =
    new SAXBuilder("org.apache.xerces.parsers.SAXParser", false);
saxBuilder.setIgnoringElementContentWhitespace(true);
saxBuilder.setFeature("http://apache.org/xml/features/validation/schema", false);
_document = saxBuilder.build(new StringReader(xmlString));


Solution

Epic JVM classloader had issues in the past. I think, your epic JVM has issues in loading the SAXBuilder class from the jar file.

If you are sure that the one of the jar files you have copied into custom\lib directory contains SAXBuilder class file, and epic still has issue in loading the class, I suggest to try the following methods.

  • Copy the jars into custom\classes directory and try.
  • If step 1 didn't work, Try setting the class loader manually. Here is the code to set the class loader manually before using the SAXBuilder class in your code.
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());

Step 2 approach has worked very well for us so far.

Personal tools