2 Replies Latest reply on Aug 24, 2009 5:11 AM by artmooney

    JSFUnit with Spring Security fails on Tomcat 6

    artmooney

      Hi,
      I'm trying to write a test for a JSF application with spring security.
      I see in the logfiles that the test successfully passes the login
      dialog and the welcome page (secured) is loaded.
      Nevertheless the test quits with an exception when creating the
      JSFSession instance:
      IllegalStateException: getAttribute Session already invalidated at

      org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:1032)
      at
      org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:110)
      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.(JSFServerSession.java:56)
      at
      org.jboss.jsfunit.jsfsession.JSFSession.(JSFSession.java:83) at
      JSFUnitTest.testInitialPage(JSFUnitTest.java:43)

      regards,

      Bernd


      My test code is:

      WebClientSpec wcSpec = new WebClientSpec("/pages/summary.faces",
      BrowserVersion.FIREFOX_3);
      FormAuthenticationStrategy formAuth = new
      FormAuthenticationStrategy("test", "test", "loginButton",
      "j_username", "j_password");
      wcSpec.setInitialRequestStrategy(formAuth);

      JSFSession jsfSession = new JSFSession(wcSpec); // <-- CRASHES

      JSFClientSession client = jsfSession.getJSFClientSession();
      RichFacesClient ajaxClient = new RichFacesClient(client);