java.lang.NoSuchMethodError:org.w3c.dom.Document.setDocumentURI

时间:2010-04-18 06:16:01

标签: java cxf

我收到org.w3c.dom.Document.setDocumentURI的NoSuchMethodError错误。这很奇怪,因为我在JAVA_HOME路径中有rt.jar。

我正在使用CXF创建一个Web服务,错误似乎来自CXF:

java.lang.NoSuchMethodError: org.w3c.dom.Document.setDocumentURI(Ljava/lang/String;)V
 org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:760)
 org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:219)
 org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:179)
 org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:91)
 org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:403)
 org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:528)
 org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:278)
 org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:178)
 org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:100)
 org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:105)
 org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:167)
 org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:349)
 org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:262)
 org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:212)
 org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:407)
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 java.lang.reflect.Method.invoke(Method.java:597)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1414)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1375)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
 java.security.AccessController.doPrivileged(Native Method)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
 org.apache.cxf.transport.servlet.CXFServlet.loadAdditionalConfig(CXFServlet.java:171)
 org.apache.cxf.transport.servlet.CXFServlet.updateContext(CXFServlet.java:139)
 org.apache.cxf.transport.servlet.CXFServlet.loadSpringBus(CXFServlet.java:101)
 org.apache.cxf.transport.servlet.CXFServlet.loadBus(CXFServlet.java:70)
 org.apache.cxf.transport.servlet.AbstractCXFServlet.init(AbstractCXFServlet.java:78)
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
 org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
 java.lang.Thread.run(Thread.java:619)

有人可以提供一些建议吗?非常感谢

2 个答案:

答案 0 :(得分:3)

我假设您正在使用Java 1.4.2(此方法不存在)用于Tomcat。因此,请检查JAVA_HOME是否设置为1.5 +。

答案 1 :(得分:0)

你可能在类路径上有一个古老版本的xerces。绝对检查xerces版本。