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也能进行正常的信息收发, 但是这个错误看着有点受不了.请问有大神知道问题出在哪里吗??
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)
跪求如何解决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) ```
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" 我希望可以獲得一個有效的解決方案,謝謝!
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小人工智障。 思路可以运用在不同地方,主要介绍的是思路。
面试官问我:什么是消息队列?什么场景需要他?用了会出现什么问题?
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式和人才交流群,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸...
8年经验面试官详解 Java 面试秘诀
作者 |胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。 Java程序员准备和投递简历的实...
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观...
MyBatis研习录(01)——MyBatis概述与入门
MyBatis 是一款优秀的持久层框架,它支持定制化 SQL、存储过程以及高级映射。MyBatis原本是apache的一个开源项目iBatis, 2010年该项目由apache software foundation 迁移到了google code并改名为MyBatis 。2013年11月MyBatis又迁移到Github。
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外...
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip installselenium -ihttps://pypi.tuna.tsinghua.edu.cn/simple/ ...
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca...
Python爬虫精简步骤1 获取数据
爬虫,从本质上来说,就是利用程序在网上拿到对我们有价值的数据。 爬虫能做很多事,能做商业分析,也能做生活助手,比如:分析北京近两年二手房成交均价是多少?广州的Python工程师平均薪资是多少?北京哪家餐厅粤菜最好吃?等等。 这是个人利用爬虫所做到的事情,而公司,同样可以利用爬虫来实现巨大的商业价值。比如你所熟悉的搜索引擎——百度和谷歌,它们的核心技术之一也是爬虫,而且是超级爬虫。 从搜索巨头到人工...
Python绘图,圣诞树,花,爱心 | Turtle篇
每周每日,分享Python实战代码,入门资料,进阶资料,基础语法,爬虫,数据分析,web网站,机器学习,深度学习等等。 公众号回复【进群】沟通交流吧,QQ扫码进群学习吧 微信群 QQ群 1.画圣诞树 import turtle screen = turtle.Screen() screen.setup(800,600) circle = turtle.Turtle()...
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东...
破14亿,Python分析我国存在哪些人口危机!
一、背景 二、爬取数据 三、数据分析 1、总人口 2、男女人口比例 3、人口城镇化 4、人口增长率 5、人口老化(抚养比) 6、各省人口 7、世界人口 四、遇到的问题 遇到的问题 1、数据分页,需要获取从1949-2018年数据,观察到有近20年参数:LAST20,由此推测获取近70年的参数可设置为:LAST70 2、2019年数据没有放上去,可以手动添加上去 3、将数据进行 行列转换 4、列名...
web前端javascript+jquery知识点总结
1.Javascript 语法.用途 javascript 在前端网页中占有非常重要的地位,可以用于验证表单,制作特效等功能,它是一种描述语言,也是一种基于对象(Object)和事件驱动并具有安全性的脚本语言 ...
Python实战:抓肺炎疫情实时数据,画2019-nCoV疫情地图
今天,群里白垩老师问如何用python画武汉肺炎疫情地图。白垩老师是研究海洋生态与地球生物的学者,国家重点实验室成员,于不惑之年学习python,实为我等学习楷模。先前我并没有关注武汉肺炎的具体数据,也没有画过类似的数据分布图。于是就拿了两个小时,专门研究了一下,遂成此文。
听说想当黑客的都玩过这个Monyer游戏(1~14攻略)
第零关 进入传送门开始第0关(游戏链接) 请点击链接进入第1关: 连接在左边→ ←连接在右边 看不到啊。。。。(只能看到一堆大佬做完的留名,也能看到菜鸡的我,在后面~~) 直接fn+f12吧 &lt;span&gt;连接在左边→&lt;/span&gt; &lt;a href="first.php"&gt;&lt;/a&gt; &lt;span&gt;←连接在右边&lt;/span&gt; o...
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ...... ...
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!...
渗透测试-灰鸽子远控木马
木马概述 灰鸽子( Huigezi),原本该软件适用于公司和家庭管理,其功能十分强大,不但能监视摄像头、键盘记录、监控桌面、文件操作等。还提供了黑客专用功能,如:伪装系统图标、随意更换启动项名称和表述、随意更换端口、运行后自删除、毫无提示安装等,并采用反弹链接这种缺陷设计,使得使用者拥有最高权限,一经破解即无法控制。最终导致被黑客恶意使用。原作者的灰鸽子被定义为是一款集多种控制方式于一体的木马程序...
Python:爬取疫情每日数据
前言 目前每天各大平台,如腾讯、今日头条都会更新疫情每日数据,他们的数据源都是一样的,主要都是通过各地的卫健委官网通报。 以全国、湖北和上海为例,分别为以下三个网站: 国家卫健委官网:http://www.nhc.gov.cn/xcs/yqtb/list_gzbd.shtml 湖北卫健委官网:http://wjw.hubei.gov.cn/bmdt/ztzl/fkxxgzbdgrfyyq/xxfb...
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。 再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。 下文是原回答,希望能对你能有所启发。 如果我说,这个世界上人真的分三六九等,...
B 站上有哪些很好的学习资源?
哇说起B站,在小九眼里就是宝藏般的存在,放年假宅在家时一天刷6、7个小时不在话下,更别提今年的跨年晚会,我简直是跪着看完的!! 最早大家聚在在B站是为了追番,再后来我在上面刷欧美新歌和漂亮小姐姐的舞蹈视频,最近两年我和周围的朋友们已经把B站当作学习教室了,而且学习成本还免费,真是个励志的好平台ヽ(.◕ฺˇд ˇ◕ฺ;)ノ 下面我们就来盘点一下B站上优质的学习资源: 综合类 Oeasy: 综合...
雷火神山直播超两亿,Web播放器事件监听是怎么实现的?
Web播放器解决了在手机浏览器和PC浏览器上播放音视频数据的问题,让视音频内容可以不依赖用户安装App,就能进行播放以及在社交平台进行传播。在视频业务大数据平台中,播放数据的统计分析非常重要,所以Web播放器在使用过程中,需要对其内部的数据进行收集并上报至服务端,此时,就需要对发生在其内部的一些播放行为进行事件监听。 那么Web播放器事件监听是怎么实现的呢? 01 监听事件明细表 名...
3万字总结,Mysql优化之精髓
本文知识点较多,篇幅较长,请耐心学习 MySQL已经成为时下关系型数据库产品的中坚力量,备受互联网大厂的青睐,出门面试想进BAT,想拿高工资,不会点MySQL优化知识,拿offer的成功率会大大下降。 为什么要优化 系统的吞吐量瓶颈往往出现在数据库的访问速度上 随着应用程序的运行,数据库的中的数据会越来越多,处理时间会相应变慢 数据是存放在磁盘上的,读写速度无法和内存相比 如何优化 设计...
Python新型冠状病毒疫情数据自动爬取+统计+发送报告+数据屏幕(三)发送篇
今天介绍的项目是使用 Itchat 发送统计报告 项目功能设计: 定时爬取疫情数据存入Mysql 进行数据分析制作疫情报告 使用itchat给亲人朋友发送分析报告 基于Django做数据屏幕 使用Tableau做数据分析 来看看最终效果 目前已经完成,预计2月12日前更新 使用 itchat 发送数据统计报告 itchat 是一个基于 web微信的一个框架,但微信官方并不允许使用这...
作为程序员的我,大学四年一直自学,全靠这些实用工具和学习网站!
我本人因为高中沉迷于爱情,导致学业荒废,后来高考,毫无疑问进入了一所普普通通的大学,实在惭愧???? 我又是那么好强,现在学历不行,没办法改变的事情了,所以,进入大学开始,我就下定决心,一定要让自己掌握更多的技能,尤其选择了计算机这个行业,一定要多学习技术。 在进入大学学习不久后,我就认清了一个现实:我这个大学的整体教学质量和学习风气,真的一言难尽,懂的人自然知道怎么回事? 怎么办?我该如何更好的提升自...
粒子群算法求解物流配送路线问题(python)
1.Matlab实现粒子群算法的程序代码:https://www.cnblogs.com/kexinxin/p/9858664.html matlab代码求解函数最优值:https://blog.csdn.net/zyqblog/article/details/80829043 讲解通俗易懂,有数学实例的博文:https://blog.csdn.net/daaikuaichuan/article/...
教你如何编写第一个简单的爬虫
很多人知道爬虫,也很想利用爬虫去爬取自己想要的数据,那么爬虫到底怎么用呢?今天就教大家编写一个简单的爬虫。 下面以爬取笔者的个人博客网站为例获取第一篇文章的标题名称,教大家学会一个简单的爬虫。 第一步:获取页面 #!/usr/bin/python # coding: utf-8 import requests #引入包requests link = "http://www.santostang....
前端JS初级面试题二 (。•ˇ‸ˇ•。)老铁们!快来瞧瞧自己都会了么
1. 传统事件绑定和符合W3C标准的事件绑定有什么区别? 传统事件绑定 &lt;div onclick=""&gt;123&lt;/div&gt; div1.onclick = function(){}; &lt;button onmouseover=""&gt;&lt;/button&gt; 注意: 如果给同一个元素绑定了两次或多次相同类型的事件,那么后面的绑定会覆盖前面的绑定 (不支持DOM事...
相关热词 c# 识别回车 c#生成条形码ean13 c#子控制器调用父控制器 c# 写大文件 c# 浏览pdf c#获取桌面图标的句柄 c# list反射 c# 句柄 进程 c# 倒计时 线程 c# 窗体背景色
立即提问