Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Raising an Exception from a JAXB Web Service  RSS feed

 
Ally Cavs
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

Can anyone point me to a tutorial that shows exactly how to raise and exception from a web service and for the client to catch it.

Long story short I do think my web service is throwing the exception. SOAP UI is interpreting the exception. My WSDL and underlying operations are designed to have an input, output and fault.

But I have a client app that when a web service raises and exception (and this exception is raised legitimately on the server side) that I get the following stack trace below.

I am using JDK version jdk1.6.0_19 client side. My client project is a POM. I commented out all JAXB dependencies in my POM because I read that this version has JAXB built in so the error could be a class path problem. This made no difference. There is a chance JDK on server side may be different but would this make a difference?

My pom did have the following which is what the server side project pom has aswell:

Please help me I really dont know what to do.


Thanks
Alan


 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
My guess is that it is indeed a classpath problem: The JAXB library on your client's classpath is too old.
Take a look at this: https://jax-ws.dev.java.net/guide/Using_JAX_WS_2_1_with_JavaSE6.html
Best wishes!
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It appears that the exception is being generated on the client side so your request never got to the server.

Just one of the confusing possibilities of SOAP errors.

Bill
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
William Brogden wrote:Just one of the confusing possibilities of SOAP errors.

Please...
This looks like a classpath problem related to JAXB. JAXB is not necessarily connected to SOAP, in fact it is also possible to use in (please hold on to something before reading the next words) RESTful web services.
The error occurs when SOAPBuilderFactory is performing static initialization (calling JAXBContext.newInstance):

Best wishes!
 
Ally Cavs
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

thanks for your help. it certainly is a classpath problem. I added the following code to the project:


And after looking at what was on the class path i was able to work out that one of my dependencies was adding in the JAXB jars again
So i left the original dependencies commented out as above and added the following exclusions into my pom under the offending dependency:




If the exlusions were commented out or

was commented back in, the problem came back. So it is indeed is a classpath issue.
I now the excepetion I was expecting to get from the web service and can handle accordingly. And hold onto to something as I say this. I dont need to use restful webservices
Hope this is a help to someone as this has been a bit of an issue for me for a while now.


Cheers Guys
Alan

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!