Hello Folks,<br><br>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:<br><br>XPathFactory factory = XPathFactory.instance();<br>XPathExpression<Element> exprErrorCode = factory.compile("/descendant::error_code", Filters.element());<br>
Element error_code = (Element) exprErrorCode.evaluateFirst(_doc);<br><br>if(error_code != null){<br> errorCode = Integer.parseInt(error_code.getText());<br> XPathExpression<Element> exprErrorDesc = factory.compile("/descendant::error_description", Filters.element());<br>
Element error_desc = (Element) exprErrorDesc.evaluateFirst(_doc);<br> if(error_desc != null)<br> errorDesc = error_desc.getText();<br>}<br><br>When I debug the program I get the next error:<br><br>java.lang.NoClassDefFoundError: org/jaxen/NamespaceContext<br>
at java.lang.ClassLoader.defineClass1(Native Method)<br> at java.lang.ClassLoader.defineClass(ClassLoader.java:791)<br> at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)<br> at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)<br>
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)<br> at java.net.URLClassLoader$1.run(URLClassLoader.java:361)<br> at java.net.URLClassLoader$1.run(URLClassLoader.java:355)<br> at java.security.AccessController.doPrivileged(Native Method)<br>
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)<br> at java.lang.ClassLoader.loadClass(ClassLoader.java:423)<br> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)<br> at java.lang.ClassLoader.loadClass(ClassLoader.java:356)<br>
at org.jdom2.xpath.jaxen.JaxenXPathFactory.compile(JaxenXPathFactory.java:82)<br> at org.jdom2.xpath.XPathFactory.compile(XPathFactory.java:281)<br> at com.ej2DomiturIntegration.xml.XMLCommImpl.setErrorsFromXML(XMLCommImpl.java:263)<br>
at com.ej2DomiturIntegration.xml.XMLCommImpl.getConnResponse(XMLCommImpl.java:308)<br> at com.ej2DomiturIntegration.xml.XMLCommImplTest.testOpenConnection(XMLCommImplTest.java:23)<br> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br>
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)<br> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)<br> at java.lang.reflect.Method.invoke(Method.java:601)<br>
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)<br> at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)<br> at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)<br>
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)<br> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)<br> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)<br>
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)<br> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)<br> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)<br>
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)<br> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)<br> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)<br>
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)<br> at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)<br> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)<br>
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)<br> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)<br> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)<br>
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)<br>Caused by: java.lang.ClassNotFoundException: org.jaxen.NamespaceContext<br> at java.net.URLClassLoader$1.run(URLClassLoader.java:366)<br>
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)<br> at java.security.AccessController.doPrivileged(Native Method)<br> at java.net.URLClassLoader.findClass(URLClassLoader.java:354)<br> at java.lang.ClassLoader.loadClass(ClassLoader.java:423)<br>
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)<br> at java.lang.ClassLoader.loadClass(ClassLoader.java:356)<br> ... 40 more<br><br>Can somebody help me, please?<br><br>Thanks in advance<br>