Solved

How to find active session in tomcat?

Posted on 2014-12-09
4
3,290 Views
Last Modified: 2014-12-26
I am running tomcat server with a java application. We are using spring for session management, I would like to know how can I find the active session?
0
Comment
Question by:beer9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 36

Expert Comment

by:mccarl
ID: 40490143
how can I find the active session?
What do you mean by "the active session" ?  There is no concept of any one session being active. Did you mean to ask... "how can I find all the currently active sessions?"

Secondly, can you tell us if you are trying to do this from within the Java application that is running on Tomcat or from some application/tool external to the running Tomcat instance?
0
 

Author Comment

by:beer9
ID: 40490380
My query is 'how can I find all the currently active sessions?' :-) so that when there are minimal user 'logged-in' then I can restart my application to fix something.

I have root level access to tomcat, if there is any tool which can help me get this info then I really appreciate it :-)
0
 
LVL 36

Accepted Solution

by:
mccarl earned 500 total points
ID: 40490439
Does your tomcat installation still have the "manager" webapp that comes in the standard distribution? (Look in tomcat's webapps folder to see if there is a "manager" folder) If so, then you already have your tool to view active sessions. Access to the manager app is disabled by default, but you just need to add your own username/password with the correct role (probably "manager-gui" role) to Tomcat. For the procedure and a bit more background on the configuration, refer here...

http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html

Once logged in, the very first page that you are presented with will give you the information that you require. Here is an example screenshot showing a list of applications configured for the Tomcat instance, and for each one it shows the number of sessions.

Now that should fulfil what you have asked for above, but you can go further if you wished. By clicking on the link for your particular application, you can actually list all the sessions and even see some/all of the data associated with each session. You may be able to use this to actually find usernames of the people that own each session, say if you wanted to contact them to tell them that the app will be restarted.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question