getting java.lang.NoClassDefFoundError: org/jaxen/JaxenException
807605Aug 9 2007 — edited Aug 17 2007I am trying to build the list by parsing the xml and I am getting error "Exception in thread "main" java.lang.NoClassDefFoundError: org/jaxen/JaxenException
at org.dom4j.xpath.DefaultXPath.parse(DefaultXPath.java:358)
at org.dom4j.xpath.DefaultXPath.<init>(DefaultXPath.java:59)
at org.dom4j.DocumentFactory.createXPath(DocumentFactory.java:230)
at org.dom4j.tree.AbstractNode.createXPath(AbstractNode.java:207)
at org.dom4j.tree.AbstractNode.selectNodes(AbstractNode.java:164)
at com.qvc.customerservices.app.tsvemail.provider.ProductInfoProvider.getTSVInfo(ProductInfoProvider.java:113)
at com.qvc.customerservices.app.tsvemail.provider.ProductInfoProvider.getProductInfo(ProductInfoProvider.java:97)
at com.qvc.customerservices.app.tsvemail.manager.TSVEmailManagerImpl.createPreviewEmail(TSVEmailManagerImpl.java:151)
at com.qvc.customerservices.app.tsvemail.manager.MainClass.main(MainClass.java:37)
"
Here is the code. I do have dom4j.jar and jaxen.jar in my classpath. The xml I am trying to parse is something like
<response>
<METHOD name = "">
<Product value1="" value2="">
</Product>
</METHOD>
</response>
Please help.
Document doc = DocumentHelper.parseText(xml);
List list = doc.selectNodes("/METHOD/Product");
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
Node node = (Node) iterator.next();
System.out.println(node.getName());
}
I use RAD for Java application and Clearcase for the code repository. I do have my buildpath set, which includes jaxen.jar and dom4j.jar. Also I have correct import for jaxen expection. If I try to parse the xml with following code then it works fine.
Document dom = DocumentHelper.parseText(xml); //get root element
Element root1 = dom.getRootElement();
List list1 = root1.elements();
Element element = (Element) list1.get(0);
List list2 = element.elements();
Element element2 = (Element) list2.get(0);
String value1= element2.attribute("value1").getText();
I asked people who know better java then me and they are also not able to figure out why am I getting jaxenexpection If I try to do
List list = doc.selectNodes("/METHOD/Product");