日期:2014-05-17  浏览次数:20726 次

用Xfire开发webservice异常:illegalStateException:can't overwrite cause
各位,大家好!
我用Xfire开发的WebService起初运行都是正常的,但是运行一段时间的时候就抛出如下异常:
2011-10-21 12:41:53 org.apache.catalina.startup.Catalina start
信息: Server startup in 46125 ms
2011-10-21 15:27:18 org.codehaus.xfire.service.binding.PostInvocationHandler invoke
严重: java.lang.IllegalStateException: Can't overwrite cause
2011-10-21 15:27:18 org.codehaus.xfire.handler.DefaultFaultHandler invoke
严重: Fault occurred!
java.lang.IllegalStateException: Can't overwrite cause
at java.lang.Throwable.initCause(Throwable.java:320)
at com.ctc.wstx.compat.Jdk14Impl.setInitCause(Jdk14Impl.java:70)
at com.ctc.wstx.exc.WstxException.<init>(WstxException.java:46)
at com.ctc.wstx.exc.WstxIOException.<init>(WstxIOException.java:16)
at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:313)
at org.codehaus.xfire.soap.SoapSerializer.writeMessage(SoapSerializer.java:88)
at org.codehaus.xfire.transport.http.HttpChannel.writeWithoutAttachments(HttpChannel.java:56)
at org.codehaus.xfire.transport.http.XFireServletChannel.sendViaServlet(XFireServletChannel.java:87)
at org.codehaus.xfire.transport.http.XFireServletChannel.send(XFireServletChannel.java:44)
at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.service.binding.PostInvocationHandler.invoke(PostInvocationHandler.java:36)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.transport.DefaultEndpoint.onReceive(DefaultEndpoint.java:64)
at org.codehaus.xfire.transport.AbstractChannel.receive(AbstractChannel.java:38)
at org.codehaus.xfire.transport.http.XFireServletController.invoke(XFireServletController.java:304)
at org.codehaus.xfire.transport.http.XFireServletController.doService(XFireServletController.java:129)
at org.codehaus.xfire.transport.http.XFireServlet.doPost(XFireServlet.java:116)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
2011-10-21 15:27:18 org.codehaus.xfire.handler.DefaultFaultHandler sendFault

然后服务不再可用。
各位大侠,请问一下有什么好的解决办法?

------解决方案--------------------
可以给加上同步锁,或者让当前线程睡5秒!