I found problem/solution so I want share it. The problem was with image chart servlet that was using
javax.imageio.ImageWriter which was associated directly to response.outputstream in rare cases, when ClientAbortException happening, the response's outputstream was not closing properly and, since tomcat recycles responses, it was server to the next cycle. Once request/response was getting processed, ImageWriter(I think) was finally releasing it and causing to go to commited state. The solution that I used is to use temporary byteinputstream and have imagewriter write to it and then write out byteinputstream to response. The clue to find all these was to search every where in the code where response's outputstream was being used. As expected, stripes had nothing to do with it :) -----Original Message----- From: Leonard Gestrin [mailto:[email protected]] Sent: Tuesday, April 07, 2009 5:35 PM To: Stripes Users List Subject: Re: [Stripes-users] java.lang.IllegalStateException: Cannot create a session after the response has been committed at org.apache.catalina.connector.Request.doGetSession(Request.java:2214 ) One thing I did recently that might have some relationship to it, is that I put StripesFilter ahead of SecurityFilter; I looked at the code of stripesFilter, and I can see that it sets Locale and CharacterEncoding on the response object before passing control to the chain. Could that potentially be a problem? The worst thing is that this problem happens on random pages and the only the code on the stack at the time is StripesFilter + SecurityFilter. -----Original Message----- From: Leonard Gestrin [mailto:[email protected]] Sent: Monday, April 06, 2009 10:06 AM To: Stripes Users List Subject: Re: [Stripes-users] java.lang.IllegalStateException: Cannot create a session after the response has been committed at org.apache.catalina.connector.Request.doGetSession(Request.java:2214 ) Hi Oscar, Thanks for replying. SecurityFilter is second filter in the request. StripesFilter is the first one. The session is accessed in doFilter() method. My theory is that, since tomcat reuses request/response objects, somewhere in the app, some action does something to the object(s), which causes it to not get recycled properly and the next client request becomes the victim of it. -----Original Message----- From: Oscar Westra van Holthe - Kind [mailto:[email protected]] Sent: Sunday, April 05, 2009 8:52 AM To: Stripes Users List Subject: Re: [Stripes-users] java.lang.IllegalStateException: Cannot create a session after the response has been committed at org.apache.catalina.connector.Request.doGetSession(Request.java:2214 ) Hi Leonard, It seems to me the response object is used before you create a session. So some things to check are: - Where in the request handling is your security filter located? - When is the session accessed? After the call to doFilter()? To prevent this exception, ensure the session is created & added to the response before anything is written to the response. Preferably in the first filter, before the call to doFilter(). This way the cookie header with the JSESSIONID cookie is added before the response is written to, as writing to the response commits the response. Oscar -- ,-_ /() ) Oscar Westra van holthe - Kind http://www.xs4all.nl/~kindop/ (__ ( =/ () QED - Quite Easily Done ------------------------------------------------------------------------------ _______________________________________________ Stripes-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/stripes-users ------------------------------------------------------------------------------ This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com _______________________________________________ Stripes-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/stripes-users ------------------------------------------------------------------------------ This SF.net email is sponsored by: High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now! http://p.sf.net/sfu/www-ibm-com _______________________________________________ Stripes-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/stripes-users ------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p _______________________________________________ Stripes-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/stripes-users
