July 18, 2009

JBoss Web Service issues with JDK6

The past two weeks I've working on an exercise for the university. The task was to create Enterprise Java Beans (EJB) and Web Services (WS) which were then deployed to and run on the JBoss Application Server. We were using Eclipse Ganymede EE, Java JDK6 and JBoss version 5.0.1 GA for our purposes.

My colleagues and I had quite some troubles getting it all to work but eventually we managed it because most of the issues are documented and their resolutions are available on several sites somewhere on the net. Only this particular issue seemed to be covered nowhere or if it was, the solutions suggested did not work for us. I'm giving you the solution that worked for us here, maybe it helps somebody who runs into the same issues we've experienced.

Many people seem to succeed with the Instructions for using JBoss5 on Java6 from the JBoss Getting Started Guide, but for whatever reason this did not work for us. If you have the same problem persisting even after copying around the library-files, read on.

I hope the solution present here can also help you with your problem. If you have anything to add, find a mistake or can give any other feedback, please leave me a comment.


The issue

JBoss is up and running without trouble, having webservices deployed and visible on the webservice-endpoint overview at http://localhost:8080/jbossws/services. But upon calling one of the methods provided the JBoss chokes with the exception:

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:445)
    at org.jboss.ws.core.soap.SOAPMessageImpl.<init>(SOAPMessageImpl.java:82)
    at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:215)
... 
(and some more exceptions with "setProperty must be overriden..." appearing several times)

and the webservice call fails with no result.

Quickly explained solution

  1. install JDK5 and add it to Eclipses installed Runtime Environments
  2. set JBoss execution environment to use JRE5
  3. set JRE in webservice-projects buildpath to JRE5
  4. set Project Facet in webservice-project for Java to 5.0

Detailed solution

  1. download JDK5 from Sun
  2. install JDK5 (only JDK needed, no seperate JRE, docs, etc.)
  3. add JDK5 to Eclipse as Installed JRE (Window->Preferences->Java->Installed JREs->Search...)
  4. change startup configuration of JBoss to JDK5 (doublecklick on JBoss-entry in Servers-tab->General Information->Open launch configuration->JRE->Alternate JRE)
  5. change the projects JRE System Library to use JDK5. Either via right-click on the system library entry in the project->Properties or right-click on the project->Build Path->Configure Build Path->select "JRE System Library"->Edit. Then set the Alternate JRE to JDK5
  6. change the projects Java facet to JDK5 (right click on project->Properties->Project Facets->Change the setting next to the "Java" entry to "5.0"
  7. check, that in %JBOSS_PATH%/server/default/deploy (or your own configured deploy-path in JBoss) there are no .war-files left from your current project
  8. if not already suggested by Eclipse itself, rebuild the webservice project (if building automatically just clean the project via Project->Clean...)
  9. start JBoss via Eclipse
  10. check that somewhere near the beginning of the JBoss console log something like "Java Version: 1.5.xxx Sun Microsystems Inc" or "Java HotSpot(TM) Client VM 1.5.xxx" appears as "INFO [ServerInfo]" log line

If you are receiving errors like "java.lang.UnsupportedClassVersionError: Bad version number in .class file" then there is still something connected with JDK6 left in your project. Check the steps again and also your included libraries if there is something suspicious and then rebuild the project.

After all these steps you should finally be able to call web service methods on your endpoint without causing those exception anymore.

Issue background

The technical details and origins of this error are explained in JBWS-2649 along with an initial solution. In short JRE/JDK6 includes a dummy-implementation for this setProperty() method which overrides the required implementation which is supplied with JBoss. The mentioned initial solution solves the problem by copying the supplied libraries to a location in the classpath where it should be loaded before the JRE libraries but as already mentioned this did not work for most of our class.

July 10, 2009

Team switch

This week, the first week back at work after vacation, had quite an interesting start. Monday was without surprises, just Sprint demos and a bit of administrative work. But on Tuesday the interesting stuff began when I received an invitation for Sprint planning meetings of another team.

As it turned out, there had been some initial conversation about me helping in another team for a specific task but the discussion had no clear conclusion. In the end and after some negotiation between the teams we agreed that for the upcoming month I'm assigned to the other team. There I'll assist with their current tasks so that the task I've been originally requested for can be finished faster after the ones with higher priority are completed.

So I'm now completely shifted to a different team (the same I've already joined some time ago) for four weeks and after the first few days my impression is that as well the other team can benefit from my knowledge with the Scrum methodology as well as I can benefit from the different tools and experience how they solve their problems. A clear win-win situation.

Of course everything has been discussed with my other team and it posed no problem to them in the upcoming time.

Just one drawback is that the next vacation block in two weeks had to be canceled because of these changes. But since I've got plenty of vacation left for this year, this is fine with me.