Note: [Mar 23, 2017] This website was migrated to a new platform recently. Some linked content may not be accessible until all the links are configured properly,

JAX-WS Web services in JBoss 5 do not work (JDK 1.6, Eclipse IDE)?

Submitted by Kamal Wickramanayake on June 12, 2010 - 07:19

Environment: JDK 1.6, JBoss 5.1, Eclipse 3.5 (Galileo)

I came across the following JBoss error when a JAX-WS Web service was accessed:

11:15:18,008 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
    at javax.xml.soap.SOAPMessage.setProperty(SOAPMessage.java:441)
    at org.jboss.ws.core.soap.SOAPMessageImpl.<init>(SOAPMessageImpl.java:87)

This happens when you start JBoss from Eclipse. If you start JBoss by running the run.sh (or run.bat in Windows), the error does not appear.

The root cause is a jar file conflict. When you start JBoss via run.sh, JVM uses the correct jar files provided with JBoss. But if you start JBoss via Eclipse, JVM does not use the JBoss bundled updated jars but uses the old ones available with JDK. As a developer, you may prefer to start JBoss via Eclipse during development. Here's how you do it:

  1. In Eclipse, access the "Servers" view.
  2. Double click on JBoss server ("JBoss v5.0 at localhost"). The settings editor opens.
  3. Double click on the "Open launch configuration" link found under "General Information". The launcher configuration editor opens.
  4. Go to the "Arguments" tab. Your VM arguments might look like the following:
    "-Dprogram.name=run.bat -Xms128m -Xmx512m  -XX:MaxPermSize=256m"
  5. Append the following to the above line after keeping a space (Note that you need to use the correct directory name where you have installed JBoss inside which you find the lib/endorsed directory):
    " -Djava.endorsed.dirs=/home/kamal/programs/jboss-5.1.0.GA/lib/endorsed"
  6. Save everything and start the JBoss server.

The VM argument -Djava.endorsed.dirs informs the JVM to use the "Endorsed Standards" or "Standalone Technologies" libraries from the specified directory instead of the ones bundled with JDK. "Endorsed Standards" libraries come from standards that are developed outside JCP (Java Community Process - the general Java evolution process). "Standalone Technologies" also evolve separately. Hence there is a chance that they release new versions of their libraries before a new version of the Java platform is released. The -Djava.endorsed.dirs allows you to use the newer versions of the libraries. Another approach is to copy the new libraries to jre/lib/endorsed directory (found inside Java installation directory). JVM then uses the new versions of  Endorsed Standards or Standalone Technologies libraries instead of the old versions. More on this is found in Java Endorsed Standards Override Mechanism. In the bottom of that page you see that some JAX-WS related jars come from Endorsed Standards.