You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Thorsten M�ller <Th...@web.de> on 2003/09/30 11:15:50 UTC

HttpSessionListener

Hi!

I want to implement an HttpSessionListener. When will the container (Tomcat
5) call the method "sessionDestroyed(HttpSessionEvent se)". Before or after
the session was invalidated (destroyed)? I can't find any documentation
about that detail anywhere.

Thorsten




Re: HttpSessionListener

Posted by Thorsten Möller <Th...@web.de>.
Jon Wingfield <jo...@mkodo.com> wrote:
> In servlet spec version 2.4 (proposed final draft 3) the javadoc
> comments for sessionDestroyed are now:
>
> "Notification that a session is about to be invalidated."
>
> Tomcat 4.x.x implements the former spec, Tomcat 5 will implement the
> 2.4 spec.
In the meantime I tested this on Tomcat 5.0.9. But it seems that Tomcat
calls the method after it has invalidated the session. I get an exception:

14:51:34,893 INFO [ManagerBase] Session event listener threw exception
java.lang.IllegalStateException: getAttribute: Session already invalidated
at
org.apache.catalina.session.StandardSession.getAttribute(StandardSession.jav
a:982)
at
org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessi
onFacade.java:166)
at
de.jexam.web.servlet.WebUserSessionLoginManager.sessionDestroyed(WebUserSess
ionLoginManager.java:99)
at
org.apache.catalina.session.StandardSession.expire(StandardSession.java:683)
at
org.apache.catalina.session.StandardSession.expire(StandardSession.java:641)
at
org.apache.catalina.session.StandardManager.processExpires(StandardManager.j
ava:819)
at
org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.j
ava:4363)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processC
hildren(ContainerBase.java:1660)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processC
hildren(ContainerBase.java:1669)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processC
hildren(ContainerBase.java:1669)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(Cont
ainerBase.java:1649)
at java.lang.Thread.run(Thread.java:536)


If I interpret the Servlet 2.4 draft specification right than Tomcat shows a
wrong behaviour. Maybe it's time to open a bug?



Thorsten


Re: HttpSessionListener

Posted by Thorsten Möller <Th...@web.de>.
Jon Wingfield <jo...@mkodo.com> wrote:

> "Notification that a session is about to be invalidated."
> 
> Tomcat 4.x.x implements the former spec, Tomcat 5 will implement the
> 2.4 spec.
> 
> HTH,
Thanks a lot, now my nerves have steadied ;-)

Thorsten

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: HttpSessionListener

Posted by Thorsten Möller <Th...@web.de>.
Jon Wingfield <jo...@mkodo.com> wrote:

> "Notification that a session is about to be invalidated."
> 
> Tomcat 4.x.x implements the former spec, Tomcat 5 will implement the
> 2.4 spec.
> 
> HTH,
Thanks a lot, now my nerves have steadied ;-)

Thorsten

Re: HttpSessionListener

Posted by Thorsten Möller <Th...@web.de>.
Jon Wingfield <jo...@mkodo.com> wrote:
> In servlet spec version 2.4 (proposed final draft 3) the javadoc
> comments for sessionDestroyed are now:
>
> "Notification that a session is about to be invalidated."
>
> Tomcat 4.x.x implements the former spec, Tomcat 5 will implement the
> 2.4 spec.
In the meantime I tested this on Tomcat 5.0.9. But it seems that Tomcat
calls the method after it has invalidated the session. I get an exception:

14:51:34,893 INFO [ManagerBase] Session event listener threw exception
java.lang.IllegalStateException: getAttribute: Session already invalidated
at
org.apache.catalina.session.StandardSession.getAttribute(StandardSession.jav
a:982)
at
org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessi
onFacade.java:166)
at
de.jexam.web.servlet.WebUserSessionLoginManager.sessionDestroyed(WebUserSess
ionLoginManager.java:99)
at
org.apache.catalina.session.StandardSession.expire(StandardSession.java:683)
at
org.apache.catalina.session.StandardSession.expire(StandardSession.java:641)
at
org.apache.catalina.session.StandardManager.processExpires(StandardManager.j
ava:819)
at
org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.j
ava:4363)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processC
hildren(ContainerBase.java:1660)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processC
hildren(ContainerBase.java:1669)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processC
hildren(ContainerBase.java:1669)
at
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(Cont
ainerBase.java:1649)
at java.lang.Thread.run(Thread.java:536)


If I interpret the Servlet 2.4 draft specification right than Tomcat shows a
wrong behaviour. Maybe it's time to open a bug?



Thorsten


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: HttpSessionListener

Posted by Jon Wingfield <jo...@mkodo.com>.
In servlet spec version 2.3 the javadoc comments for sessionDestroyed are:

"Notification that a session was invalidated."

It's already invalidated, not always what you want :(

In servlet spec version 2.4 (proposed final draft 3) the javadoc 
comments for sessionDestroyed are now:

"Notification that a session is about to be invalidated."

Tomcat 4.x.x implements the former spec, Tomcat 5 will implement the 2.4 
spec.

HTH,

Jon

Thorsten Möller wrote:

> Hi!
> 
> I want to implement an HttpSessionListener. When will the container (Tomcat
> 5) call the method "sessionDestroyed(HttpSessionEvent se)". Before or after
> the session was invalidated (destroyed)? I can't find any documentation
> about that detail anywhere.
> 
> Thorsten
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 




Re: HttpSessionListener

Posted by Jon Wingfield <jo...@mkodo.com>.
In servlet spec version 2.3 the javadoc comments for sessionDestroyed are:

"Notification that a session was invalidated."

It's already invalidated, not always what you want :(

In servlet spec version 2.4 (proposed final draft 3) the javadoc 
comments for sessionDestroyed are now:

"Notification that a session is about to be invalidated."

Tomcat 4.x.x implements the former spec, Tomcat 5 will implement the 2.4 
spec.

HTH,

Jon

Thorsten Möller wrote:

> Hi!
> 
> I want to implement an HttpSessionListener. When will the container (Tomcat
> 5) call the method "sessionDestroyed(HttpSessionEvent se)". Before or after
> the session was invalidated (destroyed)? I can't find any documentation
> about that detail anywhere.
> 
> Thorsten
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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


Re: tomcat and virtual hosts

Posted by John Turner <to...@johnturner.com>.
<Host name="www.site1.com" appBase="/export/home/webroot/site1">
    ....
    <Context path="" docBase="/export/home/webroot/site1/ROOT">
    ....
    </Context>
</Host>

Better yet, make the Context docBase = "ROOT" so it is relative to the 
Host's appBase.

Put JSP in /export/home/webroot/site1/ROOT.  Put WEB-INF in the same 
location.  Do the same for site 2.

John

Johan Louwers wrote:

>I have set up tomcat and apache... bind them with a JK2 connector both on
>port 80. I have 2 domains running on the machine. I made the virtual hosts
>work in apache with editting httpd.conf  The apache docs are located on the
>following location:
>
>/export/home/webroot/site1     (www.site1.com)
>/export/home/webroot/site2     (www.site2.com)
>
>I would like to access jsp files on both the website's like
>www.site1.com/index.jsp and www.site2.com/index.jsp and store the jsp files
>at the same location as the html docs. This means locate them in
>/export/home/webroot/site1 and /export/home/webroot/site2
>
>How do I make tomcat understeand that it must be running jsp files on this
>locations. Anybody knows how to do this? You have to add some things to
>server.xml i know that buth what and do  have to edit httpd.conf in some way
>to make this work? A working example of a server.xml/httpd.conf file is
>welcome and also any tip hint and clue :-)
>
>Thanks already,
>Johan.
>
>
>---------------------------------------------------------------------
>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


tomcat and virtual hosts

Posted by Johan Louwers <Su...@dds.nl>.
I have set up tomcat and apache... bind them with a JK2 connector both on
port 80. I have 2 domains running on the machine. I made the virtual hosts
work in apache with editting httpd.conf  The apache docs are located on the
following location:

/export/home/webroot/site1     (www.site1.com)
/export/home/webroot/site2     (www.site2.com)

I would like to access jsp files on both the website's like
www.site1.com/index.jsp and www.site2.com/index.jsp and store the jsp files
at the same location as the html docs. This means locate them in
/export/home/webroot/site1 and /export/home/webroot/site2

How do I make tomcat understeand that it must be running jsp files on this
locations. Anybody knows how to do this? You have to add some things to
server.xml i know that buth what and do  have to edit httpd.conf in some way
to make this work? A working example of a server.xml/httpd.conf file is
welcome and also any tip hint and clue :-)

Thanks already,
Johan.


tomcat and virtual hosts

Posted by Johan Louwers <Su...@dds.nl>.
I have set up tomcat and apache... bind them with a JK2 connector both on
port 80. I have 2 domains running on the machine. I made the virtual hosts
work in apache with editting httpd.conf  The apache docs are located on the
following location:

/export/home/webroot/site1     (www.site1.com)
/export/home/webroot/site2     (www.site2.com)

I would like to access jsp files on both the website's like
www.site1.com/index.jsp and www.site2.com/index.jsp and store the jsp files
at the same location as the html docs. This means locate them in
/export/home/webroot/site1 and /export/home/webroot/site2

How do I make tomcat understeand that it must be running jsp files on this
locations. Anybody knows how to do this? You have to add some things to
server.xml i know that buth what and do  have to edit httpd.conf in some way
to make this work? A working example of a server.xml/httpd.conf file is
welcome and also any tip hint and clue :-)

Thanks already,
Johan.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org