My favourite tips&tricks for the Best, Kick-Arse java IDE "IntelliJ IDEA".

Wednesday, June 22, 2005

Tip 6: Resin Session Expires on Build

Quick-Fix:
uncheck: settings->paths->J2EE build settings->Synchronize exploded directory

Understanding:
One of the fustrating experiences i had with IDEA for couple of days was that when ever i compiled code (even when everything was complied) my session expired in my application running on resin server.

Yes my project was configured as a web-application which gets automatically deployed when i compile. (i.e. output paths in IDEA pointed to "[RESIN_HOME]/webapps/[app-context]" folder).

This scene occurs when resin is configured to use the file system for session persistence(i cant go into the details of how it is done, maybe sometime later) and sessions are configured to persist somewhere within the application context folder. e.g.
"[RESIN_HOME]/webapps/[app-context]/WEB-INF/sessions".
So what happens is when ever we compile, IDEA tries to synchronise its project files with the deployement directory. Which basically means
1. It will copy everything configured in project to the deployement directory.
2. It will delete everything thats not configured in project but still present in deployment directory(e.g. persistent sessions stored inside deployment directory)

and so session expires, cause session files are deleted by IDEA. The behaviour exibhited by IDEA as mentioned in point (2) above can be controlled by a setting "settings->paths->J2EE build settings->Synchronize exploded directory" if we uncheck it the nothing is unnecessarily deleted from deployment directory during compilation.