Monthly Archives: March 2010

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 https://github.com/paawak/blog/tree/master/code/WebServiceExample. This is a Netbeans project. Also, you can try the war file directly.

Steps to create a signed applet

Many times while working with Applets, you need a signed jar to circumvent the security restrictions placed on an unsigned applet. Here are three simple steps of creating a self-signed applet:
keytool -genkey
keytool -selfcert
jarsigner myapplet.jar mykey


Further reading:

http://www-personal.umich.edu/~lsiden/tutorials/signed-applet/signed-applet.html

http://java.sun.com/javase/6/docs/technotes/tools/solaris/keytool.html