views:

648

answers:

2

This is a continuation of the question here: http://stackoverflow.com/questions/2435286/jboss-does-app-have-to-be-compiled-under-same-jdk-as-jboss-is-running-under

It's different enough though that it required a new question.

I am trying to use jdk6 to run JBOSS 5.1, and I downloaded the JDK6 version of JBOSS 5.1. This works fine and my EAR application deploys fine. However, when I want to run a web service client with code like this:

public static void main(String[] args) throws Exception {
    System.out.println("creating the web service client...");
    TestClient client = new TestClient("http://localhost:8080/tc_test_project-tc_test_project/TestBean?wsdl");
    Test service = client.getTestPort();
    System.out.println("calling service.retrieveAll() using the service client");
    List<TestEntity> list = service.retrieveAll();
    System.out.println("the number of elements in list retrieved using the client is " + list.size());
}

I get the following exception:

javax.xml.ws.WebServiceException: java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
    at org.jboss.ws.core.jaxws.client.ClientImpl.handleRemoteException(ClientImpl.java:396)
    at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:302)
    at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:170)
    at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)

Now, here's the really interesting part. If I change the JDK that my the code above is running under from JDK6 to JDK5, the exception above goes away! It's really strange.

The only way I found for the code above to run under JDK6 was to take the JBOSS_HOME/lib/endorsed folder and copy it to JDK6_HOME/lib. This seems like it shouldn't be necessary, but it is.

Is there any other way to make this work other than using the workaround I just described?

+1  A: 

There are various suggestions and explanations in the respective bug report and elsewhere (e.g. here and here). I don't know how well they work.

Tomislav Nakic-Alfirevic
+1  A: 

Looks roughly as if you ran into the presence of JAX-WS as an official feature of JDK 1.6. Don't copy things to 'lib', copy them to an 'endorsed' directory (one listed in java.endorsed.dirs). This might be helpful.

If you have an up-to-date 1.6, you can get around this the same way that Apache CXF does. See the documentation for information on how to use CXF in a 1.6 environment.

bmargulies
Not sure I understand. I took the JBOSS_HOME/lib/endorsed folder and copied it to JDK6_HOME/lib, so I ended up with JDK6_HOME/lib/endorsed. Did you mean something else?
dcp