问题描述
我用xfire+myEclipse生成的webservice客户端类,然后写一个java类调用webservice接口方法,把这个java类用dwr的方式给前台jsp调用,调用成功,但是一段时间(大概几分钟)不操作,即不发起请求,再发起请求时会有xfire的一个异常(异常如下),连接断开或者说超时,想问这是什么原因,要如何解决,xfire调用webservice接口时有方法设定连接时长么我的调用方式ServiceClientsc=newServiceClient();ServiceSoapss=sc.getServiceSoap();Stringresult=ss.testweb("aaa");//这里就是直接调用xfire生成的webservice接口方法2009-06-0219:51:30,531ERROR[org.codehaus.xfire.transport.http.HttpChannel]-java.net.SocketException:Connectionresetorg.codehaus.xfire.XFireRuntimeException:Couldnotinvokeservice..Nestedexceptionisorg.codehaus.xfire.fault.XFireFault:Couldn'tsendmessage.org.codehaus.xfire.fault.XFireFault:Couldn'tsendmessage.atorg.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)atorg.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:30)atorg.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)atorg.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)atorg.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)atorg.codehaus.xfire.client.Client.invoke(Client.java:336)atorg.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)atorg.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)at$Proxy8.getPoliceArea(UnknownSource)atcom.founder.app.gather.logic.impl.MpCjWebServiceImpl.getPoliceArea(MpCjWebServiceImpl.java:114)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(UnknownSource)atsun.reflect.DelegatingMethodAccessorImpl.invoke(UnknownSource)atjava.lang.reflect.Method.invoke(UnknownSource)atorg.directwebremoting.impl.ExecuteAjaxFilter.doFilter(ExecuteAjaxFilter.java:34)atorg.directwebremoting.impl.DefaultRemoter$1.doFilter(DefaultRemoter.java:428)atorg.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:431)atorg.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:283)atorg.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:52)atorg.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)atorg.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:146)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:709)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:802)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)atcom.founder.manage.admin.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:30)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)atorg.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)atorg.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)atorg.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)atorg.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)atorg.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)atorg.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)atorg.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)atorg.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)atorg.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)atorg.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)atorg.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)atjava.lang.Thread.run(UnknownSource)Causedby:org.codehaus.xfire.XFireException:Couldn'tsendmessage.atorg.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:145)atorg.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)atorg.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)...38moreCausedby:java.net.SocketException:Connectionresetatjava.net.SocketInputStream.read(UnknownSource)atjava.io.BufferedInputStream.fill(UnknownSource)atjava.io.BufferedInputStream.read(UnknownSource)atorg.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77)atorg.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105)atorg.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1115)atorg.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1373)atorg.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832)atorg.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)atorg.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)atorg.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)atorg.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)atorg.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)atorg.codehaus.xfire.transport.http.CommonsHttpMessageSender.send(CommonsHttpMessageSender.java:369)atorg.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:123)...40more
解决方案
解决方案二:
有这么麻烦吗?我用的xfire+spring.配好wsdl的url之后,直接MyInterfacemyIntf=(MyInterface)applicationContext.getBean("serviceBean名字");然后myIntf就可以像本地bean一样调用了。
解决方案三:
java.net.SocketException:Connectionreset你需要设置自动重连机制
解决方案四:
该回复于2009-06-22 18:52:56被版主删除