Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java EOFEException是否总是由远程主机引起的?_Java_Spring_Sockets - Fatal编程技术网

Java EOFEException是否总是由远程主机引起的?

Java EOFEException是否总是由远程主机引起的?,java,spring,sockets,Java,Spring,Sockets,我有一个客户端,它通过套接字向主机发送数据。偶尔我会得到java.io.EOFException 问题是:我怎么知道是谁导致插座关闭的?由于远程主机关闭了套接字,是否总是引发该异常 或者也可能是内部网络连接问题?还是从我的ISP org.springframework.messaging.MessagingException: Dispatcher failed to deliver Message; nested exception is org.springframework.messagi

我有一个客户端,它通过套接字向主机发送数据。偶尔我会得到
java.io.EOFException

问题是:我怎么知道是谁导致插座关闭的?由于远程主机关闭了套接字,是否总是引发该异常

或者也可能是内部网络连接问题?还是从我的ISP

org.springframework.messaging.MessagingException: Dispatcher failed to deliver Message; nested exception is org.springframework.messaging.MessagingException: Exception while awaiting reply; nested exception is java.io.EOFException: Connection is closed
    at org.springframework.integration.dispatcher.AbstractDispatcher.wrapExceptionIfNecessary(AbstractDispatcher.java:133) ~[spring-integration-core-4.3.11.RELEASE.jar:4.3.11.RELEASE]
    at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:120) ~[spring-integration-core-4.3.11.RELEASE.jar:4.3.11.RELEASE]
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:148) ~[spring-integration-core-4.3.11.RELEASE.jar:4.3.11.RELEASE]
    at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:121) ~[spring-integration-core-4.3.11.RELEASE.jar:4.3.11.RELEASE]
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:89) ~[spring-integration-core-4.3.11.RELEASE.jar:4.3.11.RELEASE]
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423) ~[spring-integration-core-4.3.11.RELEASE.jar:4.3.11.RELEASE]
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373) ~[spring-integration-core-4.3.11.RELEASE.jar:4.3.11.RELEASE]
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115) ~[spring-messaging-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.messaging.core.GenericMessagingTemplate.doSendAndReceive(GenericMessagingTemplate.java:150) ~[spring-messaging-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.messaging.core.GenericMessagingTemplate.doSendAndReceive(GenericMessagingTemplate.java:45) ~[spring-messaging-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.messaging.core.AbstractMessagingTemplate.sendAndReceive(AbstractMessagingTemplate.java:42) ~[spring-messaging-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.integration.core.MessagingTemplate.sendAndReceive(MessagingTemplate.java:97) ~[spring-integration-core-4.3.11.RELEASE.jar:4.3.11.RELEASE]
    at org.springframework.integration.core.MessagingTemplate.sendAndReceive(MessagingTemplate.java:38) ~[spring-integration-core-4.3.11.RELEASE.jar:4.3.11.RELEASE]
    at org.springframework.messaging.core.AbstractMessagingTemplate.sendAndReceive(AbstractMessagingTemplate.java:37) ~[spring-messaging-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_131]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_131]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_131]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]

Caused by: org.springframework.messaging.MessagingException: Exception while awaiting reply; nested exception is java.io.EOFException: Connection is closed
    at org.springframework.integration.ip.tcp.TcpOutboundGateway$AsyncReply.getReply(TcpOutboundGateway.java:322) ~[spring-integration-ip-4.3.11.RELEASE.jar:4.3.11.RELEASE]
    at org.springframework.integration.ip.tcp.TcpOutboundGateway.handleRequestMessage(TcpOutboundGateway.java:139) ~[spring-integration-ip-4.3.11.RELEASE.jar:4.3.11.RELEASE]
    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler$AdvisedRequestHandler.handleRequestMessage(AbstractReplyProducingMessageHandler.java:178) ~[spring-integration-core-4.3.11.RELEASE.jar:4.3.11.RELEASE]
    at sun.reflect.GeneratedMethodAccessor980.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131]
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) ~[spring-aop-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice$1.execute(AbstractRequestHandlerAdvice.java:75) ~[spring-integration-core-4.3.11.RELEASE.jar:4.3.11.RELEASE]
    at org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice.invoke(AbstractRequestHandlerAdvice.java:70) ~[spring-integration-core-4.3.11.RELEASE.jar:4.3.11.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) ~[spring-aop-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at com.sun.proxy.$Proxy1241.handleRequestMessage(Unknown Source) ~[?:?]
    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.doInvokeAdvisedRequestHandler(AbstractReplyProducingMessageHandler.java:127) ~[spring-integration-core-4.3.11.RELEASE.jar:4.3.11.RELEASE]
    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:112) ~[spring-integration-core-4.3.11.RELEASE.jar:4.3.11.RELEASE]
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127) ~[spring-integration-core-4.3.11.RELEASE.jar:4.3.11.RELEASE]
    at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116) ~[spring-integration-core-4.3.11.RELEASE.jar:4.3.11.RELEASE]
    ... 21 more

Caused by: java.io.EOFException: Connection is closed
    at org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory$1.run(AbstractConnectionFactory.java:682) ~[spring-integration-ip-4.3.11.RELEASE.jar:4.3.11.RELEASE]
    ... 3 more
问题是:我怎么知道是谁导致插座关闭的?由于远程主机关闭了连接,是否总是引发该异常

对。其他任何操作都会导致连接重置或读取超时,这就是JRE类本身的行为方式

然而,错误信息的措辞并不令人鼓舞“连接已关闭”可能意味着您正在使用的库在使用已由本地应用程序关闭的连接时错误地抛出
EOFEException
。您需要检查源代码以确保

问题是:我怎么知道是谁导致插座关闭的?由于远程主机关闭了连接,是否总是引发该异常

对。其他任何操作都会导致连接重置或读取超时,这就是JRE类本身的行为方式

然而,错误信息的措辞并不令人鼓舞“连接已关闭”可能意味着您正在使用的库在使用已由本地应用程序关闭的连接时错误地抛出
EOFEException
。您需要检查源代码以确保