java.net.SocketException: Connection reset
错误。我们不确定实际发生 Connection reset
错误的原因,并且也不知道如何进行调试。该问题似乎与我们尝试发送的消息无关。 请注意,该消息不是
connection reset by peer
。您有关于这个异常的典型原因和我们应该如何处理的任何建议吗?
以下是代表性的堆栈跟踪(
com.companyname.mtix.sms
是我们的组件):java.net.SocketException: Connection reset
在java.net.SocketInputStream.read(SocketInputStream.java:168)中出现问题,
在java.io.BufferedInputStream.fill(BufferedInputStream.java:218)中填充数据时出错,
在java.io.BufferedInputStream.read(BufferedInputStream.java:235)中读取数据时出错,
在org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77)中读取原始行时出错,
在org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105)中读取行时出错,
在org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1115)中读取响应状态行时出错,
在org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832)中读取响应状态行时出错,
在org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)中读取响应时出错,
在org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)中执行HTTP方法时出错,
在org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)中执行HTTP方法时出错,
在org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)中执行HTTP方法时出错,
在org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)中执行HTTP方法时出错,
在org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)中执行HTTP方法时出错,
在com.companyname.mtix.sms.services.impl.message.SendTextMessage.sendTextMessage(SendTextMessage.java:127)中发送短信时出错,
在com.companyname.mtix.sms.services.MessageServiceImpl.sendTextMessage(MessageServiceImpl.java:125)中发送短信时出错,
在com.companyname.mtix.sms.services.remote.MessageServiceRemoteImpl.sendTextMessage(MessageServiceRemoteImpl.java:43)中发送短信时出错,
在sun.reflect.GeneratedMethodAccessor203.invoke(Unknown Source)中调用方法时出错,
在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)中调用方法时出错,
在java.lang.reflect.Method.invoke(Method.java:585)中调用方法时出错,
在org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)中调用方法时出错,
在org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)中处理消息时出错,
在org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)中调用方法时出错,
在org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)中访问时出错,
在org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)中访问时出错,
在org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)中调用时出错,
在org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)中调用SOAP服务时出错,
在org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)中调用Axis服务器时出错,
在org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)中进行POST请求时出错,
在javax.servlet.http.HttpServlet.service(HttpServlet.java:709)中提供HTTP服务时出错,
在org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)中提供HTTP服务时出错,
在javax.servlet.http.HttpServlet.service(HttpServlet.java:802)中提供HTTP服务时出错,
在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)中过滤请求时出错,
在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)中过滤请求时出错,
在com.companyname.mtix.sms.http.filters.NoCacheFilter.doFilter(NoCacheFilter.java:63)中过滤请求时出错,
在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)中过滤请求时出错,
在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)中过滤请求时出错,
在com.companyname.mtix.sms.http.filters.MessageFilter.doFilter(MessageFilter.java:53)中过滤请求时出错,
在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)中过滤请求时出错,
在org.apache我们的组件是一个在Tomcat下运行的Web应用程序,调用第三方Web服务发送短信,它偶然发生。异常抛出的代码行是下面代码片段中的最后一行。
我们的组件是一个 Web 应用程序,在 Tomcat 下运行,调用第三方 Web 服务发送 SMS 消息,偶尔会出现异常。代码片段中异常抛出的那一行是最后一行。
String aggregatorResponse = null;
HttpClient httpClient = prepareHttpClient( username, password );
PostMethod postMethod = preparePostMethod( textUrl );
try {
SybaseTextMessageBuilder builder = new SybaseTextMessageBuilder();
URL notifyUrl = buildNotificationUrl( textMessage, codeSetManager );
String smsRequestDocument = builder.buildTextMessage( textMessage, notifyUrl );
LOG.debug( "Sybase MT document created as: \n" + smsRequestDocument );
postMethod.setRequestEntity( new StringRequestEntity( smsRequestDocument ) );
LOG.debug( "commiting SMS to aggregator: " + textMessage.toString() );
int httpStatus = httpClient.executeMethod( postMethod );