6 Replies Latest reply on Mar 24, 2009 10:19 AM by Daniel Nielsen

    Seam conversation scopes and JSFUnit (again...)

    Daniel Nielsen Newbie

      Hi.

      I recently rewrote one of our multipage wizards to a singlepage wizard using seam and conversation scopes. Now I want to write JSFUnit testcases for it.

      When testing, I've written a utility base class providing simple login and navigation methods. I can log in, but I cannot render the page initially.

      I reference a conversation scoped bean twice but apparently the bean's @Create method is called twice during the same rendering. The second time it seems that one of the two @In fields are not populated, hence I get NPE's. The EntityManager @In field is populated, but with a new instance.

      The bean has two @Factory methods producing backing components to a couple of rich:tree UI-controls.

      Actually, I reference several conversation scoped components, but apparently have issues with this one.

      Example usage (I have a "includeUsers" control which is identical to this one as well):

      <rich:panel>
       <f:facet name="header">#{messages.report_userfilter_exclude}</f:facet>
       <s:decorate id="excludeUsersField" template="/themes/default/edit.xhtml">
       <h:selectBooleanCheckbox id="exclude" value="#{userGroupFiltering.excludeUsersEnabled}">
       <a4j:support event="onclick" reRender="exclude_users" ajaxSingle="true"/>
       </h:selectBooleanCheckbox>
       <h:outputLabel for="exclude" value="#{messages.report_userfilter_exclude_enable}"/>
       <a4j:outputPanel id="exclude_users">
       <h:panelGrid columns="5" rowClasses="prop" columnClasses="name,value,name,value"
       rendered="#{userGroupFiltering.excludeUsersEnabled}">
      
       <rich:tree style="width: 300px" value="#{excludeGroupTree}" var="item"
       icon=""
       iconLeaf="" switchType="client">
       <rich:treeNode>
       <h:selectBooleanCheckbox value="#{item.selected}"/>
       <h:outputText value="#{item.value.groupName}"/>
       </rich:treeNode>
       </rich:tree>
      
       </h:panelGrid>
       </a4j:outputPanel>
       </s:decorate>
      
       <div style="clear: both;"/>
      </rich:panel>
      


      I hope someone has a clue at where to look next?

      Regards,
      ./Daniel

        • 1. Re: Seam conversation scopes and JSFUnit (again...)
          Stan Silvert Master

          Hi Daniel,

          Can you post your JSFUnit code along with any stack trace information?

          Thanks,

          Stan

          • 2. Re: Seam conversation scopes and JSFUnit (again...)
            Daniel Nielsen Newbie

            Hi Stan.

            After reading my post again, I see that I could have included more information. Sorry about that, I was tired. I will try to do it better now.

            The test fails in one of two ways: If it is the first test run on a fresh startet jboss as, there are almost no clues in the log except a lot of exceptions that I normally see on the first run. A snippet of the log:

            13:42:05,710 ERROR [SeamPhaseListener] swallowing exception
            java.lang.IllegalStateException: Could not start transaction
             at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:599)
             at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:584)
             at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsBeforePhase(SeamPhaseListener.java:325)
             at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:142)
             at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:116)
             at org.ajax4jsf.resource.ResourceLifecycle.invokePhaseListener(ResourceLifecycle.java:199)
             at org.ajax4jsf.resource.ResourceLifecycle.processPhaseListeners(ResourceLifecycle.java:175)
             at org.ajax4jsf.resource.ResourceLifecycle.send(ResourceLifecycle.java:119)
             at org.ajax4jsf.resource.InternetResourceService.load(InternetResourceService.java:335)
             at org.ajax4jsf.cache.LRUMapCache.load(LRUMapCache.java:116)
             at org.ajax4jsf.cache.LRUMapCache.get(LRUMapCache.java:87)
             at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:195)
             at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:141)
             at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:510)
             at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
             at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
             at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
             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:446)
             at java.lang.Thread.run(Thread.java:619)
            Caused by: javax.ejb.NoSuchEJBException: Could not find stateful bean: 5c4o01p-tr8gyf-fsg04j7u-1-fsg06ddy-h
             at org.jboss.ejb3.cache.simple.SimpleStatefulCache.get(SimpleStatefulCache.java:390)
             at org.jboss.ejb3.cache.simple.SimpleStatefulCache.get(SimpleStatefulCache.java:375)
             at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:61)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
             at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:206)
             at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:119)
             at $Proxy92.afterTransactionBegin(Unknown Source)
             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 org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
             at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
             at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
             at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
             at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
             at org.javassist.tmp.java.lang.Object_$$_javassist_3.afterTransactionBegin(Object_$$_javassist_3.java)
             at org.jboss.seam.transaction.UTTransaction.begin(UTTransaction.java:40)
             at org.jboss.seam.jsf.SeamPhaseListener.begin(SeamPhaseListener.java:594)
             ... 38 more
            13:42:05,716 WARN [SeamPhaseListener] uncaught exception, passing to exception handler
            java.lang.IllegalStateException: Could not commit transaction
             at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:626)
             at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:605)
             at org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:343)
             at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:243)
             at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:194)
             at org.ajax4jsf.resource.ResourceLifecycle.invokePhaseListener(ResourceLifecycle.java:201)
             at org.ajax4jsf.resource.ResourceLifecycle.processPhaseListeners(ResourceLifecycle.java:182)
             at org.ajax4jsf.resource.ResourceLifecycle.send(ResourceLifecycle.java:139)
             at org.ajax4jsf.resource.InternetResourceService.load(InternetResourceService.java:335)
             at org.ajax4jsf.cache.LRUMapCache.load(LRUMapCache.java:116)
             at org.ajax4jsf.cache.LRUMapCache.get(LRUMapCache.java:87)
             at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:195)
             at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:141)
             at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:510)
             at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
             at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
             at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
             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:446)
             at java.lang.Thread.run(Thread.java:619)
            Caused by: javax.ejb.NoSuchEJBException: Could not find stateful bean: 5c4o01p-tr8gyf-fsg04j7u-1-fsg06ddy-h
             at org.jboss.ejb3.cache.simple.SimpleStatefulCache.get(SimpleStatefulCache.java:390)
             at org.jboss.ejb3.cache.simple.SimpleStatefulCache.get(SimpleStatefulCache.java:375)
             at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:61)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
             at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
             at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:206)
             at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:119)
             at $Proxy92.beforeTransactionCommit(Unknown Source)
             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 org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
             at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
             at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
             at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
             at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
             at org.javassist.tmp.java.lang.Object_$$_javassist_3.beforeTransactionCommit(Object_$$_javassist_3.java)
             at org.jboss.seam.transaction.UTTransaction.commit(UTTransaction.java:49)
             at org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:614)
             ... 38 more
            


            The test fails with the following exception:
            org.apache.cactus.internal.client.AssertionFailedErrorWrapper: failed to navigate to page expected:<...report/reportedit...> but was:<...debug...>
            junit.framework.ComparisonFailure: failed to navigate to page expected:<...report/reportedit...> but was:<...debug...>
             at com.blipsystems.blipzones.jsfunit.report.ReportEditTest.setUp(ReportEditTest.java:43)
             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:224)
             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:224)
             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:690)
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.jboss.jsfunit.framework.JSFUnitFilter.doFilter(JSFUnitFilter.java:116)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
             at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
             at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
             at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
             at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
             at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
             at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
             at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
             at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
             at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
             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:446)
             at java.lang.Thread.run(Thread.java:619)
             at java.lang.Thread.run(Thread.java:619)
            


            I tried dumping the output of the debug page and noticed this exception:

             Exception during request processing:
             Caused by org.jboss.seam.security.NotLoggedInException with message: ""
            
            org.jboss.seam.security.Identity.checkRestriction(Identity.java:217)
            org.jboss.seam.navigation.Page.checkPermission(Page.java:245)
            org.jboss.seam.navigation.Page.preRender(Page.java:265)
            org.jboss.seam.navigation.Pages.preRender(Pages.java:366)
            org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:562)
            org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:473)
            org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:146)
            org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:116)
            com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214)
            com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96)
            com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
            org.jboss.jsfunit.seam.JSFUnitLifecycle.render(JSFUnitLifecycle.java:59)
            javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
            org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
            org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
            org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
            org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
            org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
            org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
            org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
            org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
            org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
            org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
            org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
            org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
            org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
            org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
            java.lang.Thread.run(Thread.java:619)
            


            On the second run, the test fails with:

            org.apache.cactus.internal.client.AssertionFailedErrorWrapper: Another exception happened
            junit.framework.AssertionFailedError: Another exception happened
             at com.blipsystems.blipzones.jsfunit.util.BlipJsfUnitTestCase.initializeAndLogin(BlipJsfUnitTestCase.java:145)
             at com.blipsystems.blipzones.jsfunit.report.ReportEditTest.setUp(ReportEditTest.java:42)
             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:224)
             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:224)
             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:690)
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.jboss.jsfunit.framework.JSFUnitFilter.doFilter(JSFUnitFilter.java:116)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
             at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
             at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
             at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
             at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
             at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
             at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
             at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
             at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
             at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
             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:446)
             at java.lang.Thread.run(Thread.java:619)
             at java.lang.Thread.run(Thread.java:619)
            


            In this case, there is more output in the logs (from the @Create annotated method):

            13:48:29,823 DEBUG [UserGroupFilteringWrapper] UserGroupFilteringWrapper.init - start
            13:48:29,824 DEBUG [UserGroupFilteringWrapper] RouteAnalysisHome: com.blipsystems.blipzones.web.action.report.RouteAnalysisHome@140fbd9
            13:48:29,824 DEBUG [UserGroupFilteringWrapper] This: com.blipsystems.blipzones.web.action.report.UserGroupFilteringWrapper@15679be
            13:48:29,824 DEBUG [UserGroupFilteringWrapper] em: org.jboss.seam.persistence.EntityManagerProxy@52c554
            13:48:29,826 DEBUG [UserGroupFilteringWrapper] UserGroupFilteringWrapper.init - end
            
            --- snip ---
            13:48:32,919 DEBUG [UserGroupFilteringWrapper] UserGroupFilteringWrapper.init - start
            13:48:32,919 DEBUG [UserGroupFilteringWrapper] RouteAnalysisHome: null
            13:48:32,920 DEBUG [UserGroupFilteringWrapper] This: com.blipsystems.blipzones.web.action.report.UserGroupFilteringWrapper@e7ec25
            13:48:32,920 DEBUG [UserGroupFilteringWrapper] em: org.jboss.seam.persistence.EntityManagerProxy@408f59
            13:48:32,950 ERROR [BlipJsfUnitTestCase] Another exception happened!
            org.jboss.seam.InstantiationException: Could not instantiate Seam component: userGroupFiltering
             at org.jboss.seam.Component.newInstance(Component.java:2106)
             at org.jboss.seam.Component.getInstance(Component.java:1988)
             at org.jboss.seam.Component.getInstance(Component.java:1950)
             at org.jboss.seam.Component.getInstance(Component.java:1944)
             at org.jboss.seam.Component.getInstanceFromFactory(Component.java:2036)
             at org.jboss.seam.Component.getInstance(Component.java:1978)
             at org.jboss.seam.Component.getInstance(Component.java:1950)
             at org.jboss.seam.Component.getInstance(Component.java:1944)
             at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
             at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
             at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:166)
             at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:53)
             at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
             at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
             at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
             at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
             at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
             at javax.faces.component.UIData.getValue(UIData.java:609)
             at org.ajax4jsf.component.UIDataAdaptor.getValue(UIDataAdaptor.java:1644)
             at org.richfaces.component.UITree.createDataModel(UITree.java:679)
             at org.ajax4jsf.component.UIDataAdaptor.getExtendedDataModel(UIDataAdaptor.java:621)
             at org.ajax4jsf.component.UIDataAdaptor.getRowCount(UIDataAdaptor.java:248)
             at org.jboss.jsfunit.jsfsession.ClientIDs.addUIData(ClientIDs.java:122)
             at org.jboss.jsfunit.jsfsession.ClientIDs.addAllIDs(ClientIDs.java:80)
             at org.jboss.jsfunit.jsfsession.ClientIDs.addAllIDs(ClientIDs.java:88)
             at org.jboss.jsfunit.jsfsession.ClientIDs.addAllIDs(ClientIDs.java:88)
             at org.jboss.jsfunit.jsfsession.ClientIDs.addAllIDs(ClientIDs.java:88)
             at org.jboss.jsfunit.jsfsession.ClientIDs.addAllIDs(ClientIDs.java:88)
             at org.jboss.jsfunit.jsfsession.ClientIDs.addAllIDs(ClientIDs.java:88)
             at org.jboss.jsfunit.jsfsession.ClientIDs.addAllIDs(ClientIDs.java:88)
             at org.jboss.jsfunit.jsfsession.ClientIDs.addAllIDs(ClientIDs.java:88)
             at org.jboss.jsfunit.jsfsession.ClientIDs.<init>(ClientIDs.java:67)
             at org.jboss.jsfunit.jsfsession.JSFServerSession.pageCreated(JSFServerSession.java:179)
             at org.jboss.jsfunit.jsfsession.JSFServerSession.<init>(JSFServerSession.java:54)
             at org.jboss.jsfunit.jsfsession.JSFSession.<init>(JSFSession.java:82)
             at com.blipsystems.blipzones.jsfunit.util.BlipJsfUnitTestCase.initializeAndLogin(BlipJsfUnitTestCase.java:139)
             at com.blipsystems.blipzones.jsfunit.report.ReportEditTest.setUp(ReportEditTest.java:42)
             at junit.framework.TestCase.runBare(TestCase.java:125)
             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:224)
             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:224)
             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:690)
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.jboss.jsfunit.framework.JSFUnitFilter.doFilter(JSFUnitFilter.java:116)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
             at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
             at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
             at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
             at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
             at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
             at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
             at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
             at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
             at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
             at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
             at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
             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:446)
             at java.lang.Thread.run(Thread.java:619)
            Caused by: java.lang.NullPointerException
             at com.blipsystems.blipzones.web.action.report.UserGroupFilteringWrapper.init(UserGroupFilteringWrapper.java:50)
             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 org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
             at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
             at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
             at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
             at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
             at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
             at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
             at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
             at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
             at com.blipsystems.blipzones.web.action.report.UserGroupFilteringWrapper_$$_javassist_18.init(UserGroupFilteringWrapper_$$_javassist_18.java)
             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 org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
             at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
             at org.jboss.seam.Component.callComponentMethod(Component.java:2211)
             at org.jboss.seam.Component.callCreateMethod(Component.java:2134)
             at org.jboss.seam.Component.newInstance(Component.java:2094)
             ... 95 more
            


            The lines that fail:

             @Override
             public void setUp() throws Exception {
             super.setUp();
             initializeAndLogin("admin", "admin", "/report/reportedit.seam");
             assertEquals("failed to navigate to page", "/report/reportedit.xhtml", server.getCurrentViewID());
             }
            


            initializeAndLogin method:

             public void initializeAndLogin(String username, String password, String page) {
             WebClientSpec wcSpec = new WebClientSpec(page);
             BlipZonesEELoginStrategy formAuth = new BlipZonesEELoginStrategy(username, password);
             wcSpec.setInitialRequestStrategy(formAuth);
             try {
             session = new JSFSession(wcSpec);
             } catch (IOException e) {
             log.error("IO exception happened!", e);
             fail("IO exception happened!");
             } catch (Exception e) {
             log.error("Another exception happened!", e);
             fail("Another exception happened");
             }
             server = session.getJSFServerSession();
             client = session.getJSFClientSession();
             }
            


            I hope this information helps :-)

            Regards,
            ./Daniel


            • 3. Re: Seam conversation scopes and JSFUnit (again...)
              Daniel Nielsen Newbie

              Quick update:

              I forgot to mention, that all testcases for identity management and usage of the BlipZonesEELoginStrategy pass.

              Also, the page (report/reportedit.seam) works when accessed from the browser.

              Regards,
              ./Daniel

              • 4. Re: Seam conversation scopes and JSFUnit (again...)
                Tim Evers Master

                Could you post the code inside your BlipZonesEELoginStrategy please?

                Or verify that you are not using any JSFUnit api in there. This should consist of calls only to the HtmlUnit api.

                • 5. Re: Seam conversation scopes and JSFUnit (again...)
                  Daniel Nielsen Newbie

                  Hi.

                  Well, the class extends org.jboss.jsfunit.framework.SimpleInitialRequestStrategy and hence has a method taking a org.jboss.jsfunit.framework.WebClientSpec as argument. But other than that, no JSFUnit calls. Only HtmlUnit.

                  It is basically a copy & paste of the non-JEE version posted here: http://www.jboss.org/community/docs/DOC-10974

                  public class BlipZonesEELoginStrategy extends SimpleInitialRequestStrategy {
                  
                  
                   private String userName;
                   private String password;
                   private String submitComponent = "loginform:submit";
                  
                   public BlipZonesEELoginStrategy(String userName, String password) {
                   this.userName = userName;
                   this.password = password;
                   }
                  
                  
                   public void setSubmitComponent(String submitComponent) {
                   this.submitComponent = submitComponent;
                   }
                  
                   /**
                   * Perform the initial request and provide FORM authentication
                   * credentials when challenged.
                   *
                   * @param wcSpec The WebClient specification.
                   * @return The requested page if authentication passed. Otherwise, return
                   * the error page specified in web.xml.
                   */
                   public Page doInitialRequest(WebClientSpec wcSpec) throws IOException {
                   HtmlPage page = (HtmlPage) super.doInitialRequest(wcSpec);
                   setValue(page, "loginform:name", this.userName);
                   setValue(page, "loginform:password", this.password);
                   return clickSubmitComponent(page);
                   }
                  
                   protected Page clickSubmitComponent(HtmlPage page) throws IOException {
                   HtmlElement htmlElement = getElement(page, this.submitComponent);
                   if (!(htmlElement instanceof ClickableElement)) {
                   throw new IllegalStateException("Component with name=" + this.submitComponent + " is not a ClickableElement.");
                   }
                  
                   ClickableElement clickable = (ClickableElement) htmlElement;
                   return clickable.click();
                   }
                  
                   protected void setValue(HtmlPage page, String elementName, String value) {
                   HtmlElement element = getElement(page, elementName);
                   if (!(element instanceof HtmlInput)) {
                   throw new IllegalStateException("Component with name=" + elementName + " is not an HtmlInput element.");
                   }
                   HtmlInput inputElement = (HtmlInput) element;
                   inputElement.setValueAttribute(value);
                   }
                  
                   protected HtmlElement getElement(HtmlPage page, String elementName) {
                   List<HtmlElement> elements = page.getElementsByName(elementName);
                   if (elements.size() == 0) {
                   throw new IllegalStateException("Component with name=" + elementName + " was not found on the login page.");
                   }
                   if (elements.size() > 1) {
                   throw new IllegalStateException("More than one component with name=" + elementName + " was found on the login page.");
                   }
                  
                   return elements.get(0);
                   }
                  
                  }
                  


                  • 6. Re: Seam conversation scopes and JSFUnit (again...)
                    Daniel Nielsen Newbie

                    A little update:

                    I know for a fact that I can navigate directly to the reportedit.seam page from a browser and then it works, but apparently not so through JSFUnit.

                    Because, if I navigate to the listing of reports first and then click the create new report button, it works.

                     initializeAndLogin("admin", "admin", "/report/reportlist.seam");
                     client.click("createNewReport");
                    


                    Perhaps I'm doing something in pages.xml which jsfunit does not support?

                    Pages.xml entry for reportedit.xhtml:

                    <page view-id="/report/reportedit.xhtml">
                     <restrict>#{identity.hasRole("admin")}</restrict>
                     <begin-conversation flush-mode="MANUAL" join="true"/>
                     <param name="reportId" value="#{reportHome.reportId}" converterId="javax.faces.Integer"/>
                     <navigation from-action="#{reportHome.persist}">
                     <redirect view-id="/report/reportlist.xhtml"/>
                     <end-conversation />
                     </navigation>
                    
                     <navigation from-action="#{reportHome.update}">
                     <redirect view-id="/report/reportlist.xhtml"/>
                     <end-conversation />
                     </navigation>
                    
                     </page>
                    


                    I wonder why I cannot navigate directly to the reportedit.xhtml?