Tuesday, May 25, 2010

Tomcat 6 with JAX-WS 2.1

Foremost get the latest JDK (Anything after JDK 1.6 update 4 or later) as this would not require to configure/create additional "endorsed" directory (since rt.jar contains jax-ws 2.1 api).

To use JAX-WS 2.1 with Tomcat
1. Downloadthe JAX-WS libraries
2. Install (or Extract) the downloaded file with
java -jar JAXWS2.1.2-20070917.jar
3. Assuming the libraries were installed on $CATALINA_HOME/jaxws-ri, edit shared.loader property in $CATALINA_HOME/conf/catalina.properties as follows
shared.loader=$CATALINA_HOME/jaxws-ri/lib/*.jar
If $CATALINA_HOME is not defined on the environment edit catalina.properties as
shared.loader=${catalina.home}/jaxws-ri/lib/*.jar
That's all!

Be sure to have the web.xml and sun-jaxws.xml files in the WS deployment .war, unlike glassfish and weblogic, this tomcat configuration doesn't auto create them and wsdl won't be exposed.