tags:

views:

284

answers:

3

I am getting a NoSuchMethodError error for org.w3c.dom.Document.setDocumentURI. This is strange, as I have rt.jar in the JAVA_HOME path.

I am creating a web service using CXF, and the error seem to be coming out of 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)

Can someone offer some advice? Much thanks

+3  A: 

I'd assume you are using Java 1.4.2 (where this method does not exist) for your Tomcat. So check whether JAVA_HOME is set to 1.5+.

Bozho
A: 

You probably have an ancient version of xerces on the classpath. Definitely check xerces versions.

Daniel Kulp
A: 

I am also facing the same issue. Am using apache cxf 2.2.10 and jdk 1.5 and am not using xerces. What could be the problem. Please help

Sreeni