6 Replies Latest reply on Apr 27, 2010 12:22 PM by kito99

    getAttribute:Session already invalidated (no Spring involved)

    kito99

      I'm getting the session invalidation problem trying to use JSFUnit in an app that uses MyFaces 1.1.5 running on JBoss 4.0. The only other filter installed in this application is the MyFaces ExtensionFilter.

       

      The test is very simple; here's the general idea:

       

       

      {code}

      public class SimpleTest         extends             org.apache.cactus.ServletTestCase {         public static Test suite() {         return new TestSuite(SimpleTest.class);     }         public void testPage() throws IOException {         JSFSession jsfSession = new JSFSession("/jsp/forms/page.jsf");         JSFClientSession  client = jsfSession.getJSFClientSession();         JSFServerSession server = jsfSession.getJSFServerSession();                 // Test navigation to initial viewID         assertEquals("/jsp/forms/page.jsp", server.getCurrentViewID());                 client.setValue("clientname", "Joe's Pizza");                    client.click("create");     } }

      {code}

       

      The first assertion passes, but when client.setValue() is called, I get the following exception in the browser:

       

       

      {code}

      java.lang.NullPointerException:
      newValue at
      com.gargoylesoftware.htmlunit.WebAssert.notNull(WebAssert.java:471) at
      com.gargoylesoftware.htmlunit.html.HtmlInput.setValueAttribute(HtmlInput.java:82) at
      org.jboss.jsfunit.jsfsession.JSFClientSession.setValue(JSFClientSession.java:156) at
      com.matrixcos.efiling.web.EfIntakeHeaderBeanHpmIntegrationTests.createIntake(EfIntakeHeaderBeanHpmIntegrationTests.java:58) at
      com.matrixcos.efiling.web.EfIntakeHeaderBeanHpmIntegrationTests.testHpmFields(EfIntakeHeaderBeanHpmIntegrationTests.java:37) at
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native
      Method) at
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at
      org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:153) at
      org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119) at
      org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:93) at
      org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:224) at
      org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java) at
      org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101) at
      org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:217) at
      org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java) at
      org.jboss.jsfunit.framework.JSFUnitServletRedirector.doPost(JSFUnitServletRedirector.java:46) at
      org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72) at
      org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:217) at
      org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java) at
      org.jboss.jsfunit.framework.JSFUnitServletRedirector.doGet(JSFUnitServletRedirector.java:52) at
      javax.servlet.http.HttpServlet.service(HttpServlet.java:697) at
      javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at
      org.jboss.jsfunit.framework.JSFUnitFilter.doFilter(JSFUnitFilter.java:119) at
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at
      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at
      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at
      org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175) at
      org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74) at
      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at
      org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156) at
      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at
      org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at
      org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at
      org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) at
      java.lang.Thread.run(Thread.java:637)

      {code}

       

      And a more useful, and longer, stack trace in the console:

       

      {code}

      Exception class=[java.lang.RuntimeException]
      com.gargoylesoftware.htmlunit.ScriptException: Exception invoking jsxFunction_go
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:527)
      at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
      at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:457)
      at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:910)
      at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:190)
      at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:209)
      at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:655)
      at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:887)
      at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
      at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
      at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:892)
      at com.gargoylesoftware.htmlunit.html.HtmlPage.executeEventHandlersIfNeeded(HtmlPage.java:1154)
      at com.gargoylesoftware.htmlunit.html.HtmlPage.cleanUp(HtmlPage.java:239)
      at com.gargoylesoftware.htmlunit.TopLevelWindow.close(TopLevelWindow.java:118)
      at org.jboss.jsfunit.framework.WebClientSpec.valueUnbound(WebClientSpec.java:308)
      at org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1615)
      at org.apache.catalina.session.StandardSession.expire(StandardSession.java:739)
      at org.apache.catalina.session.StandardSession.expire(StandardSession.java:645)
      at org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1090)
      at org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:149)
      at org.jboss.jsfunit.framework.JSFUnitServletRedirector.cleanUp(JSFUnitServletRedirector.java:68)
      at org.jboss.jsfunit.framework.JSFUnitServletRedirector.doPost(JSFUnitServletRedirector.java:47)
      at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72)
      at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:217)
      at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java)
      at org.jboss.jsfunit.framework.JSFUnitServletRedirector.doGet(JSFUnitServletRedirector.java:52)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.jsfunit.framework.JSFUnitFilter.doFilter(JSFUnitFilter.java:119)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      at java.lang.Thread.run(Thread.java:637)
      Caused by: java.lang.RuntimeException: Exception invoking jsxFunction_go
      at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:190)
      at net.sourceforge.htmlunit.corejs.javascript.FunctionObject.call(FunctionObject.java:479)
      at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1702)
      at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
      at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
      at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:429)
      at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:264)
      at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3157)
      at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
      at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:80)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:485)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$4.doRun(JavaScriptEngine.java:450)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:521)
      ... 50 more
      Caused by: java.lang.IllegalStateException: getAttribute: Session already invalidated
      at org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:1011)
      at org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:109)
      at org.jboss.jsfunit.framework.FacesContextBridge.getCurrentInstance(FacesContextBridge.java:56)
      at org.jboss.jsfunit.jsfsession.JSFServerSession.pageCreated(JSFServerSession.java:213)
      at org.jboss.jsfunit.jsfsession.JSFServerSession.afterRequest(JSFServerSession.java:234)
      at org.jboss.jsfunit.framework.JSFUnitWebConnection.notifyListenersAfter(JSFUnitWebConnection.java:100)
      at org.jboss.jsfunit.framework.JSFUnitWebConnection.getResponse(JSFUnitWebConnection.java:82)
      at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1407)
      at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1340)
      at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:299)
      at com.gargoylesoftware.htmlunit.History.goToUrlAtCurrentIndex(History.java:176)
      at com.gargoylesoftware.htmlunit.History.go(History.java:138)
      at com.gargoylesoftware.htmlunit.javascript.host.History.jsxFunction_go(History.java:132)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:164)
      ... 62 more
      Enclosed exception:
      java.lang.RuntimeException: Exception invoking jsxFunction_go
      at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:190)
      at net.sourceforge.htmlunit.corejs.javascript.FunctionObject.call(FunctionObject.java:479)
      at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpre
      02:01:59,433 INFO  [STDOUT] tLoop(Interpreter.java:1702)
      at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
      at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
      at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:429)
      at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:264)
      at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3157)
      at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
      at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:80)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:485)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$4.doRun(JavaScriptEngine.java:450)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:521)
      at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
      at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:457)
      at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:910)
      at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:190)
      at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:209)
      at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:655)
      at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:887)
      at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
      at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
      at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:892)
      at com.gargoylesoftware.htmlunit.html.HtmlPage.executeEventHandlersIfNeeded(HtmlPage.java:1154)
      at com.gargoylesoftware.htmlunit.html.HtmlPage.cleanUp(HtmlPage.java:239)
      at com.gargoylesoftware.htmlunit.TopLevelWindow.close(TopLevelWindow.java:118)
      at org.jboss.jsfunit.framework.WebClientSpec.valueUnbound(WebClientSpec.java:308)
      at org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1615)
      at org.apache.catalina.session.StandardSession.expire(StandardSession.java:739)
      at org.apache.catalina.session.StandardSession.expire(StandardSession.java:645)
      at org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1090)
      at org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:149)
      at org.jboss.jsfunit.framework.JSFUnitServletRedirector.cleanUp(JSFUnitServletRedirector.java:68)
      at org.jboss.jsfunit.framework.JSFUnitServletRedirector.doPost(JSFUnitServletRedirector.java:47)
      at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72)
      at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:217)
      at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java)
      at org.jboss.jsfunit.framework.JSFUnitServletRedirector.doGet(JSFUnitServletRedirector.java:52)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.jsfunit.framework.JSFUnitFilter.doFilter(JSFUnitFilter.java:119)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      at java.lang.Thread.run(Thread.java:637)
      Caused by: java.lang.IllegalStateException: getAttribute: Session already invalidated
      at org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:1011)
      at org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:109)
      at org.jboss.jsfunit.framework.FacesContextBridge.getCurrentInstance(FacesContextBridge.java:56)
      at org.jboss.jsfunit.jsfsession.JSFServerSession.pageCreated(JSFServerSession.java:213)
      at org.jboss.jsfunit.jsfsession.JSFServerSession.afterRequest(JSFServerSession.java:234)
      at org.jboss.jsfunit.framework.JSFUnitWebConnection.notifyListenersAfter(JSFUnitWebConnection.java:100)
      at org.jboss.jsfunit.framework.JSFUnitWebConnection.getResponse(JSFUnitWebConnection.java:82)
      at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1407)
      at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1340)
      at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:299)
      at com.gargoylesoftware.htmlunit.History.goToUrlAtCurrentIndex(History.java:176)
      at com.gargoylesoftware.htmlunit.History.go(History.java:138)
      at com.gargoylesoftware.htmlunit.javascript.host.History.jsxFunction_go(History.java:132)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:164)
      ... 62 more
      == CALLING JAVASCRIPT ==
      function () {
      [native code, arity=0]
      }
      {code}

       

       

      I'm at a loss here, since I don't see anything invalidating the session other than JSFUnit itself (in the JSFUnitServletRedirector). The input control in question does have an <a4j:support> tag on it, but that's about it. Any advice would be greatly appreciated.

        • 1. Re: getAttribute:Session already invalidated (no Spring involved)
          ssilvert

          Hi Kito,

           

          This happens when some code invalidates the HttpSession and the session is obtained through a means other than the ExternalContext.  JSFUnit protects the HttpSession from invalidation by wrapping it with a JSFUnitHttpSession.  But if some code obtains the raw HttpSession and calls invalidate then your exception can happen.

           

          See the JSFUnitTestingSecurePages

           

          I'm guessing that the culprit is the MyFaces ExtensionFilter, but that's only a guess.

           

          Stan

          • 2. Re: getAttribute:Session already invalidated (no Spring involved)
            kito99

            Stan Silvert wrote:

             

            Hi Kito,

             

            This happens when some code invalidates the HttpSession and the session is obtained through a means other than the ExternalContext.  JSFUnit protects the HttpSession from invalidation by wrapping it with a JSFUnitHttpSession.  But if some code obtains the raw HttpSession and calls invalidate then your exception can happen.

             

            See the bottom of this page.

             

            I'm guessing that the culprit is the MyFaces ExtensionFilter, but that's only a guess.

             

            Stan

             

            I understand that invalidating the session is the usual culprit, but I just don't see where that's happening. I just tried removing the ExtensionsFilter and even the ajax4jsf filter (forgot to mention that we're using RichFaces 3.01 and the stand-alone Ajax4jsf), but I'm still getting the same behavior. There was one reference to the session in the code base (a simple call to FacesContext.getExternalContext.getSession(false) to see if a session had been created), but removing that doesn't help either.

             

            Any other ideas?

            • 3. Re: getAttribute:Session already invalidated (no Spring involved)
              ssilvert

              The session must have been invalidated somehow, right?

               

              You could write a filter that always wraps the HttpSession with your own or with an instance of JSFUnitHttpSession.  If you use your own you could do a thread dump whenever invalidate() is called.  That would tell you exactly who is doing it.

               

              Stan

              • 4. Re: getAttribute:Session already invalidated (no Spring involved)
                ssilvert

                BTW, what kind of security do you have in your app.  I've seen some security frameworks that destroy the session when you log in and then give a new session to the user.  Would your app be doing something like that?

                 

                Stan

                • 5. Re: getAttribute:Session already invalidated (no Spring involved)
                  ssilvert

                  Hi Kito,

                   

                  Did you ever figure this one out?

                   

                  Stan

                  • 6. Re: getAttribute:Session already invalidated (no Spring involved)
                    kito99

                    I haven't had the chance to try this again, but I'll probably make one more go at it. I just found out we'll be deploying this in JBoss 5, so hopefully that will help. I might just upgrade to Mojarra 1.2 in the process, which would probably eliminate the problem. Technically the app uses Java Single Sign-On (JOSSO), but I don't have it installed on the machine I'm using, and there are no filters involved.