[jdom-interest] Using Xpath in jdom

Peterson, Nathan nathan.peterson at amestrib.com
Wed Oct 22 13:03:53 PDT 2003


First I'm green to java in general. That said, I've been tring to use
Xpath.selectSingleNode() inside a servlet. When I access the page I get
the 500 error below:

java.lang.NoClassDefFoundError: org/saxpath/SAXPathException
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:140)
	at org.jdom.xpath.XPath.newInstance(XPath.java:133)
	at org.jdom.xpath.XPath.selectSingleNode(XPath.java:377)
	at production.viewStatus(production.java:74)
	at production.processRequest(production.java:99)
	at production.doGet(production.java:119)

I searched the archives, and came away with adding the jaxen-core.jar,
jaxen-jdom.jar, saxpath.jar to the classpath. I've done this and I still
get the error.
Heres the code I use:

      SAXBuilder builder = new SAXBuilder();
      Document status = builder.build(new File(statusfile));
      Element woof = status.getRootElement();
      Element bb = (Element)XPath.selectSingleNode(woof,
"job[@jid='1']");


Any suggestions? Ideas?



More information about the jdom-interest mailing list