问题描述
1、系统在Windows下运行是正常的,接口的调用没有问题;2、现在要迁移到Linux环境,问题就来了,客户端一调用接口服务就会挂掉啊[15-01-0515:54:13.858]{ThreadLauncher2[ThreadPool[system]]-1}ThreadLauncher2[ThreadPool[system]]100threadscreatedin1000mssleep=10ms3、通过本地调用也会提示引发一样的错误publicstaticvoidmain(String[]args){TestServiceservice;Stringurl="http://172.20.1.132/remoting/testService";HessianProxyFactoryfactory=newHessianProxyFactory();try{factory.setDebug(true);factory.setReadTimeout(5000);factory.setOverloadEnabled(true);//不设置会报expectedhessianreplyat0x48factory.setHessian2Reply(true);factory.setHessian2Request(true);service=(TestService)factory.create(TestService.class,url);//此处一调用,就会出现一开始的错误提示service.test(null);}catch(Exceptione){System.out.println("Exception:"+e.getMessage());return;}}
接口定义:<beanname="/testService"class="org.springframework.remoting.caucho.HessianServiceExporter"><propertyname="service"ref="testService"/><propertyname="serviceInterface"value="com.ring.test.service.TestService"/></bean>
<beanid="testService"class="org.springframework.remoting.caucho.HessianProxyFactoryBean"><propertyname="serviceInterface"value="com.ring.test.service.TestService"/><propertyname="serviceUrl"value="http://172.20.1.132/remoting/testService"/></bean>
解决方案
本帖最后由 millett 于 2015-01-06 17:02:56 编辑
解决方案二:
1、Hessian和Spring换了多个版本进行尝试,一样的错误。2、因为100threadscreatedin1000mssleep=10ms,这时候只有./resin.shstop,然后就会看到错误日志,N次的请求访问{resin-port-80-107}<WARN>[20150106131606.796]org.springframework.remoting.support.RemoteInvocationTraceInterceptor.invoke(RemoteInvocationTraceInterceptor.java:87)ProcessingofHessianServiceExporterremotecallresultedinfatalexception:com.ring.cms.service.TestService.testorg.springframework.remoting.RemoteConnectFailureException:CannotconnecttoHessianremoteserviceat[http://loalhost/remoting/testService];nestedexceptioniscom.caucho.hessian.client.HessianConnectionException:500:java.net.ConnectException:Connectionrefusedatorg.springframework.remoting.caucho.HessianClientInterceptor.convertHessianAccessException(HessianClientInterceptor.java:262)atorg.springframework.remoting.caucho.HessianClientInterceptor.invoke(HessianClientInterceptor.java:231)atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)atorg.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)at$Proxy48.test(UnknownSource)atsun.reflect.GeneratedMethodAccessor62.invoke(UnknownSource)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)atjava.lang.reflect.Method.invoke(Method.java:597)atorg.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)atorg.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)atorg.springframework.remoting.support.RemoteInvocationTraceInterceptor.invoke(RemoteInvocationTraceInterceptor.java:77)atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)atorg.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)at$Proxy49.test(UnknownSource)atsun.reflect.GeneratedMethodAccessor62.invoke(UnknownSource)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)atjava.lang.reflect.Method.invoke(Method.java:597)atcom.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:302)atcom.caucho.hessian.server.HessianSkeleton.invoke(HessianSkeleton.java:217)atorg.springframework.remoting.caucho.HessianExporter.doInvoke(HessianExporter.java:198)atorg.springframework.remoting.caucho.HessianExporter.invoke(HessianExporter.java:118)atorg.springframework.remoting.caucho.HessianServiceExporter.handleRequest(HessianServiceExporter.java:66)atorg.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:49)atorg.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)atorg.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)atorg.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)atorg.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:159)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:97)atcom.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:109)atorg.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102)atcom.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)atcom.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)atcom.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)atcom.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:289)atcom.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:838)atcom.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:1346)atcom.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:1302)atcom.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:1286)atcom.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:1194)atcom.caucho.network.listen.TcpSocketLink.handleAcceptTaskImpl(TcpSocketLink.java:993)atcom.caucho.network.listen.ConnectionTask.runThread(ConnectionTask.java:117)atcom.caucho.network.listen.ConnectionTask.run(ConnectionTask.java:93)atcom.caucho.network.listen.SocketLinkThreadLauncher.handleTasks(SocketLinkThreadLauncher.java:169)atcom.caucho.network.listen.TcpSocketAcceptThread.run(TcpSocketAcceptThread.java:61)atcom.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173)atcom.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)Causedby:com.caucho.hessian.client.HessianConnectionException:500:java.net.ConnectException:Connectionrefusedatcom.caucho.hessian.client.HessianURLConnection.sendRequest(HessianURLConnection.java:145)atcom.caucho.hessian.client.HessianProxy.sendRequest(HessianProxy.java:296)atcom.caucho.hessian.client.HessianProxy.invoke(HessianProxy.java:171)at$Proxy47.test(UnknownSource)atsun.reflect.GeneratedMethodAccessor62.invoke(UnknownSource)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)atjava.lang.reflect.Method.invoke(Method.java:597)atorg.springframework.remoting.caucho.HessianClientInterceptor.invoke(HessianClientInterceptor.java:222)...46moreCausedby:java.net.ConnectException:Connectionrefusedatsun.reflect.GeneratedConstructorAccessor38.newInstance(UnknownSource)atsun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)atjava.lang.reflect.Constructor.newInstance(Constructor.java:513)atsun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1345)atsun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1339)atsun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:993)atcom.caucho.hessian.client.HessianURLConnection.sendRequest(HessianURLConnection.java:125)...53moreCausedby:java.net.ConnectException:Connectionrefusedatjava.net.PlainSocketImpl.socketConnect(NativeMethod)atjava.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)atjava.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)atjava.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)atjava.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)atjava.net.Socket.connect(Socket.java:519)atjava.net.Socket.connect(Socket.java:469)atsun.net.NetworkClient.doConnect(NetworkClient.java:163)atsun.net.www.http.HttpClient.openServer(HttpClient.java:394)atsun.net.www.http.HttpClient.openServer(HttpClient.java:529)atsun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:760)atsun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)atsun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1049)atjava.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)atcom.caucho.hessian.client.HessianURLConnection.sendRequest(HessianURLConnection.java:112)...53more