Results 1 to 13 of 13
  1. #1
    jctet is offline Member
    Join Date
    Sep 2010
    Posts
    5
    Rep Power
    0

    Default java.lang.IllegalStateException: OutputStream already retrieved

    Hi,

    After a series of transactions, I get this error message:

    500 Internal Server Error
    java.lang.IllegalStateException: OutputStream already retrieved at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.EvermindHttpServletResponse.getWriter (EvermindHttpServletResponse.java:1008) at pckgRefund.servlets.tableMaintenance.userServ.doPo st(userServ.java:1060) at javax.servlet.http.HttpServlet.service(HttpServlet .java:760) at javax.servlet.http.HttpServlet.service(HttpServlet .java:853) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.ResourceFilterChain.doFilter(Resource FilterChain.java:65) at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unkn own Source) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.ServletRequestDispatcher.invoke(Servl etRequestDispatcher.java:673) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.ServletRequestDispatcher.forwardInter nal(ServletRequestDispatcher.java:340) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.HttpRequestHandler.processRequest(Htt pRequestHandler.java:830) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.HttpRequestHandler.run(HttpRequestHan dler.java:285) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.HttpRequestHandler.run(HttpRequestHan dler.java:126) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].util.ReleasableResourcePooledExecutor$MyWorker.ru n(ReleasableResourcePooledExecutor.java:192) at java.lang.Thread.run(Thread.java:534)


    In Oracle JDev, this error message is displayed:
    10/09/13 10:37:35 javax.servlet.ServletException
    10/09/13 10:37:35 at com.evermind.server.http.EvermindPageContext.handl ePageThrowable(EvermindPageContext.java:595)
    10/09/13 10:37:35 at com.evermind.server.http.EvermindPageContext.handl ePageException(EvermindPageContext.java:537)
    10/09/13 10:37:35 at _body._table_20_maintenance._user._jspService(user .jsp:1317)
    10/09/13 10:37:35 at com.orionserver.http.OrionHttpJspPage.service(Orio nHttpJspPage.java:57)
    10/09/13 10:37:35 at oracle.jsp.runtimev2.JspPageTable.service(JspPageT able.java:356)
    10/09/13 10:37:35 at oracle.jsp.runtimev2.JspServlet.internalService(Js pServlet.java:498)
    10/09/13 10:37:35 at oracle.jsp.runtimev2.JspServlet.service(JspServlet .java:402)
    10/09/13 10:37:35 at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
    10/09/13 10:37:35 at com.evermind.server.http.ResourceFilterChain.doFil ter(ResourceFilterChain.java:65)
    10/09/13 10:37:35 at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unkn own Source)
    10/09/13 10:37:35 at com.evermind.server.http.ServletRequestDispatcher. invoke(ServletRequestDispatcher.java:673)
    10/09/13 10:37:35 at com.evermind.server.http.ServletRequestDispatcher. forwardInternal(ServletRequestDispatcher.java:340)
    10/09/13 10:37:35 at com.evermind.server.http.ServletRequestDispatcher. forward(ServletRequestDispatcher.java:229)
    10/09/13 10:37:35 at pckgRefund.servlets.tableMaintenance.userServ.doPo st(userServ.java:1044)
    10/09/13 10:37:35 at javax.servlet.http.HttpServlet.service(HttpServlet .java:760)
    10/09/13 10:37:35 at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
    10/09/13 10:37:35 at com.evermind.server.http.ResourceFilterChain.doFil ter(ResourceFilterChain.java:65)
    10/09/13 10:37:35 at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unkn own Source)
    10/09/13 10:37:35 at com.evermind.server.http.ServletRequestDispatcher. invoke(ServletRequestDispatcher.java:673)
    10/09/13 10:37:35 at com.evermind.server.http.ServletRequestDispatcher. forwardInternal(ServletRequestDispatcher.java:340)
    10/09/13 10:37:35 at com.evermind.server.http.HttpRequestHandler.proces sRequest(HttpRequestHandler.java:830)
    10/09/13 10:37:35 at com.evermind.server.http.HttpRequestHandler.run(Ht tpRequestHandler.java:285)
    10/09/13 10:37:35 at com.evermind.server.http.HttpRequestHandler.run(Ht tpRequestHandler.java:126)
    10/09/13 10:37:35 at com.evermind.util.ReleasableResourcePooledExecutor $MyWorker.run(ReleasableResourcePooledExecutor.jav a:192)
    10/09/13 10:37:35 at java.lang.Thread.run(Thread.java:534)



    This is the line where the error occurs in my servlet:
    getServletConfig().getServletContext().getRequestD ispatcher("/Body/Table Maintenance/user.jsp").forward(request,response);

    My user.jsp page has a lot of out.println statements.

    I hope somebody can help me with this.
    Thanks in advance!

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    Looks to me like you've already started writing to the response stream by the time you get to this forward.

  3. #3
    jctet is offline Member
    Join Date
    Sep 2010
    Posts
    5
    Rep Power
    0

    Default

    Thanks Tolls for taking time to answer my query.
    How do I know if I'm already writing to the response stream?
    My code has always been like this and I never had a problem until recently, after an enhancement.
    And this only happens after a series of server-side form validation

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    Quote Originally Posted by jctet View Post
    Thanks Tolls for taking time to answer my query.
    How do I know if I'm already writing to the response stream?
    Well, you get that error for a start.
    That's no joke actually...

    Quote Originally Posted by jctet View Post
    My code has always been like this and I never had a problem until recently, after an enhancement.
    And this only happens after a series of server-side form validation
    Well, that enhancement seems to have resulted in the response being started (or grabbed anyway). You avoid this by handling responses in one place.

    You may not even be writing at this point, you (or part of your framework) may simply have done the getResponseStream() call, and not yet sent anything.

  5. #5
    jctet is offline Member
    Join Date
    Sep 2010
    Posts
    5
    Rep Power
    0

    Default

    Does this mean I will not be able to find any solution for my problem? :(

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    Well, you should be able to.
    Look at what the enhancement was, and debug around that.

    Debug your code...

  7. #7
    jctet is offline Member
    Join Date
    Sep 2010
    Posts
    5
    Rep Power
    0

    Default

    Is there anything I should watch out for? I'm sorry if i sound so ignorant. This error is so new to me :o

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    Something opening an error stream?
    Something sending html strings using an output stream?

    Another forward prior to this one?
    Possibly a redirect (not sure how that would work, to be fair)?

    Basically anything which could have started sending stuff back to the browser.

  9. #9
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    843
    Rep Power
    6

    Default

    Just check before or after the below line you have println statements.

    getServletConfig().getServletContext().getRequestD ispatcher("/Body/Table Maintenance/user.jsp").forward(request,response);
    If yes then try to comment out the print statement and try.
    Ramya:cool:

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    I think you need to point out that any println() calls have to be for the response stream, not just any old stream.

  11. #11
    jctet is offline Member
    Join Date
    Sep 2010
    Posts
    5
    Rep Power
    0

    Default

    Thank you, RamyaSivakanth, for taking time to answer :)
    Is there a maximum number of out.println allowed? I tried using the old version of the jsp and I did not encounter the error. Then, I tried adding bits and pieces of the enhancement and it seems to work until I have added half of the additional codes. Even a single line of space added would cause the error. I'm really going out of my mind now :eek:

  12. #12
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    The thing is it isn't getting to the jsp if the root of the exception is from that forward call that you showed earlier.

    Either that or whatever you're using gives rubbish exceptions (which is always a possibility).

  13. #13
    chimanet is offline Member
    Join Date
    Jun 2010
    Posts
    5
    Rep Power
    0

    Default

    u need to check whether response has been commited before you forward to the jsp page

Similar Threads

  1. Replies: 5
    Last Post: 03-17-2011, 03:26 PM
  2. GUI with java.lang.IllegalStateException
    By eckt in forum AWT / Swing
    Replies: 4
    Last Post: 06-14-2010, 11:32 AM
  3. Replies: 2
    Last Post: 12-14-2009, 02:46 AM
  4. Replies: 13
    Last Post: 09-07-2009, 05:32 PM
  5. Replies: 2
    Last Post: 05-28-2009, 06:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •