• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

IOException in writing to response.getWriter()

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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());
 
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know why but I like to know the reason too.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Try to set the content type before getting the writer object.
response.setContentType("text/html")
 
Sharad Agarwal
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Sasparilla and fresh horses for all my men! You will see to it, won't you tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic