Dom4j错误:java.lang.NoClassDefFoundError: org/jaxen/JaxenException
Dom4j可以使用Xpath来定位元素,具体可以使用selectNodes方法,但是在实际调用该类方法的时候出现了:java.lang.NoClassDefFoundError: org/jaxen/JaxenException,上述错误。
通过在网上查找,原来是缺少jaxen包,然后到jaxen的网站上看了这个包的介绍,上面写的是:Jaxen is an open source XPath library written in Java.It is adaptable to many different object models, includingDOM, XOM, dom4j, and JDOM. Is it also possible to writeadapters that treat non-XML trees such as compiled Java byte code or Java beans as XML, thus enabling you to query these trees with XPath too.
Dom4j之所以能够使用XPath来定位,其实是依赖了这个包,所以把这个包导入到工程中,就可以使用了。