Wednesday, June 27, 2007

JDK 1.6 + JBoss 4.2.0 + EJB3 Web Service + Axis2

Few days ago I started to implement web service in current project.I exposed a few methods in existing EJB.The deployment of WS to JBoss server and generating WS client using Axis2 are ok.But when the client trying to invoke the WS at server,exception was thrown at server side.

java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
at javax.xml.soap.SOAPMessage.setProperty(SOAPMessage.java:424)
at org.jboss.ws.soap.SOAPMessageImpl.(SOAPMessageImpl.java:65)
at org.jboss.ws.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:115)
at org.jboss.ws.binding.soap.SOAP11BindingProvider.createMessage(SOAP11BindingProvider.java:59)
at org.jboss.ws.binding.soap.SOAPBindingProvider.bindRequestMessage(SOAPBindingProvider.java:89)
at org.jboss.ws.binding.soap.SOAP11BindingProvider.bindRequestMessage(SOAP11BindingProvider.java:65)
at org.jboss.ws.jaxrpc.CallImpl.invokeInternal(CallImpl.java:645)
at org.jboss.ws.jaxrpc.CallImpl.invoke(CallImpl.java:404)
...

Same problem was reported at JBossWS Jira .click here

After I googling,I found that this problem only arise when we use JDK 6. I tried to switch back to JDK5,and it works. Then I tried various methods, such as trying to deploy on JBoss 5.0 beta yet it still doesn't work. According to some forumers, the reason for this is the SAAJ classes being used in Sun JDK 1.6.0 are not compatible with JBossWS since they use their own SAAJ jar named jboss-saaj.jar. So,we will need to make sure that jboss-saaj is loaded before default one.

The solution to this is modifying JBoss lib folder structure.
1.Move all the jar file from ${JBOSS_HOME}/lib into ${JBOSS_HOME}/lib/endorsed except getopt.jar, jboss-system.jar, jboss-jmx.jar
2.Make sure the jboss-saaj.jar and jboss-jaxrpc.jar is in it.

It works for me after I modified the structure. :)

12 comments:

Unknown said...

It works for me, too. Thanks a lot !

Unknown said...

Hi, I'm facing the same problem. I did what u mentionned but it still doesn't work :( Any advice....

PS : I'm working with JBoss 4.2.1.

Unknown said...

Here is my email : anis.benmahmoud@gmail.com. Thx again

Thor said...

This hack still work for me even I upgrade Jboss to 4.2.2.Anyway,probably you can give me more information so I know how can I help you with.

Maxi Ng said...

This works for me.
Thank you so much THOR.
This should post to JBoss Forum to let more people know.

Fabrizio Farenga said...

Im using Jboss 4.2.0 and Java 1.6.0_04 but it still doesn't work.

Maybe it's not clear the latest thing to do:

2.Make sure the jboss-saaj.jar and jboss-jaxrpc.jar is in it.

What do you mean exactly?

Thor said...

Sorry guys,I am currently in China and FYI,blogspot.com is blocked here.Therefore I need to use a proxy in order to visit my own blog.For any question on this,please email me :
just.thor[a]gmail.com

I will try to reply asap...thanks

Unknown said...

Hi, i'm trying to make a ejb based web service but i'm not an expert and not get it works. could someone help me? first that mi ejb3 is currentky work but I add anotarions to make it web service and wen deploy at jboss 4.2.1 throw an exception that means that complex types are not supported, I return List or PersonEntity class in some methods....
Please I need help

Unknown said...

Hi guys,
I am another victim....let me give you a brief description of my scenario:
I tested my standalone code which required saaj.jar and it was working

when I integrated and deployed it on jboss...it threw ClassCastException. I noticed that "org.apache.axis.Message" class changed to "org. jboss .axis.Message". My Jboss had jboss-saaj.jar...

I received advise from one of colleagues to add the following line:System.setProperty("javax.xml.soap.MessageFactory", "org.apache.axis.soap.MessageFactoryImpl");

before an instance of MessageFactoryImpl was invoked.

and...it fixed it...'how' is still a mystery...

Unknown said...

Running JBOSS 4.2.2 I was able to fix the problem by following item 2 only (copying jboss-jaxrpc & jboss-saaj) into the jboss home's lib\endorsed folder.

Glad to have found that little tip here, still managed to kill a couple hours :(

Sanket Singh said...

Hi ,


Thanks a lot for the resolution.

I am using 4.2.3._GA version of JBoss with JDK 1.6 and was getting the same issue while using Jboss's WS.

With your resolution it has solved.

Thanks

Unknown said...
This comment has been removed by the author.