views:

316

answers:

1

All service classes in my case extend javax.xml.ws.Service.

But real invocations as I see work through 3-rd party libraries under the hood. In my case tomcat uses Axis2.

First I should ask, what jars Tomcat uses to run a web-service?

Second, is there a way to change them?

Third, what does this exception mean? It needs another jar file in Tomcat/lib directory?

got this stack trace when trying to invoke a web-service client generated:

17:23:21    12.05.2010      caused by: java.lang.NoClassDefFoundError: org/apache/axiom/om/OMNode
17:23:21    12.05.2010      at org.apache.axis2.deployment.DescriptionBuilder.buildOM(DescriptionBuilder.java:96)
17:23:21    12.05.2010      at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:79)
17:23:21    12.05.2010      at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:615)
17:23:21    12.05.2010      at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:115)
17:23:21    12.05.2010      at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64)
17:23:21    12.05.2010      at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:180)
17:23:21    12.05.2010      at org.apache.axis2.jaxws.ClientConfigurationFactory.getClientConfigurationContext(ClientConfigurationFactory.java:51)
17:23:21    12.05.2010      at org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.createServiceDescription(DescriptionFactoryImpl.java:74)
17:23:21    12.05.2010      at org.apache.axis2.jaxws.description.DescriptionFactory.createServiceDescription(DescriptionFactory.java:67)
17:23:21    12.05.2010      at org.apache.axis2.jaxws.spi.ServiceDelegate.(ServiceDelegate.java:84)
17:23:21    12.05.2010      at org.apache.axis2.jaxws.spi.Provider.createServiceDelegate(Provider.java:45)
17:23:21    12.05.2010      at javax.xml.ws.Service.(Service.java:56)
+2  A: 

1/ Tomcat does not come with a default Web service implementation. Axis2 has been placed either in the webapp you deployed in Tomcat, or directly in the Tomcat lib directory. This second option is generally not suggested.

Let's imagine you have webapp1 which uses Axis2 version 1.4 and webapp2 which uses Axis2 version 1.5. Version 1.4 and 1.5 have different dependencies, so you'll end up having class loading errors when Tomcat starts if you mix the dependencies up.

Please refer to Tomcat documentation about class loading for more details.

2/ Let's consider you've placed the Axis2 libraries in the webapp you've deployed within Tomcat. You could use Apache CXF or Sun JAX-WS RI in place of Axis2.

If you want to use Sun JAX-WS RI, make sure you place all the libraries and all their dependencies in your webapp. Tomcat will use the implementation he loads in the webapp context. If tomcat/lib has Axis2 libraries, it might create class loading issues (see 1/).

3/ Axis2 1.5 has some dependencies. It seems the library axiom-api-1.2.8.jar is missing from your classpath.

rochb
@rok Could you explain 1) why putting axis2 to tomcat/lib is not suggested, 2) *how many jars should I put directly the the war* archive to use let's say SUN JAX-WS RI ? If I put them into the war then, although Tomcat does not contain any installed JAX-WS environment, it will use the desired implementation anyway?
EugeneP
see edited answer.
rochb