views:

762

answers:

4

I'm working on a web application using Spring MVC 2.5. I'm using Eclipse as my IDE and deploying to Tomcat 6.

I'm concerned that I don't understand how sessions work in Spring, and was wondering how I might go about monitoring session status. I know that Tomcat has various monitoring capabilities, and I can even turn them on in Eclipse...but I don't know how they work. I also think that I might be able to use the Tomcat manager application, but it doesn't seem to be running.

Anyhow, I don't want to spend the next two days configuring this. Can someone point me at a simple setup to do monitor sessions?

+2  A: 

Have a look at Lambda Probe

kgiannakakis
I'm using Tomcat from within Eclipse. I'm not sure what the deployment / startup method is called, but it's not exactly the same as just running Tomcat standalone. For instance, other installed applications don't run when I start Tomcat via Eclipse. Can you suggest a better configuration or a different tool that doesn't run on Tomcat itself?
Boden
@kgiannakakis, very interesting looking, +1.
James McMahon
+1  A: 

The Tomcat Manager is the simplest way in all reality. Unless you have some custom tomcat installation, the manager is always running if tomcat is.

Gandalf
It doesn't appear to be running when I start Tomcat from Eclipse. I can see the manager in webapps, but cannot connect.
Boden
do other applications in the webapps directory work?
Gandalf
No, when I start and stop via Eclipse it only loads the context for my project.
Boden
+1  A: 

SpringSource (Spring Framework/Rod Johnson guys) has a version of tomcat where they have put all the additional instrumentation into Tomcat

http://www.springsource.com/products/tcserver

SpringSource tc Server™ is an enterprise version of Apache Tomcat, the widely used web application server. SpringSource tc Server is hardened for enterprise use and is coupled with key operational capabilities, advanced diagnostics and is backed by mission-critical support.

Brian
+1  A: 

It depends on what you want to see in the session.

If you're interested in what objects are put into the session then I would add a breakpoints on session.get/set/removeAttribute and then debug. You can also add a HttpSessionListener and set breakpoints or log when the session is created/destroyed.

Another way to go is to add opensymphony/clickstream (just a jar and some jsp:s, not a separate webapp). This way you can monitor all activity (clickpaths) for each session. It's easy to modify to also show all session attributes. (google opensymphony clickstream)

D. Wroblewski