?
Solved

How to find active session in tomcat?

Posted on 2014-12-09
4
Medium Priority
?
3,599 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 1500 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

Give Your Engineering Team a Productivity Boost

Learn why container technology is so powerful and how it can provide your team with productivity gains and other benefits.

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses
Course of the Month13 days, 9 hours left to enroll

801 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