问题
I'm having this weird problem with one of the pages of my application. It's throwing the error I mention on the title:
PWC3999: Cannot create a session after the response has been committed
I've checked other posts regarding this subject, but I don't see anything that applies to this situation, because no new Servlet/Filter was added to the application and the error just started after some minor changes on the javascript of the xhtml file. If I delete any line the error stops showing. At first I believed that it could be some problem with the buffer size and increased the values (10x bigger, just to make sure), but that didn't solved the problem.
And, to be honest, I don't think this is related to the size of the file, because it used to be bigger and it worked without any problems.
I also checked and couldn't find any forward/redirect being called for this case.
Can someone help me with this?
Kind regards,
Carlos Ferreira
EDIT: This error occurs with GF v3.1, but it doesn't occur on GF v3.0.1, can it be a bug with the facelets implementation?
回答1:
You're writing JS code in a XHTML file? Most likely the edited JS code contained a XML syntax error which caused a XML parsing exception which in turn forced the container to display a HTTP 500 error page (most probably a custom one for which a session needs to be created), but which failed because the response has already been committed. This is the best scenario I can think about based on the as far given information. In the future questions, please add the entire stacktrace. It contains the answer.
Regardless of the root cause, you need to put JS code in its own JS file which you include by <script src>
. The JS language contains several operators which are special characters in XML like &
, <
and so on, which you would need to XML-escape or wrap in CDATA. But that's plain ugly.
回答2:
I had the same problem, when I add an extra button without id that exception appear in the log, but when I add the id to the new button the exception disappear. Try putting the id's to the components wich generate the error.
回答3:
I have to deal with this error myself, but I notice it happens when I test this module alone, starting all my webapp proyect and then trying the module itself prevent that error.
Maybe you wanna try that!
来源:https://stackoverflow.com/questions/5540695/pwc3999-cannot-create-a-session-after-the-response-has-been-committed