Logout/Invalidate Session Problem with 1.7.0 RC1
[Logo]
ICEsoft.org Forums: ICEfaces, ICEmobile, ICEpdf
[Search] Search   [Recent Topics] Recent Topics   [Groups] Home Page | www.icesoft.org  [Login] Login 
Logout/Invalidate Session Problem with 1.7.0 RC1  XML
Forum Index -> Development Build Feedback Go to Page: 1, 2 Next 
Author Message
ernie

Joined: 22/10/2007 00:00:00
Messages: 39
Offline


I am currently working on a new project where we are using ICEfaces/Facelets and have encountered a problem.

We have login authentication and logout functionality. Currently, I use a ice:commandLink action to log the logout request and the navigation outcome redirects to a simple .JSP page, where I invalidate the current session and redirect to a login page. Testing with 1.6.1, 1.6.2, and 1.7.0 DR2, this all worked without a problem.

Now, using 1.7.0 RC1, when I logout, the sequence of events is still the same, but often, if I then try to enter a user/password and click on my login button, the browser (IE6 on XP Pro SP2) simply stalls. Nothing is logged, during this period, but eventually, after a long while, the browser responds and continues. I cannot even close the browser window by clicking on the close button.

Sometimes, I can logoff and log right back in, but as I am navigating through my web app, the browser stalls again, with nothing logged during this period. After some time, the browser recovers and continues.

At this time, I see the following in the log files:

2008-03-26 12:38:42,573|ERROR|| java.lang.IllegalStateException: getAttributeNames: Session already invalidated (com.icesoft.faces.webapp.http.servlet.SessionDispatcher)
2008-03-26 12:38:45,573|INFO || Session already invalidated. (com.icesoft.faces.webapp.http.servlet.SessionDispatcher)
2008-03-26 12:38:51,042|INFO || SecurityFilter (93BC8F96DE17483FB616D85701D817D7): /main/ta_main.faces (dps.adm.ta.tams.filter.SecurityCheckFilter)
2008-03-26 12:38:52,573|ERROR|| java.lang.IllegalStateException: getAttributeNames: Session already invalidated (com.icesoft.faces.webapp.http.servlet.SessionDispatcher)
2008-03-26 12:38:52,573|ERROR|| java.lang.IllegalStateException: getAttributeNames: Session already invalidated (com.icesoft.faces.webapp.http.servlet.SessionDispatcher)
2008-03-26 12:38:55,589|INFO || Session already invalidated. (com.icesoft.faces.webapp.http.servlet.SessionDispatcher)
2008-03-26 12:38:55,589|INFO || Session already invalidated. (com.icesoft.faces.webapp.http.servlet.SessionDispatcher)

I tried simply using an ice:outputLink tag to redirect the user to the logout page, but see the same problem.

Edit: Need to mention that I am using Tomcat 5.5.26 as the application server, Java 1.5.0_b14, MyEclipse IDE, debug mode. When the browser stalls, I am still able to launch a new browser login using a new session, so the Tomcat 5.5.26 server is still responding.
ken.fyten

Joined: 26/10/2004 00:00:00
Messages: 852
Offline


Hello,

The stalling issue is likely related to this bug in 1.7 RC1 which is now resolved: ICE-2895.

If possible, try the latest SVN trunk code to see if that resolves your issue.

Regards,
Ken

Ken Fyten
VP Product Development
ICEsoft Technologies, Inc.
ernie

Joined: 22/10/2007 00:00:00
Messages: 39
Offline


Appreciate the feedback, and yes, it does appear that the the latest trunk (revision 16158) resolved my issue.

Baleyba

Joined: 16/11/2006 00:00:00
Messages: 110
Offline


I have the same problem.

I used the last revision 16158. It is better but it isn't solved entirely.

If you refresh the .jsp page, the "session.invalidate" causes an exception.

Code:
 <html>
  <head>
      <title></title>
  </head>
  <body>
  <% if(session.getAttribute("LoggedIn")=="true"){ %>
      <jsp:forward page="webmail.iface" />
  <% }else{
      session.invalidate();%>
      <jsp:forward page="login.iface" />
  <% } %>
  </body>
  </html>
 


regards
Bal.

JBoss 4.2.3 | Java 1.6.0_16 | IceFaces 1.8.2
mircea.toma

Joined: 10/02/2005 00:00:00
Messages: 307
Offline


The session needs to be invalidated within the JSF environment. You can use an action listener tied to a navigation rule that redirects to login page. Also, the action listener would invalidate the session acquired from the ExternalContext.
With 1.7 release will put up an example on how to do a login/logout process with JSF/ICEfaces.
[Email]
dabek

Joined: 19/03/2007 00:00:00
Messages: 20
Offline


Could you give more information how to invalidate session within JSF environment?
ernie

Joined: 22/10/2007 00:00:00
Messages: 39
Offline


I seem to have success using an actionListener on my "Logout Button" using the following code:

Code:
public void logoutActionListener(ActionEvent actionEvent) {
 		logger.debug("logoutActionListener");
 		HttpSession session = (HttpSession) FacesContext.getCurrentInstance()
 				.getExternalContext().getSession(false);
 		session.invalidate();
 	}
Baleyba

Joined: 16/11/2006 00:00:00
Messages: 110
Offline


mircea.toma wrote:
The session needs to be invalidated within the JSF environment. You can use an action listener tied to a navigation rule that redirects to login page. Also, the action listener would invalidate the session acquired from the ExternalContext.
With 1.7 release will put up an example on how to do a login/logout process with JSF/ICEfaces. 


Hi,

please can you give me the name of example that shows the new login/logout process ?

thanks
regards,

JBoss 4.2.3 | Java 1.6.0_16 | IceFaces 1.8.2
mircea.toma

Joined: 10/02/2005 00:00:00
Messages: 307
Offline


We will try to provide a sample in a few days. It looks like we missed including this in 1.7.
See http://jira.icefaces.org/browse/ICE-3013 .
[Email]
Baleyba

Joined: 16/11/2006 00:00:00
Messages: 110
Offline


Thanks a lot for the link mircea.toma ;)


JBoss 4.2.3 | Java 1.6.0_16 | IceFaces 1.8.2
pexip

Joined: 03/06/2008 00:00:00
Messages: 25
Offline


Im sure many including me are interested on such a tutorial.
It's been a while but no best practice tutorial for this or am i mistaken?

Thanks
radu.jakab

Joined: 31/10/2007 00:00:00
Messages: 240
Offline


Is that example available anywhere yet?

Thanks,
Radu
connolly.st


Joined: 05/06/2008 00:00:00
Messages: 89
Offline


Hey,

I'm having some trouble implementing a simple invalidate Session based user logout also.

Code:
 
     public void logoutLink_processAction(ActionEvent ae) {
         ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
         HttpSession session = (HttpSession) externalContext.getSession(false);
         session.invalidate();
         try {
             externalContext.redirect("login.jsp");
         } catch (IOException ioe) {
             // Redirect failed
         }
     }
 


Throws an exception:


WARNING: executePhase(INVOKE_APPLICATION 5,com.icesoft.faces.context.BridgeFacesContext@9f188a) threw exception
javax.faces.FacesException
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:105)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:17)
at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:54)
at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:42)
at com.icesoft.faces.webapp.http.core.ViewBoundServer.service(ViewBoundServer.java:65)
at com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:44)
at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)
at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)
at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:63)
at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:139)
at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:53)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:82)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NullPointerException
at com.sun.rave.web.ui.appbase.faces.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
at javax.faces.component.UICommand.broadcast(UICommand.java:383)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)

at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
... 30 more

 


Any chance of getting some example code from the ICEfaces team?

Thanks,
Sean
mircea.toma

Joined: 10/02/2005 00:00:00
Messages: 307
Offline


Have you tried redirecting first and then invalidate the session?
[Email]
connolly.st


Joined: 05/06/2008 00:00:00
Messages: 89
Offline


Hi Mircea,

Thanks for getting back to me.

Code:
 
     public void logoutLink_processAction(ActionEvent ae) {
         System.out.println("1");
         ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
         System.out.println("2");
         try {
             externalContext.redirect("login.jsp");
             System.out.println("3a");
         } catch (IOException ioe) {
             // Redirect failed
             System.out.println("3b");
         }
         System.out.println("4");
         HttpSession session = (HttpSession) externalContext.getSession(false);
         System.out.println("5");
         session.invalidate();
         System.out.println("6");
     }
 


produced..

1
2
3a
4
5
6
Oct 27, 2008 3:18:04 PM com.sun.faces.lifecycle.LifecycleImpl phase
WARNING: executePhase(INVOKE_APPLICATION 5,com.icesoft.faces.context.BridgeFacesContext@1ece9b5) threw exception
javax.faces.FacesException
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:105)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:17)
at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:54)
at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:42)
at com.icesoft.faces.webapp.http.core.ViewBoundServer.service(ViewBoundServer.java:65)
at com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:44)
at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)
at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)
at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:63)
at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:139)
at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:53)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:82)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NullPointerException
at com.sun.rave.web.ui.appbase.faces.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
at javax.faces.component.UICommand.broadcast(UICommand.java:383)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
... 30 more
 


Think maybe I should be queuing this event till later in the cycle?

-Sean
 
Forum Index -> Development Build Feedback Go to Page: 1, 2 Next 
Go to:   
Powered by JForum 2.1.7ice © JForum Team