1 Reply Latest reply on Apr 24, 2009 2:28 AM by rmemoria.ricardo.rmemoria.com.br

    Trying to register logout when session is finished

    rmemoria.ricardo.rmemoria.com.br

      I'm using SEAM 2.1.1.GA with JBOSS 4.2.3.GA.


      I have the following method to be called when the the user session is destroyed:



          /**
           * Logout the current user 
           */
          @Observer("org.jboss.seam.preDestroyContext.SESSION")
          @Transactional
          public void logout() {
               if (userLogin != null)
                  System.out.println("LOGOUT OF " + userLogin.getUser().getLogin());
               else System.out.println("LOGOUT");
      
               onlineUsers.remove(userLogin);
              registerLogout();
          }




      Buf the method is never called. Checking the jboss log I see the following error registered:



      2009-04-22 10:04:07,826 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/mdrtb]] Session event listener threw exception
      java.lang.IllegalStateException: Please end the HttpSession via org.jboss.seam.web.Session.instance().invalidate()
           at org.jboss.seam.contexts.Lifecycle.endSession(Lifecycle.java:239)
           at org.jboss.seam.contexts.ServletLifecycle.endSession(ServletLifecycle.java:146)
           at org.jboss.seam.servlet.SeamListener.sessionDestroyed(SeamListener.java:58)
           at org.apache.catalina.session.StandardSession.expire(StandardSession.java:702)
           at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:592)
           at org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:681)
           at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:666)
           at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1315)
           at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1600)
           at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1609)
           at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1609)
           at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1589)
           at java.lang.Thread.run(Thread.java:619)
      




      Any tip about mapping the end session event or about this error?


      Cheers,
      Ricardo