Monday, January 30, 2012

Java Web App in Tomcat Dropping Sessions

Want to integrate charts into your webapp? Check out XChart.

Here's another nano-blog that will hopefully help someone solve an problem that I was dealing with today:


I upgraded Tomcat from 7.0.22 to 7.0.25 and my web application starting closing or dropping the session that was being created during a user login operation. I also noticed in my log files, which tracks sessions being created and closed that tons of sessions were being created at once.


I'm not sure why this helps or why the problem suddenly appeared in a new release of Tomcat, but what I ended up doing to solve the problem was to add <%@ page session="false" %> to all my JSP files. Apparently for each JSP file, a session is otherwise created. In my web app I have several JSPs nested inside of other JSPs, which was probably causing all the sessions to be created. Why that was never an issue before, I'm not quite sure.

I hope that helps someone!

No comments: