I get a NoClassDefFoundError for the org/jdom/Document class when I try to execute an XPath expression on a web application deployed to Oracle Application Server 9052 (yeah I know, it’s a pos). It makes absolutely no sense because I’ve had no problems with JDOM for parsing and walking the document tree in the same application. This exception only occurs when I try to execute an XPath expression to get a specific element in the document. The same war application works correctly in Tomcat 5.
This is the function where the exception is thrown:
private Element findItemElement(Document d, String id) {
String expr = "/ItemReviewData/ContentDictionary/Items/Item[@id='" + id + "']";
try {
XPath xpath = XPath.newInstance(expr);
return (Element) xpath.selectSingleNode(d);
} catch (JDOMException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
This is the stack trace:
500 Internal Server Error
java.lang.NoClassDefFoundError: org/jdom/Document at org.jaxen.jdom.DocumentNavigator.getDocumentNode(DocumentNavigator.java:313) at org.jaxen.expr.DefaultAbsoluteLocationPath.evaluate(DefaultAbsoluteLocationPath.java:113) at org.jaxen.expr.DefaultXPathExpr.asList(DefaultXPathExpr.java:107) at org.jaxen.BaseXPath.selectNodesForContext(BaseXPath.java:716) at org.jaxen.BaseXPath.selectNodes(BaseXPath.java:239) at org.jaxen.BaseXPath.selectSingleNode(BaseXPath.java:262) at org.jdom.xpath.JaxenXPath.selectSingleNode(JaxenXPath.java:153) at org.nbme.fbp.ir.service.impl.XmlBluePrintServiceImpl.findItemElement(XmlBluePrintServiceImpl.java:233) at org.nbme.fbp.ir.service.impl.XmlBluePrintServiceImpl.updateItemReviewStatus(XmlBluePrintServiceImpl.java:170) at org.nbme.fbp.ir.action.itemreview.ItemPageAction.executeAction(ItemPageAction.java:35) at org.nbme.fbp.ir.action.SpringBaseAction.execute(SpringBaseAction.java:39) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.1.0)].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65) at clime.messadmin.core.MessAdminFilter.doFilter(MessAdminFilter.java:166) at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.1.0)].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16) at org.nbme.common.security.SecurityFilter.doFilter(SecurityFilter.java:70) at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.1.0)].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20) at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:39) at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.1.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:600) at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.1.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317) at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.1.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:793) at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.1.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:208) at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.1.0)].server.http.AJPRequestHandler.run(AJPRequestHandler.java:125) at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.1.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192) at java.lang.Thread.run(Thread.java:534)
If anybody has any ideas, I’ll be eternally grateful. I’m pretty sure it has to do with Oracle but I would love to find a workaround.