First off.  Since you are catching the error properly and displaying the
message, you are not seeing a stack trace.  This is not necessarily "bad
practice".  It is just that you cannot see the specifics of your error.

For logging purposes, modify the code as below:
try

{

inStream = httpConnection.getInputStream();

}

catch (IOException e)

{
e.printStackTrace();
String sMessage = "XML Regular I/O Exception - while getting the input
stream from " +

url.toString() + " | original message -> " + (e);

throw new XMLExceptionIO(sMessage);

}



-----Original Message-----
From: Ramadhenu, Giridhar (STSD) [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 30, 2006 6:55 PM
To: users@tomcat.apache.org
Subject: getInputStream() fails intermittently

Hello,



I am encountering IOException while getting input stream using
getInputStream() method on URLConnection class while sending data to
Tomcat. Error is pasted below.



"XML Regular I/O Exception - while getting the input stream from
http://12.34.56.78:80/myApp/servlet/com.myComp.xml.CollectorServlet |
original message -> 2006-03-04 22:20:05.54 java.io.IOException: Server
returned HTTP response code: 500 for URL:
http://12.34.56.78:80/myApp/servlet/com.myComp.xml.CollectorServlet";



The problem occurs after continuous operation of Tomcat server for about
one month. But server does not show any exception when client encounters
this problem.



Please find the client code below.

------------------------------------------------

URLConnection httpConnection = null;



//Code to open connection to URL

........



httpConnection.setDoOutput(true);

httpConnection.setDoInput(true);

httpConnection.setUseCaches(false);

httpConnection.setRequestProperty("Content-Type",
"text/xml;charset=UTF-8");

httpConnection.setRequestProperty("Authorization", authString);



//Code to get the output stream

........



outStream.write(......);

outStream.flush();

outStream.close();



try

{

inStream = httpConnection.getInputStream();

}

catch (IOException e)

{

String sMessage = "XML Regular I/O Exception - while getting the input
stream from " +

url.toString() + " | original message -> " + (e);

throw new XMLExceptionIO(sMessage);

}





Thanks in advance.

Giridhar.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to