Sunday Jul 22, 2007

Metro on Tomcat 6.x

Rama described how to run JAX-WS samples with Tomcat 6.x. JAX-WS is part of Metro - the Web services stack in GlassFish. Another key component of Metro is WSIT (aka Project Tango) that provides Secure, Reliable, Transactional and Interoperable Web service. Read more about Project Tango in this 26-page article.

A stable version of Metro is integrated in GlassFish V2 and the latest nightlies of stand-alone bundle are also available. The stand-alone bundle comes with an install scipt (wsit-on-tomcat.xml) that allows it install on Tomcat 5.x. I followed the steps in Rama's blog to install Metro on Tomcat 6.x. But first, a little bit of explanation and then the actual code fragments.

Tomcat's classloading mechanism has changed slightly between 5.x and 6.x. The first change is that Tomcat 5.x used to have shared/lib directory to share classes across all web applications. This directory in turn used to be specified as value of shared.loader property in  conf/catalina.properties. In Tomcat 6.x, the property still exists but it's value is set to nothing and shared/lib directory no longer exists in the default installation. I see the motivation behind this change as it keeps the Tomcat installation directory clean and any shared resources can still be specified in conf/catalina.properties. But this means that wsit-on-tomcat.xml script, that copies the files in shared/lib directory, will work on Tomcat 5.x only. In order for this script to work on Tomcat 6.x, the value of shared.loader property need to be changed to include Metro jars.

Now, the code fragments! The value of shared.loader property in Tomcat 5.x is:

shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/\*.jar

And in Tomcat 6.x is the value of this property is:

shared.loader=

If Metro is installed in c:\\metro then changing its value to:

shared.loader=file:///c:/metro/lib/\*.jar

will enable Tomcat 6.x to host Secure, Reliable, Transactional and .NET 3.0-Interoperable Web services. And this mechanism will work for Tomcat 5.x too, so changing the value of this property in Tomcat 5.x installation to:

shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/\*.jar,file:///c:/metro/lib/\*.jar

instead of copying the files in shared/lib will be sufficient as well.

The second change in Tomcat's classloading mechanism is required if you are using Java SE 6. Tomcat 5.x used to have common/endorsed directory which no longer exists in Tomcat 6.x. Java SE 6 is bundled with JAX-WS 2.0 and Metro needs JAX-WS 2.1. So if you are using Java SE 6 then copy webservices-api.jar in c:/jdk6/jre/lib/endorsed directory. Read Endorsed Directory Mechanism for more details.

Several screencasts are available that show how to develop Secure, Reliable and Transactional and Interoperable Web service. All the screencasts use NetBeans IDE but if you are more of a command-line user then follow this entry that shows how to develop a reliable endpoint and invoke it from WCF and vice versa.

Technorati: metro webservices wsit jax-ws glassfish tomcat

Friday Mar 17, 2006

JAX-WS 2.0 Samples on Tomcat 5.5.x

Starting today's nightly, the JAX-WS samples can be easily run on Tomcat 5.5.x. This blog tells you how to install a JAX-WS nightly build on Tomcat container and run the samples using that.

Installing JAX-WS 2.0 on Tomcat

  1. Download JAXWS_SI.jar from the nightly build and install it on your machine by giving the following command:

    java -jar JAXWS_SI.jar

    This will install JAX-WS binaries, samples, documentation and other files in jaxws-ri directory (JAXWS_HOME) in your current directory.
  2. Download and save this script (jaxwsontomcat.xml) in JAXWS_HOME directory.
  3. Please make sure CATALINA_HOME environment variable points to the directory where Tomcat is installed. Go to JAXWS_HOME directory and invoke:

    ant -f jaxwsontomcat.xml install

Running the Samples

To develop and deploy the samples on Tomcat, you need to give the following command:

ant server -Dtomcat=true

To develop and deploy the samples on Application server, you need to give the following command:

ant server

If you are familiar with the samples framework, then this is the same command as before. 

To invoke the deployed WAR file, follow the instructions from the samples documentation. All of your samples can now be deployed on Tomcat container, in addition to Sun's Application Server.

Hope you find this useful.


Technorati: Tomcat jwsdp
About

profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.


Java EE 7 Samples

Stay Connected

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today