This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes BEA/Weblogic and the fly likes IOException in writing to response.getWriter() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Reply Bookmark "IOException in writing to response.getWriter()" Watch "IOException in writing to response.getWriter()" New topic
Author

IOException in writing to response.getWriter()

Sharad Agarwal
Ranch Hand

Joined: Sep 11, 2002
Posts: 167
Relevant snip of code is:

Relevant snip of stack trace is:
Servlet failed with Exception
java.lang.RuntimeException: IOException occured
at weblogic.servlet.internal.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:178)
at weblogic.servlet.internal.WLOutputStreamWriter.write(WLOutputStreamWriter.java:99)
at weblogic.servlet.internal.WLOutputStreamWriter.write(WLOutputStreamWriter.java:111)
at java.io.PrintWriter.write(PrintWriter.java:208)
at java.io.PrintWriter.write(PrintWriter.java:224)
at java.io.PrintWriter.print(PrintWriter.java:369)
at com.myCode.servlet.myServlet.doGet(myServlet.java:282)
Line 282 in myServlet is the one above: out.print(completeDoc);
Now this happens once in ~1000 accesses to this servlet. While I will be adding code to catch the IOException and print details, I was hoping if someone could point me towards possible issues. Also, perhaps it might be more correct to convert this statement to: out.print(completeDoc.toString());


Alco-Haul: We move spirits.
Demented Deliberations of a Dilettante
Sai Prasad
Ranch Hand

Joined: Feb 25, 2002
Posts: 560
I don't know why but I like to know the reason too.
sameerleekha
Greenhorn

Joined: Jan 22, 2002
Posts: 26
Hi,
Try to set the content type before getting the writer object.
response.setContentType("text/html")


sameer
Sharad Agarwal
Ranch Hand

Joined: Sep 11, 2002
Posts: 167
Hi All (especially Sai Prasad),
Sorry for the late response. This had been put on the back burner for quite some time. We found out the issue. This Exception is logged by Weblogic whenever the end customer hits 'escape' or 'stop' in the browser before the page is loaded. I guess the connection gets terminated and consequently the servlet throws an IOException. Note that this is WL5.1, this might have been 'fixed' in later versions.
Hope this helps,
Sharad Agarwal
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Originally posted by Sharad Agarwal:
Hi All (especially Sai Prasad),
Sorry for the late response. This had been put on the back burner for quite some time. We found out the issue. This Exception is logged by Weblogic whenever the end customer hits 'escape' or 'stop' in the browser before the page is loaded. I guess the connection gets terminated and consequently the servlet throws an IOException. Note that this is WL5.1, this might have been 'fixed' in later versions.
Hope this helps,
Sharad Agarwal

I remember this problem from WLS 4.x, however I didn't put the two together when you originally posted. Regardless, this problem has been fixed in WLS 6.x and greater.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: IOException in writing to response.getWriter()
 
Similar Threads
JSP: Is it possible to use custom tags in a servlet?
doTrace in HttpServlet
Help With Connection Pool
Request Dispatcher not working
Possible deadlock issues.