I get the following exception when trying to access any nodes of a parsed xml document on dom4j:
Exception in thread \"main\" java.lang.NoClassDefFoundError: or
A java.lang.NoClassDefFoundError
is thrown by the JVM when a dependency that was available at the time a particular class was compiled cannot be found on the classpath when the class is loaded for use by the JVM.
How are you invoking the parser code? Check and make sure that all the DOM4J dependencies in the lib
folder of the DOM4J distribution (jaxen, jaxme-api etc) are on the classpath.
If you are invoking the parser from the command line you can use the -classpath
option:
java -classpath C:\myjars\jar1.jar;C:\myjars\jar1.jar
If you are invoking the parser from Ant for example use the
tag:
Your xpath expressions are not even being evaluated so you should stoptweaking those until you have sorted out your classpath issues.