Showing results for 
Search instead for 
Did you mean: 

XML parsing using Commons Digester in Netweaver

Former Member
0 Kudos


I am trying to parse an XML file using commons-digester and on parsing I get SAPClassNotFoundException for the class file "com.rim.eselling.web.navigation.NavigationRule" that i defined in the mapping-rules.xml for the digester. The test runs fine locally as a java application but throws this exception when running on a web environment??

Any idea why its unable to load the class file "com.rim.eselling.web.navigation.NavigationRule"?



inNegativeCache= true


with message saying:



Found in negative cache


Loader Info -

ClassLoader name: []

Parent loader name: [Frame ClassLoader]

No references !








Loading model: {parent,local,references}



<b>Digester rules file is defined as under:</b>

  <pattern value="navigation/navigation-rule">
    <object-create-rule classname="<b>com.rim.eselling.web.navigation.NavigationRule</b>"/>
    <set-next-rule methodname="add" paramtype="java.lang.Object"/>
    <bean-property-setter-rule pattern="logged-in" propertyname="loggedIn"/>
    <bean-property-setter-rule pattern="account-just-created" propertyname="accountJustCreated"/>
    <bean-property-setter-rule pattern="role" propertyname="role"/>
    <bean-property-setter-rule pattern="from-url" propertyname="fromURL"/>
    <bean-property-setter-rule pattern="error" propertyname="error"/>
    <bean-property-setter-rule pattern="nav-code" propertyname="navCode"/>
    <bean-property-setter-rule pattern="user-action" propertyname="userAction"/>
    <bean-property-setter-rule pattern="current-page" propertyname="currentPage"/>
    <bean-property-setter-rule pattern="next-page" propertyname="nextPage"/>

<b>Error causing code:</b>

URL rules = NavigationHandler.class.getResource(MAPPING_RULES_FILE_NAME);
Digester digester = DigesterLoader.createDigester(rules);

// Push empty List onto Digester's Stack
navRules = new ArrayList();
digester.push( navRules );


// Parse the XML document
InputStream xmlfile = NavigationHandler.class.getResourceAsStream(XML_FILE_NAME);
navRules = (ArrayList)digester.parse(xmlfile);<b><---------- ERROR</b>

Accepted Solutions (1)

Accepted Solutions (1)

Active Contributor
0 Kudos

Hi Faraz,

I don't know the internal classloader use of Digester, but at a first glance, I would interpret the situation as follows:

You have deployed apache.orgjakartaCommon as a central server library. If you call <i>parse</i>, Digester gets called and reads the rules XML which you directly passed over to Digester through <i>createDigester</i>. Now Digester parses the rules and realises to have to look out for the NavigationRule class. And this happens from Digester internally without having gotten some classloader to use; in this case I expect Digester to use it's own classloader as stated in the message: [library:apache.orgjakartaCommon]. From this classloader hierarchy on (means: upwards), your NavigationRule cannot be found.

A short look into the Digester API shows the <i>load</i> methods to which you can pass a classloader. Try to make use of one of these, passing your own application classloader, which also references the NavigationRule class in question. See for details.

Alternatively, before calling <i>parse</i> call <i>setClassLoader</i> on the Digester instance itself or call <i>setUseContextClassLoader(true)</i> and just before that, set the context classloader on the thread.

Hope it helps


Former Member
0 Kudos

Thanks Detlev, this solved my problem. Your help is much appreciated.


Answers (0)