DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3973>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3973

session.getAttribute() locks-up in HttpSessionListener.sessionDestroyed() 

           Summary: session.getAttribute() locks-up in
                    HttpSessionListener.sessionDestroyed()
           Product: Tomcat 4
           Version: 4.0 Final
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Webapps
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I'm noticing some strange behaviour with a class that implements
HttpSessionListener and is registered in webapp.xml file.

When I call session.getAttribute("xxx") on a session passed into
sessionDestroyed() the thread seems to lock. No exceptions are thrown. 

I'm running tomcat 4.0 final on windows 2k. I've received the same
results on both jdk 1.3.1 and 1.4 beta.

I've simplified my class as a test case and it never makes it to the
System.out.println("attribute shown") statement.

To create and destroy the session i used two jsp pages: 

populateSession.jsp
invalidateSession.jsp 

one sets a value in the session, another
calls session.invalidate().

output from stdout.log and class definition are included bellow.

stdout.log
----
Create Catalina server
Starting service Tomcat-Standalone
Apache Tomcat/4.0
ServletContext Initialized
Starting service Tomcat-Apache
Apache Tomcat/4.0
Session Created <!-- click on populateSession.jsp -->
attribute added
Session Destroyed <!-- click on invalidateSession.jsp -->
     <!-- execution stops before showing attribute value -->
----

import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class LoggingController implements ServletContextListener,
HttpSessionListener
{

public LoggingController()
{
 // System.out.println("LoggingController constructed");
}

public void contextInitialized(ServletContextEvent sce)
{
        System.out.println("ServletContext Initialized");
}

public void contextDestroyed(ServletContextEvent sce)
{
        System.out.println("ServletContext Destroyed");
}

public void sessionCreated(HttpSessionEvent hse)
{
 System.out.println("Session Created");

 HttpSession session = hse.getSession();
 session.setAttribute("name", "scott");

 // execution makes it here ok
 System.out.println("attribute added");
}


public void sessionDestroyed(HttpSessionEvent hse)
{
 System.out.println("Session Destroyed");

 HttpSession session = hse.getSession();

 // seems to hang up on the following line
 System.out.println(session.getAttribute("name"));

 System.out.println("attribute shown");
 }
}

Reply via email to