Reply to comment

Jbossws 2.0.1 with JDK 1.6

Here I describe how to use the latest jbossws (2.0.1) with JDK 1.6

Prior to version # 2.0.0.GA, jbossws (The Jboss stack for web services based on jax-ws ), did not support JDK 1.6. But since the 2.0.0.GA version , support for JDK 1.6 has been added.

However you need to take some extra steps in order for jbossws to work correctly under JDK 1.6. Following is a list of things you need to do in order to install and run jbossws in jbossas (jboss application server) under JDK 1.6.

Supported Jboss versions

jbossws 2.0.1.GA supports the following jboss versions.
  • 4.0.5.GA
  • 4.2.x
  • 5.x

Any previous jboss versions are not supported.

In order to install jbossws on top of an existing jboss app server installation, first download the latest distribution.Unzip it in some temporary folder, and depending upon your target jboss version change the jboss50.home, or jboss42.home, or jboss40.home property to point to your jbossas installation. After that do ant deploy-jboss[50|42|40].

The build file, will then remove the stock jbossws that came with the app. server installation, and install jbossws 2.0.1.GA in it's place. This completes the installation part

Support for JDK 1.6

Jbossws 2.0.1.GA is based on the jax-ws and jaxb versions 2.1. But JDK 1.6 ships jaxb 2.0 classes as part of the core distribution (rt.jar). So in order for the jboss jars to take precedent over the jdk supplied jars, we have to use the endorsed directory mechanism, as described here. The above link is for using jaxws ri 2.1, but we need jbossws 2.0.1. For that purpose copy the following 3 jars in to the jboss/lib/endorsed directory.

So assuming your jboss is setup in a directory /jboss and you have already installed jbossws 2.0.1 on top of it, Copy the following 3 files to /jboss/lib/endorsed.
  • /jboss/server/default/lib/jboss-saaj.jar
  • /jboss/server/default/lib/jboss-jaxws.jar
  • /jboss/client/jaxb-api.jar

The jboss run script is already configured to add the /jboss/lib/endoresed directory to the list of endorsed directory. So jars in this directory will take precedence over rt.jar.

Other notes

These are things that I have noticed, as part of trial and error of getting jbossws to work correctly with JDK 1.6. I couldn't find any documentation for them any where, so I am listing them here so that other can benefit from my experiences.

Target Namespace

With jbossws < 2.0.0.GA, you did not need to specify a target namespace for your web service, the default is derived from the Java package name. However in the 2.0.1.GA version I noticed, that if you don't specify a target namespace, and if the web service interface and implementation are in different packages, then you get errors at invocation time. The same used to work with the stock jbossws (1.0.3) that came with 4.0.5 ver. of jboss.

So if your WS interfaces and implementations are in different Java packages, then make sure to add the same target namespace to the @WebService annotation, for both the interface and the implementation.

JMX local Agent

If you enable the jmx local agent for your jboss app. server, with the System property -Dcom.sun.management.jmxremote, then under jbossws 2.0.1.GA , your web services will not deploy. Not only that, if you deploy your application as an "EAR" file, any Web applications inside the ear file will also not deploy. Strangly however any ejb jar files, will deploy and work.

Depending on the JDK version (1.5 or 1.6) you are using you will get a NPE, in different classes, but the crux of the problem, is that WSServiceConfig MBean described in jbossws.sar/jbossws.beans/META-INF/jboss-beans.xml, will not be deployed, if the local JMX agent is enabled.

Hope this write up has helped you in your quest to run jbossws 2.0.1.GA against JDK 1.6.

 

Reply

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]".

More information about formatting options