Running JAX-WS with Tomcat

JAX-WS is not supported out of the box. But its very easy to make it run on Tomcat or any other web server for that matter.

I would recommend Netbeans IDE for starters, as its very easy to quickly code and run a webservice.

This is how the implementation looks like. Note that its a POJO with a few annotations.

In addition to this, you also have to edit the WEB-INF/web.xml as follows:

Also, you have to tell the JAX-WS runtime about the endpoint or the implementation. This is done by having a non-standard file called WEB-INF/sun-jaxws.xml. The entry is:

Once this is done, download JAX-WS from here. A small word of warning. Version 2.2 is buggy, so its advisable to use an older one. I used 2.1.7 without any issues. Put all the jars from the lib folder into the WEB-INF/lib folder of your webapp. Now you are ready to go. Deploy it on Tomcat, it should work like breeze.

You will find the sources This is a Netbeans project. Also, you can try the war file directly.

3 thoughts on “Running JAX-WS with Tomcat

  1. Thanks a lot! The only issue I had is that I needed to generate myself some artifacts with wsgen (the jaxws package inside the web service package). But I was using Eclipse and have done it all manually, no wizards.

Leave a Reply

Your email address will not be published. Required fields are marked *