欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

深入dom4j使用selectSingleNode方法报错分析

程序员文章站 2023-12-17 08:42:04
我有一段代码,使用dom4j 正则表达式解析gml , 代码如下:list featuremembers= root.selectnodes(...

我有一段代码,使用dom4j 正则表达式解析gml , 代码如下:
list<element> featuremembers= root.selectnodes("featuremember");
发生以下异常:
java.lang.noclassdeffounderror: org/jaxen/jaxenexception
    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.geoway.spatial.util.locationutils.parsetdtresponsedocument(locationutils.java:56)
    at com.geoway.spatial.util.locationutils.querytdtwfs(locationutils.java:33)
    at com.geoway.spatial.service.impl.tdtlocationserviceimpl.getlocationbyname(tdtlocationserviceimpl.java:28)
    at com.geoway.spatial.service.impl.locationadapter.getlocationbyname(locationadapter.java:31)
    at com.geoway.spatial.service.impl.locationadapter.test(locationadapter.java:48)
    at sun.reflect.nativemethodaccessorimpl.invoke0(native method)
    at sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39)
    at sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25)
    at java.lang.reflect.method.invoke(method.java:597)
    at org.springframework.beans.factory.annotation.initdestroyannotationbeanpostprocessor$lifecycleelement.invoke(initdestroyannotationbeanpostprocessor.java:297)
    at org.springframework.beans.factory.annotation.initdestroyannotationbeanpostprocessor$lifecyclemetadata.invokeinitmethods(initdestroyannotationbeanpostprocessor.java:250)
    at org.springframework.beans.factory.annotation.initdestroyannotationbeanpostprocessor.postprocessbeforeinitialization(initdestroyannotationbeanpostprocessor.java:144)
    at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.applybeanpostprocessorsbeforeinitialization(abstractautowirecapablebeanfactory.java:350)
    at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1329)
    at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:471)
    at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory$1.run(abstractautowirecapablebeanfactory.java:409)
    at java.security.accesscontroller.doprivileged(native method)
    at org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapablebeanfactory.java:380)
    at org.springframework.beans.factory.support.abstractbeanfactory$1.getobject(abstractbeanfactory.java:264)
    at org.springframework.beans.factory.support.defaultsingletonbeanregistry.getsingleton(defaultsingletonbeanregistry.java:217)
    at org.springframework.beans.factory.support.abstractbeanfactory.dogetbean(abstractbeanfactory.java:261)
    at org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:185)
    at org.springframework.beans.factory.support.abstractbeanfactory.getbean(abstractbeanfactory.java:164)
    at org.springframework.beans.factory.support.defaultlistablebeanfactory.preinstantiatesingletons(defaultlistablebeanfactory.java:429)
    at org.springframework.context.support.abstractapplicationcontext.finishbeanfactoryinitialization(abstractapplicationcontext.java:729)
    at org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:381)
    at org.springframework.web.context.contextloader.createwebapplicationcontext(contextloader.java:255)
    at org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:199)
    at org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:45)
    at org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:3934)
    at org.apache.catalina.core.standardcontext.start(standardcontext.java:4429)
    at org.apache.catalina.core.containerbase.addchildinternal(containerbase.java:791)
    at org.apache.catalina.core.containerbase.addchild(containerbase.java:771)
    at org.apache.catalina.core.standardhost.addchild(standardhost.java:526)
    at org.apache.catalina.startup.hostconfig.deploydirectory(hostconfig.java:987)
    at org.apache.catalina.startup.hostconfig.deploydirectories(hostconfig.java:909)
    at org.apache.catalina.startup.hostconfig.deployapps(hostconfig.java:495)
    at org.apache.catalina.startup.hostconfig.start(hostconfig.java:1206)
    at org.apache.catalina.startup.hostconfig.lifecycleevent(hostconfig.java:314)
    at org.apache.catalina.util.lifecyclesupport.firelifecycleevent(lifecyclesupport.java:119)
    at org.apache.catalina.core.containerbase.start(containerbase.java:1053)
    at org.apache.catalina.core.standardhost.start(standardhost.java:722)
    at org.apache.catalina.core.containerbase.start(containerbase.java:1045)
    at org.apache.catalina.core.standardengine.start(standardengine.java:443)
    at org.apache.catalina.core.standardservice.start(standardservice.java:516)
    at org.apache.catalina.core.standardserver.start(standardserver.java:710)
    at org.apache.catalina.startup.catalina.start(catalina.java:583)
    at sun.reflect.nativemethodaccessorimpl.invoke0(native method)
    at sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39)
    at sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25)
    at java.lang.reflect.method.invoke(method.java:597)
    at org.apache.catalina.startup.bootstrap.start(bootstrap.java:288)
    at org.apache.catalina.startup.bootstrap.main(bootstrap.java:413)
caused by: java.lang.classnotfoundexception: org.jaxen.jaxenexception
    at org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1387)
    at org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1233)
    at java.lang.classloader.loadclassinternal(classloader.java:320)
    ... 56 more

根据异常,发现少了一个类:org.jaxen.jaxenexception  这个类存在jaxen.jar包中,原因可想而知了!在路径下加入这个jar包即可。

上一篇:

下一篇: