[jdom-interest] java.lang.NoClassDefFoundError: org/jaxen/NamespaceContext
Rolf Lear
jdom at tuis.net
Mon Jul 16 03:36:04 PDT 2012
Hi Elías
The most likely cause of this is because you do not have the Jaxen jar
in your classpath. You need the Jaxen 1.1.3 (in the JDOM Download zip)
or Jaxen 1.1.4 jar (from the jaxen website).
Check your eclipse build path to make sure you have jaxen in it.
Rolf
On 16/07/2012 3:30 AM, Elías Manchón López wrote:
> Hello Folks,
>
> I'm using jdom2 in my eclipse project. I want to search with xpath in
> my xml file two nodes and I'm using the next code:
>
> XPathFactory factory = XPathFactory.instance();
> XPathExpression<Element> exprErrorCode =
> factory.compile("/descendant::error_code", Filters.element());
> Element error_code = (Element) exprErrorCode.evaluateFirst(_doc);
>
> if(error_code != null){
> errorCode = Integer.parseInt(error_code.getText());
> XPathExpression<Element> exprErrorDesc =
> factory.compile("/descendant::error_description", Filters.element());
> Element error_desc = (Element) exprErrorDesc.evaluateFirst(_doc);
> if(error_desc != null)
> errorDesc = error_desc.getText();
> }
>
> When I debug the program I get the next error:
>
> java.lang.NoClassDefFoundError: org/jaxen/NamespaceContext
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
> at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
> at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
> at
> org.jdom2.xpath.jaxen.JaxenXPathFactory.compile(JaxenXPathFactory.java:82)
> at org.jdom2.xpath.XPathFactory.compile(XPathFactory.java:281)
> at
> com.ej2DomiturIntegration.xml.XMLCommImpl.setErrorsFromXML(XMLCommImpl.java:263)
> at
> com.ej2DomiturIntegration.xml.XMLCommImpl.getConnResponse(XMLCommImpl.java:308)
> at
> com.ej2DomiturIntegration.xml.XMLCommImplTest.testOpenConnection(XMLCommImplTest.java:23)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:601)
> at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
> at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
> at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
> at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
> at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
> at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by: java.lang.ClassNotFoundException: org.jaxen.NamespaceContext
> at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
> ... 40 more
>
> Can somebody help me, please?
>
> Thanks in advance
More information about the jdom-interest
mailing list