3 Replies Latest reply on May 4, 2010 12:21 AM by Richard Kennard

    Security Context is null in sessionDestroyed

    Maik Lehradt Newbie

      We are using a javax.servlet.HttpSessionListener to clean up session data after a session timeout or if a user quits his session. In this listener an EJB 3.0 SLSB is called. Everything works fine if a user clicks the log out button. The SLSB is called and does its job. But with no user interaction (i.e. a session timeout), an exception is thrown whenever an EJB is called.

       

      14:33:00,220 DEBUG [SessionListener] Session destroyed 8F8B26D11F14A00A281D7EF56ED9371B
      14:33:00,220 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/xxx]] Session event listener threw exception
      java.lang.IllegalStateException: Local Call: Security Context is null
          at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:109)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
          at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:176)
          at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:216)
          at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
          at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
          at $Proxy1580.isLoggedIn(Unknown Source)
          at xxx.PrincipalService.isLoggedIn(ArgosPrincipalService.java:156)
          at xxx.SlidingPlanJanitor.cleanUp(SlidingPlanJanitor.java:57)
          at xxx.SessionListener.cleanUpAfterSessionTimeout(SessionListener.java:94)
          at xxx.SessionListener.sessionDestroyed(SessionListener.java:61)

       

      We used this listener for a while in JBoss 4.2.3.GA, but with JBoss 5.1.0.GA it doesn't work anymore.