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" <[EMAIL PROTECTED]>
To: "'Tomcat Users List'" <[EMAIL PROTECTED]>
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:[EMAIL PROTECTED]
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" <[EMAIL PROTECTED]>
To: "'Tomcat Users List'" <[EMAIL PROTECTED]>
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:[EMAIL PROTECTED]
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" <[EMAIL PROTECTED]>
To: "'Tomcat Users List'" <[EMAIL PROTECTED]>
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:[EMAIL PROTECTED]
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" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
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" <[EMAIL PROTECTED]>
> To: "'Tomcat Users List'" <[EMAIL PROTECTED]>
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to