Question

I'm developing a webservice with Axis2 1.4.1 on JBoss 4.2.3/Tomcat 5.5.27 and Java 1.5.0 (15-b04). It works flawlessly but when an exception happens I get a JBoss error 500 HTML page instead of an Axis2 XML/SOAP fault.

This behavoir is vexing, because it difficults to handle errors in the webservice client or in SoapUI while developing.

Can I change this to get the SOAP fault? Maybe it's just an Axis2 or JBoss parameter, but I didn't find any clue about.

EDIT: Here goes the new stacktrace:

[ERROR] WSDoAllReceiver: security processing failed
org.apache.axis2.AxisFault: WSDoAllReceiver: security processing failed
    at org.apache.rampart.handler.WSDoAllReceiver.processBasic(WSDoAllReceiver.java:214)
    at org.apache.rampart.handler.WSDoAllReceiver.processMessage(WSDoAllReceiver.java:86)
    at org.apache.rampart.handler.WSDoAllHandler.invoke(WSDoAllHandler.java:72)
    at org.apache.axis2.engine.Phase.invoke(Phase.java:317)
    at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:264)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:163)
    at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
    at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:133)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    at java.lang.Thread.run(Thread.java:595)
Caused by: org.apache.ws.security.WSSecurityException: The security token could not be authenticated or authorized
    at org.apache.ws.security.processor.UsernameTokenProcessor.handleUsernameToken(UsernameTokenProcessor.java:155)
    at org.apache.ws.security.processor.UsernameTokenProcessor.handleToken(UsernameTokenProcessor.java:53)
    at org.apache.ws.security.WSSecurityEngine.processSecurityHeader(WSSecurityEngine.java:311)
    at org.apache.ws.security.WSSecurityEngine.processSecurityHeader(WSSecurityEngine.java:228)
    at org.apache.rampart.handler.WSDoAllReceiver.processBasic(WSDoAllReceiver.java:211)
    ... 23 more
[ERROR] Servlet.service() para servlet AxisServlet lanzó excepción
java.lang.NullPointerException
    at org.apache.rampart.RampartMessageData.<init>(RampartMessageData.java:308)
    at org.apache.rampart.MessageBuilder.build(MessageBuilder.java:61)
    at org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:64)
    at org.apache.axis2.engine.Phase.invoke(Phase.java:317)
    at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:264)
    at org.apache.axis2.engine.AxisEngine.sendFault(AxisEngine.java:520)
    at org.apache.axis2.transport.http.AxisServlet.handleFault(AxisServlet.java:416)
    at org.apache.axis2.transport.http.AxisServlet.processAxisFault(AxisServlet.java:379)
    at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:167)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    at java.lang.Thread.run(Thread.java:595)

EDIT 2: After giving the bounty I found that I was wrong about 1.2.9-SNAPSHOT version of Axiom. I built it again, made sure the jars where correctly copied to lib directory and it worked!

Finally, it was an Axiom bug, as said in the links provided by Vineet.

Thanks!

Was it helpful?

Solution

Without details of the exception, I can only speculate that the web service implementation is throwing a runtime exception that is not an instance of the SOAPFault or AxisFault classes (or their children). The default behavior in JBoss, in a such a case, would be to deliver the error page in the response, since web services are servlets after all.

That usually indicates that the web service must handle the exceptions appropriately and throw an appropriate SOAP fault, to prevent the exception from trickling up the call stack.

Update

A stacktrace would help in establishing the root cause of this issue. But I'm going to shoot in the dark anyway :)

You can refer to the issue RAMPART-164 and see if that is the actual cause of the problem. To put it briefly, from the information available, one can use SOAP 1.2. I'm not sure about the fix having been propagated to AXIOM 1.2.8 though, since I did not see any reference to WSCOMMONS-343.

OTHER TIPS

There is a bug in rampart-core jar file. MessageBuilder in RampartSender is expecting AxisService in message context while sending the response back to the client. In this case it is null which throws a NUllpointer exception. Add a null check in the RampartMessageData and rebuild the rampart core jar and use it. The application should work fine.

AxisService service = msgCtx.getAxisService();
if (service != null) {
  this.customClassLoader = msgCtx.getAxisService()
    .getClassLoader();
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top