Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6003595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:08:38+00:00 2026-05-23T01:08:38+00:00

I am using a servlet which passes a String parameter to another Servlet in

  • 0

I am using a servlet which passes a String parameter to another Servlet in another remote system, to get xml response from that remote servlet.

This works fine when i tried to connect to that remote Servlet from my local PC.

But I am getting the error java.net.SocketException: Unexpected end of file from server when I execute same from another server.

Error:

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)

Code in My Servlet (client):

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);  
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:08:38+00:00Added an answer on May 23, 2026 at 1:08 am

    There was nothing wrong with the code but the thing was the remote server wasn’t listening to the connection from my server, hence i tried the same code but on another remote server this time and its working fine….! any body know the reason…………?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a simple java Servlet which passes categories using a URL variable into
We're creating a web system using Java and Servlet technology (actually Wicket for the
I have a servlet which takes us to an existing jsp, say home.jsp. This
I want to add a URL parameter before forwarding to another action from an
1) In my servlet program, I have a statement which will be printed using
I am developing an online exam using JSP/Servlets which is nearing completion. I'm planning
I'm using $.post() to call a servlet using Ajax and then using the resulting
I'm currently logging via the simplest of methods within my servlet using Tomcat. I
I'm using Tomcat 5.5 as my servlet container. My web application deploys via .jar
I recently started using Eclipse at work for my Java servlet projects. I've been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.