java.net.SocketException: socket closed

返回的httpresponse 内容如下
HTTP/1.1 200 OK [Server: zhihu_nginx, Date: Sun, 29 Sep 2013 02:08:35 GMT, Content-Type: application/json, Transfer-Encoding: chunked, Connection: keep-alive, Vary: Accept-Encoding, Expires: Fri, 02 Jan 2000 00:00:00 GMT, Pragma: no-cache, Cache-Control: private, no-store, max-age=0,no-cache, must-revalidate, post-check=0, pre-check=0]

报错如下:
Exception in thread "main" java.net.SocketException: socket closed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:136)
at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:152)
at org.apache.http.impl.io.SessionInputBufferImpl.read(SessionInputBufferImpl.java:203)
at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:174)
at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:137)
at java.util.zip.InflaterInputStream.fill(Unknown Source)
at java.util.zip.InflaterInputStream.read(Unknown Source)
at java.util.zip.GZIPInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
at sun.nio.cs.StreamDecoder.read(Unknown Source)
at java.io.InputStreamReader.read(Unknown Source)
at java.io.Reader.read(Unknown Source)
at org.apache.http.util.EntityUtils.toString(EntityUtils.java:244)
at org.apache.http.util.EntityUtils.toString(EntityUtils.java:288)
at zhihu.ZhihuDownload.getAnswersList(ZhihuDownload.java:138)
at zhihu.ZhihuDownload.main(ZhihuDownload.java:54)

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
使用HttpClient时遇到的 java.net.SocketException: Socket closed异常
public static Object[] callService(String wsUrl, String method, Object... arg) { logger.info("---enter callService---"); DynamicClientFactory dcf = DynamicClientFactory.newInstance(); Client client = dcf.createClient(wsUrl); HTTPConduit conduit = (HTTPConduit) client.getConduit(); HTTPClientPolicy policy = new HTTPClientPolicy(); long timeout = 10 * 60 * 1000;// policy.setConnectionTimeout(timeout); policy.setReceiveTimeout(timeout); conduit.setClient(policy); Object[] res = null; try { res = client.invoke(method, arg); } catch (Exception e) { e.printStackTrace(); logger.error("send msg failed" + e.getMessage()); } return res ; } [2018-12-20 17:37:16,021]-INFO (SoapClient.java:36)|---enter callService--- [2018-12-20 17:37:18,042]-INFO (JAXBUtils.java:719)|Created classes: com.yggdrasill.work.flow.common.web.ObjectFactory, com.yggdrasill.work.flow.common.web.ReqMainAccount, com.yggdrasill.work.flow.common.web.ReqMainAccountResponse [2018-12-20 17:37:19,893]-WARN (LogUtils.java:371)|Interceptor for {http://web.common.flow.work.yggdrasill.com}PartenerInfoImpService#{http://web.common.flow.work.yggdrasill.com}reqMainAccount has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: Could not send Message. at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:519) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:449) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:352) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:304) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:310) at com.boco.mis.cxf.CXFServices.SoapClient.callService(SoapClient.java:41) at com.boco.mis.account.action.AccountAction.goSmp(AccountAction.java:135) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254) at com.boco.mss.plat.interceptor.ErrorInterceptor.intercept(ErrorInterceptor.java:25) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.boco.common.base.interceptor.LoginInterceptor.doFilter(LoginInterceptor.java:112) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 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:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:615) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:662) Caused by: java.net.SocketException: SocketException invoking http://10.131.120.99:8088/workflow/ws/PartnerService: Socket Closed at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1422) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1407) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:640) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) ... 84 more Caused by: java.net.SocketException: Socket Closed at java.net.PlainSocketImpl.getOption(PlainSocketImpl.java:286) at java.net.Socket.getSoTimeout(Socket.java:1032) at sun.net.www.http.HttpClient.available(HttpClient.java:356) at sun.net.www.http.HttpClient.New(HttpClient.java:273) at sun.net.www.http.HttpClient.New(HttpClient.java:310) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:987) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:923) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:841) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1031) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1359) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1301) at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:42) at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1379) ... 87 more org.apache.cxf.interceptor.Fault: Could not send Message. at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263) at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:519) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:449) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:352) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:304) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:310) at com.boco.mis.cxf.CXFServices.SoapClient.callService(SoapClient.java:41) at com.boco.mis.account.action.AccountAction.goSmp(AccountAction.java:135) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254) at com.boco.mss.plat.interceptor.ErrorInterceptor.intercept(ErrorInterceptor.java:25) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.boco.common.base.interceptor.LoginInterceptor.doFilter(LoginInterceptor.java:112) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) 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:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:615) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:662) Caused by: java.net.SocketException: SocketException invoking http://10.131.120.99:8088/workflow/ws/PartnerService: Socket Closed at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1422) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1407) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:640) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) ... 84 more Caused by: java.net.SocketException: Socket Closed at java.net.PlainSocketImpl.getOption(PlainSocketImpl.java:286) at java.net.Socket.getSoTimeout(Socket.java:1032) at sun.net.www.http.HttpClient.available(HttpClient.java:356) at sun.net.www.http.HttpClient.New(HttpClient.java:273) at sun.net.www.http.HttpClient.New(HttpClient.java:310) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:987) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:923) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:841) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1031) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1359) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1301) at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:42) at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1379) ... 87 more [2018-12-20 17:37:19,900]-ERROR (SoapClient.java:44)|send msg failedCould not send Message.
osx eclipse 启动tomcat时报错:严重: Socket accept failed java.net.SocketException: Socket closed
如题,使用mac版eclipse启动 已经关闭ipv6,eclipse连接Oracle可以连通。 控制台信息如下: Init datasource error [design] can not get connection,please check the DBSet 三月 20, 2019 3:53:23 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-bio-127.0.0.1-8099"] 三月 20, 2019 3:53:24 下午 org.apache.catalina.core.StandardService startInternal 信息: Starting service bright 三月 20, 2019 3:53:24 下午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: UAP Server 三月 20, 2019 3:53:25 下午 org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment 信息: No global web.xml found ESA Server starting NTBService6.3 started.~~~~~~ ESA Server started: 51965 三月 20, 2019 3:54:37 下午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["http-bio-127.0.0.1-8099"] 三月 20, 2019 3:54:38 下午 org.apache.tomcat.util.net.JIoEndpoint$Acceptor run 严重: Socket accept failed java.net.SocketException: Socket closed at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398) at java.net.ServerSocket.implAccept(ServerSocket.java:530) at java.net.ServerSocket.accept(ServerSocket.java:498) at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:60) at org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:216) at java.lang.Thread.run(Thread.java:745) 三月 20, 2019 3:54:38 下午 org.apache.tomcat.granite.BrightTomcat start 信息: Server startup in 76169 ms 三月 20, 2019 3:54:38 下午 org.apache.coyote.AbstractProtocol pause 信息: Pausing ProtocolHandler ["http-bio-127.0.0.1-8099"] 三月 20, 2019 3:54:38 下午 org.apache.tomcat.util.net.JIoEndpoint$Acceptor run 严重: Socket accept failed java.net.SocketException: Socket closed at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398) at java.net.ServerSocket.implAccept(ServerSocket.java:530) at java.net.ServerSocket.accept(ServerSocket.java:498) at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:60) at org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:216) at java.lang.Thread.run(Thread.java:745) 三月 20, 2019 3:54:38 下午 org.apache.catalina.core.StandardService stopInternal 信息: Stopping service bright ESA Server stopping ESA Server stopped 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [check-offline-msg-valid] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-6] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-7] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-8] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-10] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-9] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-11] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-12] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-13] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-15] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-16] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-17] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-18] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Timer-1] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-20] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-21] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-22] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-23] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-24] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-25] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-26] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-27] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-28] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-29] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-30] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-31] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-32] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-33] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-34] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-35] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-36] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-37] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-38] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-39] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-40] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [transport-check-msg-repeat-thread] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [antesearch-1-thread] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [antesearch-2-thread] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [antesearch-3-thread] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [antesearch-4-thread] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [antesearch-5-thread] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-42] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-44] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-45] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-46] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-47] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-48] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-49] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-50] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 严重: The web application [/] appears to have started a thread named [Thread-51] but has failed to stop it. This is very likely to create a memory leak. 三月 20, 2019 3:54:39 下午 org.apache.coyote.AbstractProtocol stop 信息: Stopping ProtocolHandler ["http-bio-127.0.0.1-8099"] 三月 20, 2019 3:54:39 下午 org.apache.coyote.AbstractProtocol destroy 信息: Destroying ProtocolHandler ["http-bio-127.0.0.1-8099"]
TOMCAT 集群 socket closed 错误
我在用APACHE配置TOMCAT 集群出现下面这个错误。 WARNING: Error receiving mcast package. Sleeping 500ms java.net.SocketException: socket closed at java.net.PlainDatagramSocketImpl.receive0(Native Method) at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:136) at java.net.DatagramSocket.receive(DatagramSocket.java:712) at org.apache.catalina.tribes.membership.McastServiceImpl.receive(McastServiceImpl.java:314) at org.apache.catalina.tribes.membership.McastServiceImpl$ReceiverThread.run(McastServiceImpl.java:414) 请问这个怎么解决
请问这个是什么错误啊,求大家什么帮忙看看
java.net.SocketException: Software caused connection abort: socket write error at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(Unknown Source) at java.net.SocketOutputStream.write(Unknown Source) at java.io.ObjectOutputStream$BlockDataOutputStream.drain(Unknown Source) at java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(Unknown Source) at java.io.ObjectOutputStream.writeNonProxyDesc(Unknown Source) at java.io.ObjectOutputStream.writeClassDesc(Unknown Source) at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) at java.io.ObjectOutputStream.writeObject0(Unknown Source) at java.io.ObjectOutputStream.writeFatalException(Unknown Source) at java.io.ObjectOutputStream.writeObject(Unknown Source) at client.ClientDemo.main(ClientDemo.java:92) Exception in thread "main" java.net.SocketException: Socket closed at java.net.SocketOutputStream.socketWrite(Unknown Source) at java.net.SocketOutputStream.write(Unknown Source) at java.io.ObjectOutputStream$BlockDataOutputStream.drain(Unknown Source) at java.io.ObjectOutputStream$BlockDataOutputStream.flush(Unknown Source) at java.io.ObjectOutputStream.flush(Unknown Source) at java.io.ObjectOutputStream.close(Unknown Source) at client.ClientDemo.main(ClientDemo.java:334)
传送数据至后端时发生 I/O错误
导出150万的数据,用sql分页导出,每页数据1000条,数据库用postgresql 问题: 不停的分页取出数据之后,在某一段时间内,出现了传送数据至后端时发生 I/O 错误错误 发现错误信息如下: Caused by: java.net.SocketException: Socket closed at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) at java.net.SocketInputStream.read(SocketInputStream.java:170) at java.net.SocketInputStream.read(SocketInputStream.java:141) at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:145) at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:114) at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStream.java:73) at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:274) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1660) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) ... 95 more socke没有取字节流完成前,直接关闭了,这个具体是什么原因? ![图片说明](https://img-ask.csdn.net/upload/201711/04/1509781853_102125.png)
关于java的socket通信问题
我的项目在自己的电脑上时,可以正常建立连接,接收客户端的消息和主动下发消息到客户端,但是程序部署到服务器后,只能接收客户端发来的消息,而且查看tomcat日志时如下: 2016-07-29 15:18:21 Commons Daemon procrun stdout initialized log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. socket start log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. SocketThread创建socket服务出错 java.net.SocketException: socket closed at java.net.DualStackPlainSocketImpl.accept0(Native Method) at java.net.DualStackPlainSocketImpl.socketAccept(Unknown Source) at java.net.AbstractPlainSocketImpl.accept(Unknown Source) at java.net.PlainSocketImpl.accept(Unknown Source) at java.net.ServerSocket.implAccept(Unknown Source) at java.net.ServerSocket.accept(Unknown Source) at com.deposit.websocket.SocketThread.run(SocketThread.java:39) log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository. log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository. log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.
jmeter测试接口报错如下,但是服务器是正常的。请问是什么问题?
java.net.SocketException: Socket closed at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:158) at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:82) at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:271) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138) at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56) at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259) at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:281) at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:257) at org.apache.jmeter.protocol.http.sampler.hc.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:199) at org.apache.jmeter.protocol.http.sampler.MeasuringConnectionManager$MeasuredConnection.receiveResponseHeader(MeasuringConnectionManager.java:212) at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273) at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125) at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:684) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:486) at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:835) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:654) at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:413) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1189) at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1178) at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:491) at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:425) at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:254) at java.lang.Thread.run(Unknown Source)
java ssh项目数据库关闭
项目运行时,一段时间后报这个错误 net.sourceforge.jtds.jdbc.JtdsPreparedStatement.close(JtdsPreparedStatement.java:485) at org.apache.commons.dbcp.DelegatingStatement.close(DelegatingStatement.java:168) at org.apache.commons.dbcp.DelegatingConnection.passivate(DelegatingConnection.java:426) at org.apache.commons.dbcp.DelegatingConnection.close(DelegatingConnection.java:246) at org.apache.commons.dbcp.PoolableConnection.reallyClose(PoolableConnection.java:122) at org.apache.commons.dbcp.PoolableConnectionFactory.destroyObject(PoolableConnectionFactory.java:628) at org.apache.commons.pool.impl.GenericObjectPool.invalidateObject(GenericObjectPool.java:1290) at org.apache.commons.dbcp.AbandonedObjectPool.invalidateObject(AbandonedObjectPool.java:125) at org.apache.commons.dbcp.AbandonedObjectPool.removeAbandoned(AbandonedObjectPool.java:158) at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:77) at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:81) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:446) at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:167) at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1700) at org.hibernate.loader.Loader.doQuery(Loader.java:801) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274) at org.hibernate.loader.Loader.loadEntity(Loader.java:2037) at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:86) at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:76) at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3293) at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496) at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477) at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227) at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:285) at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152) at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1090) at org.hibernate.impl.SessionImpl.get(SessionImpl.java:1005) at org.hibernate.impl.SessionImpl.get(SessionImpl.java:998) at com.googlecode.genericdao.dao.hibernate.HibernateBaseDAO._get(HibernateBaseDAO.java:332) at com.googlecode.genericdao.dao.hibernate.GeneralDAOImpl.find(GeneralDAOImpl.java:39) at com.centerSoft.soms.service.impl.BaseManagerImpl.commLoad(BaseManagerImpl.java:310) at sun.reflect.GeneratedMethodAccessor261.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at com.sun.proxy.$Proxy40.commLoad(Unknown Source) at com.centerSoft.soms.action.DataDicAction.getAllDatadic(DataDicAction.java:92) at sun.reflect.GeneratedMethodAccessor2374.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:453) . . . Caused by: java.net.SocketException: socket closed at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:152) at java.net.SocketInputStream.read(SocketInputStream.java:122) at java.io.DataInputStream.readFully(DataInputStream.java:195) at java.io.DataInputStream.readFully(DataInputStream.java:169) at net.sourceforge.jtds.jdbc.SharedSocket.readPacket(SharedSocket.java:846) at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:727) at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:466) at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:135) at net.sourceforge.jtds.jdbc.ResponseStream.readString(ResponseStream.java:290) at net.sourceforge.jtds.jdbc.ResponseStream.readNonUnicodeString(ResponseStream.java:274) at net.sourceforge.jtds.jdbc.TdsData.readData(TdsData.java:936) at net.sourceforge.jtds.jdbc.TdsCore.tdsRowToken(TdsCore.java:3007) at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2270)
SpringBoot 集成RabbitMQ 启动时报Socket Close 错误
今天在做SpringBoot 集成RabbitMQ时,启动会报 ``` java.net.SocketException: Socket Closed at java.net.SocketInputStream.socketRead0(Native Method) ~[na:1.7.0_80] at java.net.SocketInputStream.read(SocketInputStream.java:152) ~[na:1.7.0_80] at java.net.SocketInputStream.read(SocketInputStream.java:122) ~[na:1.7.0_80] at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) ~[na:1.7.0_80] at java.io.BufferedInputStream.read(BufferedInputStream.java:254) ~[na:1.7.0_80] at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:288) ~[na:1.7.0_80] at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:91) ~[amqp-client-4.0.2.jar:4.0.2] at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:164) ~[amqp-client-4.0.2.jar:4.0.2] at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:571) ~[amqp-client-4.0.2.jar:4.0.2] at java.lang.Thread.run(Thread.java:745) [na:1.7.0_80] 2018-12-18 18:29:21.876 INFO 10896 --- [cTaskExecutor-2] o.s.a.r.c.CachingConnectionFactory : Created new connection: SimpleConnection@77d0bf3e [delegate=amqp://admin@192.168.220.128:5672/, localPort= 51285] 2018-12-18 18:29:22.953 INFO 10896 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) 2018-12-18 18:29:22.964 INFO 10896 --- [ main] com.gg.miaosha.MainApplication : Started MainApplication in 33.034 seconds (JVM running for 34.017) 2018-12-18 18:29:27.019 WARN 10896 --- [cTaskExecutor-1] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it org.springframework.amqp.AmqpTimeoutException: java.util.concurrent.TimeoutException at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:74) ~[spring-rabbit-1.7.1.RELEASE.jar:na] at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:370) ~[spring-rabbit-1.7.1.RELEASE.jar:na] at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:565) ~[spring-rabbit-1.7.1.RELEASE.jar:na] at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils$1.createConnection(ConnectionFactoryUtils.java:90) ~[spring-rabbit-1.7.1.RELEASE.jar:na] at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.doGetTransactionalResourceHolder(ConnectionFactoryUtils.java:140) ~[spring-rabbit-1.7.1.RELEASE.jar:na] at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.getTransactionalResourceHolder(ConnectionFactoryUtils.java:76) ~[spring-rabbit-1.7.1.RELEASE.jar:na] at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.start(BlockingQueueConsumer.java:505) ~[spring-rabbit-1.7.1.RELEASE.jar:na] at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1382) ~[spring-rabbit-1.7.1.RELEASE.jar:na] at java.lang.Thread.run(Thread.java:745) [na:1.7.0_80] Caused by: java.util.concurrent.TimeoutException: null at com.rabbitmq.utility.BlockingCell.get(BlockingCell.java:77) ~[amqp-client-4.0.2.jar:4.0.2] at com.rabbitmq.utility.BlockingCell.uninterruptibleGet(BlockingCell.java:120) ~[amqp-client-4.0.2.jar:4.0.2] at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36) ~[amqp-client-4.0.2.jar:4.0.2] at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:372) ~[amqp-client-4.0.2.jar:4.0.2] at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:297) ~[amqp-client-4.0.2.jar:4.0.2] at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:909) ~[amqp-client-4.0.2.jar:4.0.2] at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:859) ~[amqp-client-4.0.2.jar:4.0.2] at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:799) ~[amqp-client-4.0.2.jar:4.0.2] at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:351) ~[spring-rabbit-1.7.1.RELEASE.jar:na] ... 7 common frames omitted ``` 以下是我的配置文件 ``` spring.rabbitmq.addresses=192.168.220.128 spring.rabbitmq.username=admin spring.rabbitmq.password=admin spring.rabbitmq.publisher-confirms=true spring.rabbitmq.virtual-host=/ spring.rabbitmq.connection-timeout=60000 #\u6D88\u8D39\u8005\u6570\u91CF spring.rabbitmq.listener.simple.concurrency= 10 spring.rabbitmq.listener.simple.max-concurrency= 10 #\u6D88\u8D39\u8005\u6BCF\u6B21\u4ECE\u961F\u5217\u83B7\u53D6\u7684\u6D88\u606F\u6570\u91CF spring.rabbitmq.listener.simple.prefetch= 1 #\u6D88\u8D39\u8005\u81EA\u52A8\u542F\u52A8 spring.rabbitmq.listener.simple.auto-startup=true #\u6D88\u8D39\u5931\u8D25\uFF0C\u81EA\u52A8\u91CD\u65B0\u5165\u961F spring.rabbitmq.listener.simple.default-requeue-rejected= true #\u542F\u7528\u53D1\u9001\u91CD\u8BD5 spring.rabbitmq.template.retry.enabled=true spring.rabbitmq.template.retry.initial-interval=1000 spring.rabbitmq.template.retry.max-attempts=3 spring.rabbitmq.template.retry.max-interval=10000 spring.rabbitmq.template.retry.multiplier=1.0 ``` 但是程序能够 正常运行 RabbitMQ也能进行正常的信息收发, 但是这个错误看着有点受不了.请问有大神知道问题出在哪里吗??
跪求如何解决java中由getInputStream()方法带来的Socket is closed问题?
以下是报错的部分 ``` jbt1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ num=1; String ss=String.valueOf(num); OutputStream out = null; try { out = socket.getOutputStream(); } catch (IOException e1) { // TODO 自动生成的 catch 块 e1.printStackTrace(); } try { out.write(ss.getBytes()); } catch (IOException e1) { // TODO 自动生成的 catch 块 e1.printStackTrace(); } try { out.close(); } catch (IOException e1) { // TODO 自动生成的 catch 块 e1.printStackTrace(); } InputStream in=null; try { in = socket.getInputStream();//**【【【【这里被报错** byte[] bs=new byte[100];//每次接受100字节 int len=-1;//随意赋值 OutputStream fileOut=new FileOutputStream("src/Client/1.jpg"); while((len=in.read(bs))!=-1) { fileOut.write(bs,0,len); } //fileOut.close(); }catch(Exception e1) {e1.printStackTrace();} } }); ``` 报错信息: ``` java.net.SocketException: Socket is closed at java.base/java.net.Socket.getInputStream(Socket.java:905) at chris.Client$2.actionPerformed(Client.java:91)//【【应该是这里的问题 at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967) at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308) at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405) at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262) at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279) at java.desktop/java.awt.Component.processMouseEvent(Component.java:6632) at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342) at java.desktop/java.awt.Component.processEvent(Component.java:6397) at java.desktop/java.awt.Container.processEvent(Container.java:2263) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5008) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840) at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918) at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547) at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2762) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4840) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715) at java.base/java.security.AccessController.doPrivileged(AccessController.java:389) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743) at java.base/java.security.AccessController.doPrivileged(AccessController.java:389) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90) ```
socket编程发送消息出现socket closed求大神,急
import java.io.DataInputStream; import java.io.EOFException; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; public class Server { ServerSocket ss; Socket s ; Clients clients; DataInputStream dis; boolean startServer = false; public void startServer(){ try { ss = new ServerSocket(8888);//8888是TCP端口号 startServer = true; while(startServer){ s = ss.accept(); System.out.println(" connected!"); clients = new Clients(s); new Thread(clients).start(); } }catch(IOException e){ e.printStackTrace(); }finally{ try { ss.close(); } catch (IOException e) { e.printStackTrace(); } } } public static void main(String[] args) { new Server().startServer(); } } class Clients implements Runnable{//包装类,把外部连接的client包装 private Socket s; private boolean isConnected = false ; private DataInputStream dis; public Clients(Socket s) { this.s = s; try { isConnected = true; dis = new DataInputStream(s.getInputStream()); } catch (IOException e) { e.printStackTrace(); } } @Override public void run() { while(isConnected){ try { String str = dis.readUTF();//阻塞:它会一直等待 System.out.println(str); } catch (EOFException e){ System.out.println("Client is closed!"); }catch (IOException e1) { e1.printStackTrace(); }finally{ try { if(dis!=null) { dis.close(); }else{ ; } if(s!=null) { s.close(); }else{ ; } } catch (IOException e) { e.printStackTrace(); } } } } } import java.io.DataOutputStream; import java.io.IOException; import java.io.PrintWriter; import java.net.Socket; import java.net.UnknownHostException; import java.util.Scanner; public class Client { Socket s; PrintWriter pw; DataOutputStream dos; String line = ""; Scanner reader = new Scanner(System.in); public void startClient(){ try { s = new Socket("127.0.0.1", 8888); dos = new DataOutputStream(s.getOutputStream()); System.out.println("connected"); do{ System.out.print("please input:"); line = reader.next(); dos.writeUTF(line); dos.flush(); }while(!line.equals("bye")); dos.close(); s.close(); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public static void main(String[] args) { new Client().startClient(); } } java.net.SocketException: socket closed at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at java.io.DataInputStream.readUnsignedShort(Unknown Source) at java.io.DataInputStream.readUTF(Unknown Source) at java.io.DataInputStream.readUTF(Unknown Source) at Clients.run(Server.java:75) at java.lang.Thread.run(Unknown Source)
ora-01631 max # extents
一个抓取网页数据的接口,报如下的错误 [code="java"]java.sql.SQLException: ORA-01631: 表4096.ALTIS112达到 max # extents (RROC_ERRORLOG) ORA-06512: 在"ALTIS112.PROC_LR_SERV_BIMS_DATACONVERT", line 171 ORA-01631: 表4096.ALTIS112达到 max # extents (RROC_ERRORLOG) ORA-06512: 在line 1 java.sql.SQLException: ORA-01631: 表4096.ALTIS112达到 max # extents (RROC_ERRORL OG) ORA-06512: 在"ALTIS112.PROC_LR_SERV_BIMS_DATACONVERT", line 171 ORA-01631: 表4096.ALTIS112达到 max # extents (RROC_ERRORLOG) ORA-06512: 在line 1 java.net.SocketException: socket closed select useraccount,coreid from lr_serv_bims where uids is null or uids ='' order by bims_time desc java.lang.NullPointerException select upper(coreid),user_name from lr_serv WHERE bims_isfinish=0 AND coreid IS NOT NULL AND user_type=2 and create_time>sysdate-60 java.lang.NullPointerException 2009-10-22 09:28:20 2009-10-22 2009-10-22 9:30:01 org.apache.http.impl.client.DefaultClientRequestDirector exec ute 信息: I/O exception (org.apache.http.NoHttpResponseException) caught when proces sing request: The target server failed to respond 2009-10-22 9:30:01 org.apache.http.impl.client.DefaultClientRequestDirector exec ute 信息: Retrying request 2009-10-22 9:31:14 org.apache.http.impl.client.DefaultClientRequestDirector exec ute [/code] 哪位朋友帮看一下是哪个表的 max extents 达到了上限啊? ALTIS112 下没有RROC_ERRORLOG和PROC_LR_SERV_BIMS_DATACONVERT表 有LR_SERV_BIMS和LR_SERV表,我把LR_SERV_BIMS表的max extents 改大了 还是报此错误
websocket连接 中断 Broken pipe
Nov 27, 2017 11:21:50 PM org.apache.coyote.AbstractProcessor setErrorState INFO: An error occurred in processing while on a non-container thread. The connection will be closed immediately java.net.SocketException: Broken pipe at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109) at java.net.SocketOutputStream.write(SocketOutputStream.java:153) at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:215) at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:480) at org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:119) at org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:801) at org.apache.coyote.Response.action(Response.java:172) at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:363) at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:331) at org.apache.catalina.connector.Response.flushBuffer(Response.java:611) at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:306) at javax.servlet.ServletResponseWrapper.flushBuffer(ServletResponseWrapper.java:160) at org.springframework.boot.context.web.ErrorPageFilter$ErrorWrapperResponse.flushBuffer(ErrorPageFilter.java:317) at javax.servlet.ServletResponseWrapper.flushBuffer(ServletResponseWrapper.java:160) at javax.servlet.ServletResponseWrapper.flushBuffer(ServletResponseWrapper.java:160) at org.springframework.security.web.context.OnCommittedResponseWrapper.flushBuffer(OnCommittedResponseWrapper.java:143) at org.springframework.security.web.context.SaveContextOnUpdateOrErrorResponseWrapper.flushBuffer(SaveContextOnUpdateOrErrorResponseWrapper.java:40) at org.springframework.http.server.ServletServerHttpResponse.flush(ServletServerHttpResponse.java:91) at org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJsSession.writeFrameInternal(AbstractHttpSockJsSession.java:345) at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.writeFrame(AbstractSockJsSession.java:325) at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession.sendHeartbeat(AbstractSockJsSession.java:249) at org.springframework.web.socket.sockjs.transport.session.AbstractSockJsSession$1.run(AbstractSockJsSession.java:269) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
请求:java写的客户端发送数据失败!!
连接时,给服务端发送数据时总是报错!! 11-28 11:15:36.164: D/MainActivity(4212): wifiname:"LcyAP_03001" prxFlag:true substr: LcyAP FirstConn:true 11-28 11:15:36.164: D/MainActivity(4212): Now Ready to create connect to LC:Now wifi stat is:SSID:"LcyAP_03001"wificonnsetat:trueSrvIp:192.168.173.1 11-28 11:15:36.164: W/System.err(4212): java.net.SocketException: Socket is closed 11-28 11:15:36.174: W/System.err(4212): at java.net.Socket.checkOpenAndCreate(Socket.java:675) 11-28 11:15:36.174: W/System.err(4212): at java.net.Socket.getOutputStream(Socket.java:415) 11-28 11:15:36.174: W/System.err(4212): at cn.LCSys.socket.TCPClient.sendMsg(TCPClient.java:104) 11-28 11:15:36.174: W/System.err(4212): at cn.LCSys.MainActivity$4.run(MainActivity.java:410) 11-28 11:15:36.174: W/System.err(4212): at java.lang.Thread.run(Thread.java:841) 11-28 11:15:38.194: D/MainActivity(4212): wifiname:"LcyAP_03001" prxFlag:true substr: LcyAP FirstConn:true 11-28 11:15:38.194: D/MainActivity(4212): Now Ready to create connect to LC:Now wifi stat is:SSID:"LcyAP_03001"wificonnsetat:trueSrvIp:192.168.173.1 11-28 11:15:38.194: W/System.err(4212): java.net.SocketException: Socket is closed 11-28 11:15:38.194: W/System.err(4212): at java.net.Socket.checkOpenAndCreate(Socket.java:675) 11-28 11:15:38.194: W/System.err(4212): at java.net.Socket.getOutputStream(Socket.java:415) 11-28 11:15:38.194: W/System.err(4212): at cn.LCSys.socket.TCPClient.sendMsg(TCPClient.java:104) 11-28 11:15:38.194: W/System.err(4212): at cn.LCSys.MainActivity$4.run(MainActivity.java:410) 11-28 11:15:38.204: W/System.err(4212): at java.lang.Thread.run(Thread.java:841) 客户端代码为: package cn.LCSys.socket; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Reader; import java.net.Socket; import java.net.UnknownHostException; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import cn.LCSys.MainActivity; import cn.LCSys.fragment.SystemSetting; import android.content.Intent; import android.os.SystemClock; import android.util.Log; public class TCPClient { private String TAG = "TCP Client"; private static TCPClient s_Tcp = null; // 要连接的服务器Ip地址 private String SrvIp; // 要连接的远程服务器在监听的端口 private int SrvPort; public boolean isInitialized = false; private boolean bConnect; Socket socket = null ; private long LastTickCount; public static synchronized TCPClient instance() { if (s_Tcp == null) { { s_Tcp = new TCPClient(Const.SOCKET_SERVER, Const.SOCKET_PORT); } } return s_Tcp; } public TCPClient(String HostIp, int HostListenningPort) { LastTickCount = 0; Log.d(TAG,"SrvIP:["+HostIp+"]SrvPort:["+HostListenningPort+"]."); this.SrvIp = HostIp; this.SrvPort = HostListenningPort; bConnect = false; try { start(); } catch (Exception e) { this.isInitialized = false; Log.d(TAG," TCPClient Initialize catch err!"+e.getMessage()); e.printStackTrace(); } } public static final Object locked = new Object(); public static final BlockingQueue<String> queue = new ArrayBlockingQueue<String>( 1024 * 100); //通过数据接收判断是否链路正常 10秒没有数据认为链路异常,进行重新连接 class EchoThread extends Thread{ private Socket socket; @Override public void run() { while(isInitialized){ try { if(LastTickCount > 0) { //10 if((System.currentTimeMillis() - LastTickCount) > Const.SOCKET_TIMOUT) { bConnect = false; LastTickCount = 0; } } SystemClock.sleep(500); } catch (Exception e) { e.printStackTrace(); } } } } //发送数据 public boolean sendMsg(String sendMsg) throws InterruptedException{ try { PrintWriter pw = new PrintWriter(new OutputStreamWriter(socket.getOutputStream())); pw.write(sendMsg); pw.flush(); return true; } catch (Exception e) { bConnect = false; e.printStackTrace(); return false; } } //} // 接收数据的线程 class ReceiveThread extends Thread { private Socket socket; public ReceiveThread(Socket socket) { this.socket = socket; } @Override public void run() { String receivedString; CharBuffer charBuffer = CharBuffer.allocate(4096); while(isInitialized){ try { Reader reader = new InputStreamReader(socket.getInputStream()); charBuffer.clear(); int index = -1; while((index=reader.read(charBuffer))!=-1) { LastTickCount = System.currentTimeMillis(); charBuffer.flip(); //System.out.println("client:"+charBuffer.toString()); Charset cs = Charset.forName("UTF-8"); receivedString = cs.encode(charBuffer).toString() ; int readlen = receivedString.length(); if( readlen > 100) { //无法获取到数据 /*receivedString = Charset.forName("US-ASCII") .newDecoder().decode(buffer).toString();*/ // mylcHandle.ColldataHandle(receivedString); Log.d(TAG,"Read Data Length: "+readlen); } else { Log.d(TAG, "Recv len:"+readlen+" Content:"+receivedString); } Intent i = new Intent(Const.BC);//广播消息,实现类之间的交互 i.putExtra("response", receivedString); MainActivity.s_context.sendBroadcast(i); //给系统配置广播数据 if(null!= SystemSetting.s_context) { Log.d(TAG, "Broad to SystemSetting:"+readlen); SystemSetting.s_context.sendBroadcast(i); } //给实时数据fragement广播数据 /* if(null!= FragmentRealData.s_context) { Intent ii = new Intent(Const.DATABC); ii.putExtra("response", receivedString); Log.d(TAG, "Broad to FragmentRealData:"+readlen); FragmentRealData.s_context.sendBroadcast(ii); }*/ charBuffer.clear(); } } catch (Exception e) { e.printStackTrace(); } } } } public void start() throws UnknownHostException, IOException{ socket = new Socket(SrvIp,SrvPort); if(socket != null) { bConnect = true; isInitialized = true; new ReceiveThread(socket).start(); } else { bConnect = false; } } boolean isConnect() { return bConnect; } public void closeTCPSocket() { try{ if(socket!= null) { socket.close(); isInitialized = false; } } catch(Exception ex) { Log.e(TAG,"Close Socket error!"); } } // public static void main(String[] args) throws UnknownHostException, IOException { // new TCPClient().start(); // } }
mysql连接8小时后异常
26-Aug-2015 08:27:41.925 SEVERE [http-apr-8099-exec-12] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [SpringWebController] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.] with root cause java.net.SocketException: Software caused connection abort: socket write error at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113) at java.net.SocketOutputStream.write(SocketOutputStream.java:159) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140) at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3852) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2484) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2664) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2809) at com.mysql.jdbc.ConnectionImpl.setReadOnlyInternal(ConnectionImpl.java:5484) at com.mysql.jdbc.ConnectionImpl.setReadOnly(ConnectionImpl.java:5477) at sun.reflect.GeneratedMethodAccessor145.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:126) at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109) at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:80) at com.sun.proxy.$Proxy56.setReadOnly(Unknown Source) at org.springframework.jdbc.datasource.DataSourceUtils.prepareConnectionForTransaction(DataSourceUtils.java:155) at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:214) at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373) at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:457) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:276) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653) at com.a30.endnote.systemic.service.ParametersService$$EnhancerBySpringCGLIB$$a0be71ae.findParameterlist(<generated>) at com.a30.endnote.systemic.controller.IndexController.handleRequestInternal(IndexController.java:83) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:777) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:706) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857) at javax.servlet.http.HttpServlet.service(HttpServlet.java:618) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1086) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:659) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:285) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2439) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2428) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) 数据库链接配置如下: <bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource"> <property name="driverClassName" value="${jdbc.driverClassName}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> <property name="maxActive" value="200" /> <property name="initialSize" value="10" /> <!-- 配置获取连接等待超时的时间 --> <property name="maxWait" value="60000" /> <property name="minIdle" value="1" /> <property name="removeAbandonedTimeout" value="360"/> <!--自我中断时间秒 --> <property name="minEvictableIdleTimeMillis" value="60000"/> <!--连接的超时时间,默认为半小时。--> <property name="timeBetweenEvictionRunsMillis" value="30000"/> <!-- #运行判断连接超时任务的时间间隔,单位为毫秒,默认为-1,即不执行任务。 --> <property name="validationInterval" value="60000"/> <!--检查连接死活的时间间隔(单位:毫妙) 0以下的话不检查。默认是0。 --> <property name="validationQuery" value="select 1"/> <!--一条sql语句,用来验证数据库连接是否正常。这条语句必须是一个查询模式,并至少返回一条数据。可以为任何可以验证数据库连接是否正常的sql--> </bean> 程序第二天总会报这样的错..重启tomcat就OK了..求大神指点..
关于java聊天室,求助
问题: 服务器端退出,线程却还在运行 报错: java.net.SocketException: Socket closed at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:152) at java.net.SocketInputStream.read(SocketInputStream.java:122) at java.net.SocketInputStream.read(SocketInputStream.java:210) at java.io.DataInputStream.readUnsignedShort(DataInputStream.java:337) at java.io.DataInputStream.readUTF(DataInputStream.java:589) at java.io.DataInputStream.readUTF(DataInputStream.java:564) at talkingRoom.Servicer$1.run(Servicer.java:127) *********客户端************************ import java.awt.*; import java.net.*; import java.awt.event.*; import java.io.*; import javax.swing.*; @SuppressWarnings("serial") public class Desktop extends JFrame implements ActionListener { @SuppressWarnings("unused") private class WindowCloser extends WindowAdapter { public void windowClosing(WindowEvent we) { System.exit(0); } } private Socket cs = null; private JPanel p = new JPanel(); private JTextArea output = new JTextArea(); private JTextField input = new JTextField(); private DataOutputStream dos; private DataInputStream dis; private JButton b1 = new JButton("进入"); private JButton b2 = new JButton("退出"); private JLabel fuwuqis = new JLabel("服务器:"); private JTextField fuwuqi = new JTextField("127.0.0.1"); private JLabel duankous = new JLabel("端口:"); private JTextField duankou = new JTextField("8888"); private JLabel nichengs = new JLabel("昵称:"); private JTextField nicheng = new JTextField("游客1"); private JButton b3 = new JButton("发送"); private String talking; private boolean started = false; private boolean bConnected = false; //UI界面(不需要再修改) Desktop() { p.setLayout(new BorderLayout()); JPanel p1 = new JPanel(); JPanel p2 = new JPanel(); p1.add(b1); b1.addActionListener(this); p1.add(b2); b2.addActionListener(this); p1.add(fuwuqis); p1.add(fuwuqi); p1.add(duankous); p1.add(duankou); p1.add(nichengs); p1.add(nicheng); p2.setLayout(new BorderLayout()); p2.add(input, BorderLayout.CENTER); p2.add(b3, BorderLayout.EAST); b3.addActionListener(this); p.add(p1, BorderLayout.NORTH); p.add(p2, BorderLayout.SOUTH); p.add(output, BorderLayout.CENTER); buttonclose(); this.setTitle("聊天室for客户端"); this.add(p); this.setSize(500, 300); this.setVisible(true); } public void buttonclose() { b1.setEnabled(true); b2.setEnabled(false); b3.setEnabled(false); input.setEditable(false); fuwuqi.setEditable(true); duankou.setEditable(true); nicheng.setEditable(true); } public void buttonopen() { b1.setEnabled(false); b2.setEnabled(true); b3.setEnabled(true); input.setEditable(true); fuwuqi.setEditable(false); duankou.setEditable(false); nicheng.setEditable(false); } //连接函数,流与Socket所在 public void connect() { try { cs = new Socket(fuwuqi.getText(), Integer.parseInt(duankou.getText())); System.out.print("加入连接"); dos = new DataOutputStream(cs.getOutputStream()); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } //断开函数,流与Socket所在 public void disconnect() { try { bConnected = false; dos.writeUTF("$%$"); dis.close(); dos.close(); System.out.println("disdos.close"); cs.close(); System.out.println("cs.close"); output.append("退出成功\n"); buttonclose(); } catch (IOException e) { e.printStackTrace(); } } //发送流函数 public void send() { try { if(talking == null) { dos.writeUTF(""); }else { dos.writeUTF(talking); } dos.flush(); } catch (IOException e1) { e1.printStackTrace(); } } //接收流函数 public void receive() { try { started = true; bConnected = true; dis = new DataInputStream(cs.getInputStream()); new Thread() { public void run() { System.out.println("开始接收"); while (bConnected) { String talking = ""; try { talking = dis.readUTF(); output.append("\n\r" + "主机" + " : " + talking); if("$%$".equalsIgnoreCase(talking)){ disconnect(); } } catch (IOException e) { e.printStackTrace(); } } // try { // dis.close(); // } catch (IOException e) { // e.printStackTrace(); // } } }.start(); } catch (IOException e1) { e1.printStackTrace(); } } public void actionPerformed(ActionEvent e) { String S = e.getActionCommand(); if ("发送".equalsIgnoreCase(S)) { talking = input.getText().trim(); String snicheng = nicheng.getText().trim(); output.append("\n\r" + snicheng + " : " + talking); input.setText(""); try { dos.writeUTF(snicheng); } catch (IOException e1) { e1.printStackTrace(); } send(); } else if ("进入".equalsIgnoreCase(S)) { connect(); receive(); output.append("进入成功\n 服务器:" + fuwuqi.getText() + "\t端口:" + duankou.getText() + "\t昵称:" + nicheng.getText() + "\n"); buttonopen(); } else if ("退出".equalsIgnoreCase(S)) { disconnect(); } } public static void main(String args[]) { new Desktop(); } } ***********服务器******************************** import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; import javax.swing.*; @SuppressWarnings("serial") public class Servicer extends JFrame implements ActionListener { @SuppressWarnings("unused") private class WindowCloser extends WindowAdapter { public void windowClosing(WindowEvent we) { System.exit(0); } } private ServerSocket ss = null; private Socket s; private JPanel p = new JPanel(); private JTextArea output = new JTextArea(); private JTextField input = new JTextField(); private DataOutputStream dos; private DataInputStream dis; private JButton b1 = new JButton("启动"); private JButton b2 = new JButton("退出"); private JButton b3 = new JButton("发送"); private String talking, nicheng; private boolean started = true; private boolean bConnected = false; // UI界面(不需要再修改) Servicer() { p.setLayout(new BorderLayout()); JPanel p1 = new JPanel(); JPanel p2 = new JPanel(); p1.add(b1); b1.addActionListener(this); p1.add(b2); b2.addActionListener(this); b3.addActionListener(this); p2.setLayout(new BorderLayout()); p2.add(input, BorderLayout.CENTER); p2.add(b3, BorderLayout.EAST); p.add(p1, BorderLayout.NORTH); p.add(p2, BorderLayout.SOUTH); p.add(output, BorderLayout.CENTER); b2.setEnabled(false); b1.setEnabled(true); b3.setEnabled(false); input.setEditable(false); output.setEditable(false); this.setTitle("聊天室for服务端"); this.add(p); this.setSize(500, 300); this.setVisible(true); } public void buttonclose() { b1.setEnabled(true); b2.setEnabled(false); b3.setEnabled(false); input.setEditable(false); } public void buttonopen() { b1.setEnabled(false); b2.setEnabled(true); b3.setEnabled(true); input.setEditable(true); } public void disconnect() { started = false; bConnected = false; try { dos.writeUTF("$%$"); dos.close(); dis.close(); s.close(); System.out.println("Servicer dos.close"); ss.close(); System.out.println("Servicer cs.close"); } catch (IOException e) { e.printStackTrace(); } } public void start() { try { ss = new ServerSocket(8888); } catch (IOException e) { e.printStackTrace(); } try { started = true; //while(started){ s = ss.accept(); output.append("新加入,已连接"); buttonopen(); bConnected = true; dos = new DataOutputStream(s.getOutputStream()); dis = new DataInputStream(s.getInputStream()); link(); //} } catch (IOException e1) { e1.printStackTrace(); } } public void send() { talking = input.getText().trim(); try { if(talking == null) { dos.writeUTF(""); } else { dos.writeUTF(talking); } dos.flush(); } catch (IOException e1) { e1.printStackTrace(); } } public void link() { new Thread(){ public void run() { String nicheng = null; try { nicheng = dis.readUTF(); } catch (IOException e1) { output.append("\n\r用户名获取异常"); e1.printStackTrace(); } while (bConnected) { String talking = ""; try { talking = dis.readUTF(); } catch (IOException e) { e.printStackTrace(); } if("$%$".equalsIgnoreCase(talking)){ disconnect(); } output.append("\n\r" + nicheng + " : " + talking); } // try { // dis.close(); // } catch (IOException e) { // e.printStackTrace(); // } } }.start(); } public void actionPerformed(ActionEvent e) { String S = e.getActionCommand(); String takeing = input.getText().toString(); if ("启动".equalsIgnoreCase(S)) { start(); } else if ("退出".equalsIgnoreCase(S)) { disconnect(); output.append("退出成功"); } else if ("发送".equalsIgnoreCase(S)) { send(); output.append("\n\r" + "主机" + " : " + takeing); input.setText(""); } } public static void main(String args[]) { new Servicer(); } }
Android现网错误日志的处理。
例如: 错误类型有:error.screen.blank,error.play,error.screen.blank。 错误的详细日志: error.screen.blank 当前有网络 java.lang.Exception LOAD_CHAPTER_ERROR加载信息错误 bookId 30992chapterId 363 com.readtech.hmreader.app.book.e.n.onFailureSourceFile210 Caused by java.net.SocketTimeoutException timeout d.s.aSourceFile227 Caused by java.net.SocketException Socket closed java.net.SocketInputStream.socketRead0Native Method java.net.SocketInputStream.readSocketInputStream.java151 java.net.SocketInputStream.readSocketInputStream.java120 d.q.aSourceFile138 d.c.aSourceFile236 d.u.bSourceFile66 d.u.aSourceFile59 d.u.nSourceFile284 c.a.d.ac.bSourceFile445 c.a.d.ac.aSourceFile426 d.e.aSourceFile996 d.u.aSourceFile189 c.al.eSourceFile174 com.iflytek.lab.net.RequestManager.handleResponseSourceFile97 com.iflytek.lab.net.RequestManager.access100SourceFile38 com.iflytek.lab.net.RequestManager1.onResponseSourceFile84 c.afa.bSourceFile135 c.a.b.runSourceFile32 java.util.concurrent.ThreadPoolExecutor.runWorkerThreadPoolExecutor.java1133 java.util.concurrent.ThreadPoolExecutorWorker.runThreadPoolExecutor.java607 java.lang.Thread.runThread.java761 这些数据有几十万条,我该怎样分析归类啊? 有没有哪位大神有过Android错误日志的处理经验。 求一个处理的小程序。
求教一个关于客户端与服务器端交互的问题
客户端 public class Client { public static void main(String[] args) throws UnknownHostException, IOException { Socket s=new Socket("LocalHost",8888); PrintWriter out=new PrintWriter(s.getOutputStream()); out.write("ni hao"); out.flush(); BufferedReader in=new BufferedReader(new InputStreamReader(s.getInputStream())); System.out.println(in.readLine());//这里会一直为阻塞状态 out.close(); } } 服务器端 public class Server { public static void main(String[] args) throws IOException { Socket s=null; ServerSocket ss=new ServerSocket(8888); s=ss.accept(); BufferedReader in=new BufferedReader(new InputStreamReader(s.getInputStream())); System.out.println(in.readLine())]; **//这里也为阻塞状态,如果将客户端的out.close();写到客户端的in.readLine() 前又会报Exception in thread "main" java.net.SocketException: Socket is closed at java.net.Socket.getInputStream(Unknown Source)错误,求解决方法** PrintWriter pw=new PrintWriter(s.getOutputStream()); pw.write("hello"); pw.flush(); pw.close(); } }
我的IntelliJ Idea無法正常使用調試功能了,希望可以在此獲得幫助
現在我在用IntelliJ Idea調試的時候,會出現一些錯誤提示,在控制台上會出現這個: ERROR: transport library not found: dt_socket ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_LOAD(509) JDWP exit error AGENT_ERROR_TRANSPORT_LOAD(196): No transports initialized [debugInit.c:750] 然後左下角也會有一個對誥框:Error running 程序名:Unable to open debugger port:java.net.SocketException "Socket closed" 我希望可以獲得一個有效的解決方案,謝謝!
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、PDF搜索网站推荐 对于大部
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 顺便拉下票,我在参加csdn博客之星竞选,欢迎投票支持,每个QQ或者微信每天都可以投5票,扫二维码即可,http://m234140.nofollow.ax.
Vue + Spring Boot 项目实战(十四):用户认证方案与完善的访问拦截
本篇文章主要讲解 token、session 等用户认证方案的区别并分析常见误区,以及如何通过前后端的配合实现完善的访问拦截,为下一步权限控制的实现打下基础。
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入  假设现有4个人
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 欢迎 改进 留言。 演示地点跳到演示地点 html代码如下`&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;music&lt;/title&gt; &lt;meta charset="utf-8"&gt
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。 1. for - else 什么?不是 if 和 else 才
数据库优化 - SQL优化
前面一篇文章从实例的角度进行数据库优化,通过配置一些参数让数据库性能达到最优。但是一些“不好”的SQL也会导致数据库查询变慢,影响业务流程。本文从SQL角度进行数据库优化,提升SQL运行效率。 判断问题SQL 判断SQL是否有问题时可以通过两个表象进行判断: 系统级别表象 CPU消耗严重 IO等待严重 页面响应时间过长
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 c/c++ 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7
通俗易懂地给女朋友讲:线程池的内部原理
餐厅的约会 餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”我楞了一下,心里想女朋友今天是怎么了,怎么突然问出这么专业的问题,但做为一个专业人士在女朋友面前也不能露怯啊,想了一下便说:“我先给你讲讲我前同事老王的故事吧!” 大龄程序员老王 老王是一个已经北漂十多年的程序员,岁数大了,加班加不动了,升迁也无望,于是拿着手里
经典算法(5)杨辉三角
写在前面: 我是 扬帆向海,这个昵称来源于我的名字以及女朋友的名字。我热爱技术、热爱开源、热爱编程。技术是开源的、知识是共享的。 这博客是对自己学习的一点点总结及记录,如果您对 Java、算法 感兴趣,可以关注我的动态,我们一起学习。 用知识改变命运,让我们的家人过上更好的生活。 目录一、杨辉三角的介绍二、杨辉三角的算法思想三、代码实现1.第一种写法2.第二种写法 一、杨辉三角的介绍 百度
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹
面试官:你连RESTful都不知道我怎么敢要你?
面试官:了解RESTful吗? 我:听说过。 面试官:那什么是RESTful? 我:就是用起来很规范,挺好的 面试官:是RESTful挺好的,还是自我感觉挺好的 我:都挺好的。 面试官:… 把门关上。 我:… 要干嘛?先关上再说。 面试官:我说出去把门关上。 我:what ?,夺门而去 文章目录01 前言02 RESTful的来源03 RESTful6大原则1. C-S架构2. 无状态3.统一的接
SQL-小白最佳入门sql查询一
一 说明 如果是初学者,建议去网上寻找安装Mysql的文章安装,以及使用navicat连接数据库,以后的示例基本是使用mysql数据库管理系统; 二 准备前提 需要建立一张学生表,列分别是id,名称,年龄,学生信息;本示例中文章篇幅原因SQL注释略; 建表语句: CREATE TABLE `student` ( `id` int(11) NOT NULL AUTO_INCREMENT, `
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // dosho
漫话:什么是平衡(AVL)树?这应该是把AVL树讲的最好的文章了
这篇文章通过对话的形式,由浅入深带你读懂 AVL 树,看完让你保证理解 AVL 树的各种操作,如果觉得不错,别吝啬你的赞哦。 1、若它的左子树不为空,则左子树上所有的节点值都小于它的根节点值。 2、若它的右子树不为空,则右子树上所有的节点值均大于它的根节点值。 3、它的左右子树也分别可以充当为二叉查找树。 例如: 例如,我现在想要查找数值为14的节点。由于二叉查找树的特性,我们可...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,
程序员:我终于知道post和get的区别
IT界知名的程序员曾说:对于那些月薪三万以下,自称IT工程师的码农们,其实我们从来没有把他们归为我们IT工程师的队伍。他们虽然总是以IT工程师自居,但只是他们一厢情愿罢了。 此话一出,不知激起了多少(码农)程序员的愤怒,却又无可奈何,于是码农问程序员。 码农:你知道get和post请求到底有什么区别? 程序员:你看这篇就知道了。 码农:你月薪三万了? 程序员:嗯。 码农:你是怎么做到的? 程序员:
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU
开源并不是你认为的那些事
点击上方蓝字 关注我们开源之道导读所以 ————想要理清开源是什么?先要厘清开源不是什么,名正言顺是句中国的古代成语,概念本身的理解非常之重要。大部分生物多样性的起源,...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
      11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员
网易云6亿用户音乐推荐算法
网易云音乐是音乐爱好者的集聚地,云音乐推荐系统致力于通过 AI 算法的落地,实现用户千人千面的个性化推荐,为用户带来不一样的听歌体验。 本次分享重点介绍 AI 算法在音乐推荐中的应用实践,以及在算法落地过程中遇到的挑战和解决方案。 将从如下两个部分展开: AI 算法在音乐推荐中的应用 音乐场景下的 AI 思考 从 2013 年 4 月正式上线至今,网易云音乐平台持续提供着:乐屏社区、UGC
【技巧总结】位运算装逼指南
位算法的效率有多快我就不说,不信你可以去用 10 亿个数据模拟一下,今天给大家讲一讲位运算的一些经典例子。不过,最重要的不是看懂了这些例子就好,而是要在以后多去运用位运算这些技巧,当然,采用位运算,也是可以装逼的,不信,你往下看。我会从最简单的讲起,一道比一道难度递增,不过居然是讲技巧,那么也不会太难,相信你分分钟看懂。 判断奇偶数 判断一个数是基于还是偶数,相信很多人都做过,一般的做法的代码如下
《C++ Primer》学习笔记(六):C++模块设计——函数
专栏C++学习笔记 《C++ Primer》学习笔记/习题答案 总目录 https://blog.csdn.net/TeFuirnever/article/details/100700212 —————————————————————————————————————————————————————— 《C++ Primer》习题参考答案:第6章 - C++模块设计——函数 文章目录专栏C+...
8年经验面试官详解 Java 面试秘诀
    作者 | 胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实
面试官如何考察你的思维方式?
1.两种思维方式在求职面试中,经常会考察这种问题:北京有多少量特斯拉汽车? 某胡同口的煎饼摊一年能卖出多少个煎饼? 深圳有多少个产品经理? 一辆公交车里能装下多少个乒乓球? 一
so easy! 10行代码写个"狗屁不通"文章生成器
前几天,GitHub 有个开源项目特别火,只要输入标题就可以生成一篇长长的文章。背后实现代码一定很复杂吧,里面一定有很多高深莫测的机器学习等复杂算法不过,当我看了源代码之后这程序不到50
知乎高赞:中国有什么拿得出手的开源软件产品?(整理自本人原创回答)
知乎高赞:中国有什么拿得出手的开源软件产品? 在知乎上,有个问题问“中国有什么拿得出手的开源软件产品(在 GitHub 等社区受欢迎度较好的)?” 事实上,还不少呢~ 本人于2019.7.6进行了较为全面的 回答 - Bravo Yeung,获得该问题下回答中得最高赞(236赞和1枚专业勋章),对这些受欢迎的 Github 开源项目分类整理如下: 分布式计算、云平台相关工具类 1.SkyWalk
相关热词 c#选择结构应用基本算法 c# 收到udp包后回包 c#oracle 头文件 c# 序列化对象 自定义 c# tcp 心跳 c# ice连接服务端 c# md5 解密 c# 文字导航控件 c#注册dll文件 c#安装.net
立即提问