Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 83431 invoked from network); 2 Oct 2003 20:49:37 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 2 Oct 2003 20:49:37 -0000 Received: (qmail 83992 invoked by uid 500); 2 Oct 2003 20:49:02 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 83717 invoked by uid 500); 2 Oct 2003 20:49:01 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 83704 invoked from network); 2 Oct 2003 20:49:00 -0000 Received: from unknown (HELO usryim00.merck.com) (155.91.6.20) by daedalus.apache.org with SMTP; 2 Oct 2003 20:49:00 -0000 Received: from 155.91.2.6 by usryim00.merck.com with ESMTP (SMTP Relay ( MMS v5.5.3)); Thu, 02 Oct 2003 16:48:59 -0400 Received: from usrygw04.Merck.Com (usrygw04.merck.com [54.3.102.185]) by mmh1.merck.com (PMDF V6.0-24 #37353) with ESMTP id <01L1CX9Q3F780025AU@mmh1.merck.com> for tomcat-user@jakarta.apache.org; Thu, 02 Oct 2003 15:48:55 -0500 (EST) Received: by usrygw04.merck.com with Internet Mail Service (5.5.2656.59) id ; Thu, 02 Oct 2003 16:48:55 -0400 Content-return: allowed Date: Thu, 02 Oct 2003 16:48:52 -0400 From: "Simha, Kailas" Subject: RE: Accessing Sessions in the container To: "'Tomcat Users List'" Message-ID: MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) X-WSS-ID: 136250B04274057-02-01 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Filip, I will go with option 1 (how else would I get familiar :)). Thanks for all your help! Will come back for more ! Kailas Enterprise Web Infrastructure -----Original Message----- From: Filip Hanik [mailto:devlists@hanik.com] Sent: Thursday, October 02, 2003 4:42 PM To: Tomcat Users List Subject: Re: Accessing Sessions in the container the code is in the wrong place: if you don't know what a valve is, you have two options: 1. Read up on it, and configure a valve in server.xml 2. Skip this solution all together (recommended since you are not familiar with tomcat internals) and go with Yoav's suggestion Filip ----- Original Message ----- From: "Simha, Kailas" To: "'Tomcat Users List'" Sent: Thursday, October 02, 2003 1:37 PM Subject: RE: Accessing Sessions in the container Oops ! Here it is: 98:org.apache.catalina.HttpRequest req = (org.apache.catalina.HttpRequest)request; 99: System.out.println("after the catalina request"); 100: StandardManager manager = (StandardManager)req.getContext().getManager(); 101: Session[] sessions = manager.findSessions(); 102: 103: for(int i=0; i To: "'Tomcat Users List'" Sent: Thursday, October 02, 2003 1:22 PM Subject: RE: Accessing Sessions in the container I am sorry. How do I get the 'real' stack trace? Thanks for being patient ! Kailas Enterprise Web Infrastructure -----Original Message----- From: Filip Hanik [mailto:devlists@hanik.com] Sent: Thursday, October 02, 2003 3:59 PM To: Tomcat Users List Subject: Re: Accessing Sessions in the container ok, get us the real stack trace, this one shows a classcast exception in your code, not in the valve MyServlet.java:98, hence you have not showed us this code before Filip ----- Original Message ----- From: "Simha, Kailas" To: "'Tomcat Users List'" Sent: Thursday, October 02, 2003 12:54 PM Subject: RE: Accessing Sessions in the container Here is the error snippet: type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception java.lang.ClassCastException at org.apache.catalina.servlets.MyServlet.doGet(MyServlet.java:98) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok eNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:191) ................. Thanks ! Kailas Enterprise Web Infrastructure -----Original Message----- From: Filip Hanik [mailto:devlists@hanik.com] Sent: Thursday, October 02, 2003 3:52 PM To: Tomcat Users List Subject: Re: Accessing Sessions in the container what does your error say? ----- Original Message ----- From: "Simha, Kailas" To: "'Tomcat Users List'" Sent: Thursday, October 02, 2003 12:47 PM Subject: RE: Accessing Sessions in the container Well, I have it in the import. But here is the code snippet. Am I doing anything wrong here? Thanks a lot for your help ! public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { org.apache.catalina.HttpRequest req = (org.apache.catalina.HttpRequest)request; StandardManager manager = (StandardManager)req.getContext().getManager(); Session[] sessions = manager.findSessions(); } Kailas Enterprise Web Infrastructure -----Original Message----- From: Filip Hanik [mailto:devlists@hanik.com] Sent: Thursday, October 02, 2003 3:43 PM To: Tomcat Users List Subject: Re: Accessing Sessions in the container import org.apache.catalina.Session; that is the Session you will be getting back from findSessions ----- Original Message ----- From: "Simha, Kailas" To: "'Tomcat Users List'" Sent: Thursday, October 02, 2003 12:32 PM Subject: RE: Accessing Sessions in the container This gives me a class cast exception when running ! Thanks ! Kailas Enterprise Web Infrastructure -----Original Message----- From: Filip Hanik [mailto:devlists@hanik.com] Sent: Thursday, October 02, 2003 3:05 PM To: Tomcat Users List Subject: Re: Accessing Sessions in the container put a Valve in your context and you can do all kinds of things there on the invoke you can do StandardManager manager = (StandardManager)request.getContext().getManager(); Session[] sessions = manager.findSessions(); the valve if configured only to one context to so you will only get one manager, ie one webapp Filip ----- Original Message ----- From: "Tim Funk" To: "Tomcat Users List" Sent: Thursday, October 02, 2003 11:56 AM Subject: Re: Accessing Sessions in the container But that restriction can be bypssed by creating a SessionListener to store these sessions yourself in ServletContext scope. Search the archive for more info about this. Doing so can also easily create a memory leak if one is not careful. -Tim Filip Hanik wrote: > prohibited by spec > > Filip > > ----- Original Message ----- > From: "Simha, Kailas" > To: "'Tomcat Users List'" > Sent: Thursday, October 02, 2003 11:50 AM > Subject: Accessing Sessions in the container > > > Hi all, > How would I be able to access/list all the sessions running on a > JVM/Container? Any sample code would be delightfully welcome! Thanks > in advance, Kailas > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > > --------------------------------------------------------------------- > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org