[jboss-user] [JBoss Seam] - Sometime seam listener does not work correctly...

xinhua do-not-reply at jboss.com
Wed Jun 13 12:31:28 EDT 2007


hi,all
i use Seam 1.2.1GA security and event listener to trigger logout() from authenticator when user session is time out. But it didnot work sometime.

Here is my configuration in components.xml

  | 	<event type="org.jboss.seam.preDestroyContext.SESSION">
  | 		<action expression="#{authenticator.logout}" />
  | 	</event>
  | 

authenticator:

  | @Stateless
  | @Name("authenticator")
  | public class AuthenticatorBean implements Authenticator{
  | 
  |     @In
  |     private Identity identity;
  |     @In
  |     private FacesMessages facesMessages;
  |     
  |     @Logger
  |     private Log log;
  |     
  | 	public boolean authenticate() {
  | 		String username = identity.getUsername();
  | 		String password = identity.getPassword();
  | 		
  | 		
  | 		if(username.equalsIgnoreCase("xinhua")){
  | 			return true;
  | 			
  | 		}else{
  | 			facesMessages.addFromResourceBundle("loginForm_loginFailed");
  | 			return false;	
  | 		}
  | 		
  | 		
  | 	}
  | 
  | 	public void logout() {
  | 		log.info("logout(): user "+identity.getUsername()+" logout");
  | 		identity.logout();
  | 	}
  | 
  | }
  | 
When user session is out of time, a null exception appears sometime.And logout() is skipped...
 



  | 17:52:40,793 ERROR [[/strato]] Session event listener threw exception
  | java.lang.NullPointerException: facesContext
  |         at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:110)
  |         at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
  |         at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
  |         at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:148)
  |         at org.jboss.seam.core.Events.raiseEvent(Events.java:63)
  |         at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:215)
  |         at org.jboss.seam.contexts.Lifecycle.endSession(Lifecycle.java:297)
  |         at org.jboss.seam.servlet.SeamListener.sessionDestroyed(SeamListener.java:45)
  |         at org.apache.catalina.session.StandardSession.expire(StandardSession.java:687)
  |         at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:579)
  |         at org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:678)
  |         at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:663)
  |         at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1284)
  |         at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569)
  |         at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
  |         at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
  |         at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558)
  |         at java.lang.Thread.run(Thread.java:595)
  | 17:52:49,059 INFO  [Lifecycle] starting up: org.jboss.seam.security.identity
  | 17:54:40,891 ERROR [[/strato]] Session event listener threw exception
  | java.lang.IllegalStateException: Please end the HttpSession via Seam.invalidateSession()
  |         at org.jboss.seam.contexts.Lifecycle.endSession(Lifecycle.java:269)
  |         at org.jboss.seam.servlet.SeamListener.sessionDestroyed(SeamListener.java:45)
  |         at org.apache.catalina.session.StandardSession.expire(StandardSession.java:687)
  |         at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:579)
  |         at org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:678)
  |         at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:663)
  |         at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1284)
  |         at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569)
  |         at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
  |         at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
  |         at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558)
  |         at java.lang.Thread.run(Thread.java:595)
  | 

the listener is not stable when sessionDestroyed. :(

anyone can tell me why?

thanks!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4054062#4054062

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4054062



More information about the jboss-user mailing list