我正在使用JBoss 4.2.3 / Tomcat 5.5.27和Java 1.5.0(15-b04)上的Axis2 1.4.1开发Web服务。它完美无缺,但是当发生异常时,我得到一个JBoss错误500 HTML页面而不是Axis2 XML / SOAP错误。
这种行为令人烦恼,因为在开发过程中很难处理Web服务客户端或SoapUI中的错误。
我可以更改此内容以获取SOAP错误吗?也许它只是一个Axis2或JBoss参数,但我没有找到任何线索。
编辑:这是新的堆栈跟踪:
[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)
编辑2:在给予赏金后,我发现我错误地认为1.2.9-SNAPSHOT版本的Axiom。我再次构建它,确保将jar正确复制到lib目录并且它工作正常!
最后,这是一个Axiom错误,如Vineet提供的链接中所述。
谢谢!
答案 0 :(得分:1)
如果没有异常的细节,我只能推测Web服务实现抛出的运行时异常不是SOAPFault或AxisFault类(或它们的子代)的实例。在这种情况下,JBoss中的默认行为是在响应中传递错误页面,因为Web服务毕竟是servlet。
这通常表明Web服务必须正确处理异常并抛出适当的SOAP错误,以防止异常漏掉调用堆栈。
<强>更新强>
堆栈跟踪有助于确定此问题的根本原因。但无论如何我都会在黑暗中拍摄:)
您可以参考问题RAMPART-164,看看是否是问题的真正原因。简而言之,根据可用信息,可以使用SOAP 1.2。我不确定该修复程序是否已传播到AXIOM 1.2.8,因为我没有看到任何对WSCOMMONS-343的引用。
答案 1 :(得分:0)
rampart-core jar文件中存在错误。 RampartSender中的MessageBuilder在将响应发送回客户端时期望消息上下文中的AxisService。在这种情况下,它为null,抛出NUllpointer异常。在RampartMessageData中添加一个空检查并重建wallart核心jar并使用它。应用程序应该可以正常工作。
AxisService service = msgCtx.getAxisService();
if (service != null) {
this.customClassLoader = msgCtx.getAxisService()
.getClassLoader();
}