gpt4 book ai didi

java.net.SocketException : Unexpected end of file from server 异常

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:25:40 25 4
gpt4 key购买 nike

我正在使用一个 servlet,它将一个字符串参数传递给另一个远程系统中的另一个 Servlet,以从该远程 servlet 获取 xml 响应。

当我尝试从我的本地 PC 连接到远程 Servlet 时,这工作正常。

但是当我从另一台服务器执行相同的操作时,出现错误 java.net.SocketException: Unexpected end of file from server

错误:

2011-06-04 11:27:24,305 INFO  [STDOUT] strURL in Inventry --> http://1**.1**.**.27:7777/GatewayServlet
/Status?Str=Inventory&PARTNUM=200A104%27%2C%27200A112%27%2C%27200A114%27%2C%27200A113%27%2C%27200A117%27%2C%27200A120%27%2C%27240A503%27%2C%27200A132%27%2C%27200A128%27%2C%27200A124
2011-06-04 11:28:06,243 ERROR [STDERR] java.net.SocketException: Unexpected end of file from server
2011-06-04 11:28:06,243 ERROR [STDERR] at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
2011-06-04 11:28:06,243 ERROR [STDERR] at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
2011-06-04 11:28:06,243 ERROR [STDERR] at sun.net.www.http.HttpClient.parseHTTPHeader(Unknown Source)
2011-06-04 11:28:06,243 ERROR [STDERR] at sun.net.www.http.HttpClient.parseHTTP(Unknown Source)
2011-06-04 11:28:06,243 ERROR [STDERR] at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
2011-06-04 11:28:06,243 ERROR [STDERR] at com.cim.web.servlet.DBGatewayServiceServlet.processRequest(DBGatewayServiceServlet.java:52)
2011-06-04 11:28:06,243 ERROR [STDERR] at com.cim.web.servlet.DBGatewayServiceServlet.doGet(DBGatewayServiceServlet.java:113)
2011-06-04 11:28:06,243 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
2011-06-04 11:28:06,243 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
2 011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
2011-06-04 11:28:06,243 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
2011-06-04 11:28:06,243 ERROR [STDERR] at java.lang.Thread.run(Unknown Source)

我的 Servlet 中的代码(客户端):

if(queryString.equals("Inventory")) {

String partNum = (String)session.getAttribute("PARTNUM");
String locId = (String)session.getAttribute("locids");

strURL = strURL+"/InventoryStatus?queryStr=Inventory&PARTNUM="+partNum;

URLConnection dbGatewayURL = new URL(strURL).openConnection();

BufferedReader in = new BufferedReader(new InputStreamReader(dbGatewayURL.getInputStream()));//--This is line 52 Mentioned in Error above

StringBuffer responseData = new StringBuffer();
String line="";

while((line = in.readLine()) != null) {
responseData.append(line);
}

String result =responseData.toString();
request.setAttribute("inventryStock",result);

RequestDispatcher rd=request.getRequestDispatcher ("inventryStatus.jsp?resp=Yes");
rd.forward(request, response);
}

最佳答案

尝试从您的服务器远程登录到远程 servlet 并查看它是否按预期连接。如果不是,那就是连接问题。

如果是,请尝试使用 TCP 监视器来查看从您的服务器到具有 servlet 的远程服务器的 HTTP 流量。 http://ws.apache.org/commons/tcpmon/

关于java.net.SocketException : Unexpected end of file from server 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6235744/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com