Tip for using JAX-WS 2.2/ Metro 2.0 with Tomcat 6.x on JDK 6
If you trying to use JAX-WS 2.2 on top of JDK 6, you run into classloading problems. Resonating with the problems we had with using JAX-WS 2.1 on JDK 6 FCS?, Dejavu !!!.
As you guessed, JDK 6 (U4 and later) has JAX-WS implementation with JAX-WS 2.1 API. If you try to use JAX-WS 2.2, the runtime always picks up the JAX-WS API from bootclasloader and will not see JAX-WS 2.2 API in your classpath. Well, the solution is the same, i.e, using the endorsed overriding mechanism. This has been documented and discussed before.
But how do you configure for Web Services running on Tomcat 6 using JDK 6. Its easy with Tomcat 5.5, you just need to copy jaxws-api.jar and jaxb-api.jar into $TOMCAT_HOME/common/endorsed directory. But there are some changes in classloading in Tomcat 6.x and there is no documentation on the default endorsed directory.
Here it is, you have to create endorsed directory in $TOMCAT_HOME and Copy jax-ws.api.jar and jaxb-api.jar from JAX-WS (webservices-api.jar in case of Metro) to $TOMCAT_HOME/endorsed. You might also find my other blog on running JAX-WS samples on Tomcat 6.x useful.
I am putting here one of the problems one would see when using JAX-WS 2.2 features without endorsed mechanism. For ex, if you are using AddressingFeature.Responses added in JAX-WS 2.2 API, you would get
SEVERE: WSSERVLET11: failed to parse runtime descriptor: java.lang.NoSuchMethodError: javax.xml.ws.soap.Addressing.responses()Ljavax/xml/ws/soap/AddressingFeature$Responses;
Follow the above tip to configure the endorsed directory and it should work.