13 Replies Latest reply on Mar 20, 2008 12:23 PM by Stan Silvert

    JSFUnit on JBoss 4.2.2

    Wim Vandenhaute Newbie

      Hey there,

      I am trying out JSFUnit with a small test case but am getting following stack trace upon executing:



      java.lang.NullPointerException
      at org.jboss.jsfunit.facade.JSFServerSession.getCurrentViewID(JSFServerSession.java:60)
      at net.link.safeonline.helpdesk.HelpdeskTest.testInitialPage(HelpdeskTest.java:54)
      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:585)
      at junit.framework.TestCase.runTest(TestCase.java:168)


      I followed the information on configuration of my web.xml so that one should be ok imo.

      The unit test is basically a copy of the hello world example provided.

      My application server log does not reveal anything disturbing but following line:

      17:31:50,134 ERROR [STDERR] Jan 14, 2008 5:31:50 PM org.apache.myfaces.trinidadinternal.agent.AgentFactoryImpl _populateUnknownAgentImpl
      WARNING: The User-Agent "httpunit/1.5" is unknown; creating an agent with "unknown" agent attributes.


      Also trinidad and tomahawk are used on some pages in this webapp but not at the page I am trying jsfunit out on.
      So in my web.xml I have the following context param's :


      <context-param>
      <param-name>
      org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER
      </param-name>
      <param-value>com.sun.facelets.FaceletViewHandler</param-value>
      </context-param>

      <context-param>
      <param-name>
      org.apache.myfaces.trinidad.USE_APPLICATION_VIEW_CACHE
      </param-name>
      <param-value>false</param-value>
      </context-param>



      and following filters:


      <filter>
      <filter-name>trinidad</filter-name>
      <filter-class>
      org.apache.myfaces.trinidad.webapp.TrinidadFilter
      </filter-class>
      </filter>



      and servlet ...

      <servlet>
      <servlet-name>resources</servlet-name>
      <servlet-class>
      org.apache.myfaces.trinidad.webapp.ResourceServlet
      </servlet-class>
      </servlet>



      Any ideas ?

      Best Regards,
      W.

        • 1. Re: JSFUnit on JBoss 4.2.2
          Stan Silvert Master

          Hi W.,

          Please post the full stack trace.

          Thanks,

          Stan

          • 2. Re: JSFUnit on JBoss 4.2.2
            Wim Vandenhaute Newbie

            Hey Stan,

            here it is:



            java.lang.NullPointerException
            at org.jboss.jsfunit.facade.JSFServerSession.getCurrentViewID(JSFServerSession.java:60)
            at net.link.safeonline.helpdesk.HelpdeskTest.testInitialPage(HelpdeskTest.java:54)
            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:585)
            at junit.framework.TestCase.runTest(TestCase.java:168)
            at junit.framework.TestCase.runBare(TestCase.java:134)
            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.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 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:123)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
            at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
            at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
            at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
            at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
            at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
            at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
            at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
            at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
            at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at net.link.safeonline.webapp.filter.TimeoutFilter.doFilter(TimeoutFilter.java:71)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at net.link.safeonline.webapp.filter.ExceptionFilter.doFilter(ExceptionFilter.java:50)
            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:613)



            • 3. Re: JSFUnit on JBoss 4.2.2
              Stan Silvert Master

              I know that the examples run on 4.2.2, but it is possible that some of the other filters are interfering with JSFUnit. Can you remove some of those other servlet filters that appear in the stack trace?

              Another thing to try is to see what happens if you let the JSFUnit filter run first instead of last.

              Stan

              • 4. Re: JSFUnit on JBoss 4.2.2
                Wim Vandenhaute Newbie

                I have removed all filters ( except SeamFilter ) but result is the same. Also the JSFUnitfilter is moved to the first one.

                Here is the stacktrace in this configuration:



                java.lang.NullPointerException
                at org.jboss.jsfunit.facade.JSFServerSession.getCurrentViewID(JSFServerSession.java:60)
                at net.link.safeonline.helpdesk.HelpdeskTest.testInitialPage(HelpdeskTest.java:53)
                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:585)
                at junit.framework.TestCase.runTest(TestCase.java:168)
                at junit.framework.TestCase.runBare(TestCase.java:134)
                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.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 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:123)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
                at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
                at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
                at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
                at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
                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:613)




                Here is the code of the unit test :

                import java.io.IOException;
                
                import javax.faces.component.UIComponent;
                import javax.faces.context.FacesContext;
                
                import junit.framework.Test;
                import junit.framework.TestSuite;
                
                import org.apache.cactus.ServletTestCase;
                import org.apache.commons.logging.Log;
                import org.apache.commons.logging.LogFactory;
                import org.jboss.jsfunit.facade.JSFClientSession;
                import org.jboss.jsfunit.facade.JSFServerSession;
                import org.xml.sax.SAXException;
                
                public class HelpdeskTest extends ServletTestCase {
                
                 private final static Log LOG = LogFactory.getLog(HelpdeskTest.class);
                
                 private JSFClientSession client;
                
                 /**
                 * Start a JSFUnit session by getting the /main.seam page.
                 */
                 @Override
                 public void setUp() throws IOException, SAXException {
                 // Initial JSF request
                 this.client = new JSFClientSession("/main.seam");
                 }
                
                 /**
                 * @return the suite of tests being tested
                 */
                 public static Test suite() {
                 System.setProperty("cactus.contextURL",
                 "http://localhost:8080/test-jsfunit");
                 return new TestSuite(HelpdeskTest.class);
                 }
                
                 /**
                 * The initial page was called up in the setUp() method. This shows some
                 * simple JSFUnit tests you can do on that page.
                 */
                 public void testInitialPage() {
                 JSFServerSession server = new JSFServerSession(this.client);
                
                 FacesContext ctx = server.getFacesContext();
                 LOG.debug("ctx view root: " + ctx.getViewRoot());
                
                 // Test navigation to initial viewID
                 assertEquals("/main.seam", server.getCurrentViewID());
                
                 // Assert that the login component is in the component tree and
                 // rendered
                 UIComponent login = server.findComponent("form1:login");
                 LOG.debug("login: " + login.getId());
                 assertTrue(login.isRendered());
                 }
                }
                
                
                


                Best regards,
                W.

                • 5. Re: JSFUnit on JBoss 4.2.2
                  Stan Silvert Master

                  I'm working through the Seam registration example now. At the moment I'm having a different problem, but it does get past the point where you get your NullPointerException. The registration example does not use the Seam filter. Can you see what happens when you remove the Seam filter?

                  Thanks,

                  Stan

                  • 6. Re: JSFUnit on JBoss 4.2.2
                    Wim Vandenhaute Newbie

                    Hey Stan, sorry for the late reply, had some things going on ...

                    I removed the Seam filter as you asked, so the only filter active at the moment is JSFUnitFilter.
                    No success tho, below I have posted the stacktrace.



                    java.lang.NullPointerException
                    at org.jboss.jsfunit.facade.JSFServerSession.getCurrentViewID(JSFServerSession.java:60)
                    at net.link.safeonline.helpdesk.HelpdeskTest.testInitialPage(HelpdeskTest.java:53)
                    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:585)
                    at junit.framework.TestCase.runTest(TestCase.java:168)
                    at junit.framework.TestCase.runBare(TestCase.java:134)
                    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.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 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:123)
                    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)



                    • 7. Re: JSFUnit on JBoss 4.2.2
                      Stan Silvert Master

                      I've now got two Seam examples working with JSFUnit (registration and booking). The only problem I'm having is the known issue with conversation scope. So I doubt that this is a Seam problem.

                      Can you post your code for HelpDeskTest.java?

                      Regards,

                      Stan

                      • 8. Re: JSFUnit on JBoss 4.2.2
                        Wim Vandenhaute Newbie

                        The HelpdeskTest.java is 3 posts below here.

                        Here is some of the remaining configuration of my web.xml, dont know if it might bring a light into this matter tho.
                        I will try to do some more testing later on today hopefully.

                        Regards,
                        Wim.


                        ...
                        <listener>
                        <listener-class>
                        org.jboss.seam.servlet.SeamListener
                        </listener-class>
                        </listener>

                        <listener>
                        <listener-class>
                        com.sun.faces.config.ConfigureListener
                        </listener-class>
                        </listener>
                        ...
                        <context-param>
                        <param-name>
                        org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER
                        </param-name>
                        <param-value>com.sun.facelets.FaceletViewHandler</param-value>
                        </context-param>

                        <context-param>
                        <param-name>
                        org.apache.myfaces.trinidad.USE_APPLICATION_VIEW_CACHE
                        </param-name>
                        <param-value>false</param-value>
                        </context-param>
                        ...
                        <context-param>
                        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                        <param-value>client</param-value>
                        </context-param>

                        <context-param>
                        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                        <param-value>.xhtml</param-value>
                        </context-param>
                        ...
                        <servlet>
                        <servlet-name>Faces Servlet</servlet-name>
                        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                        <load-on-startup>1</load-on-startup>
                        </servlet>

                        <servlet>
                        <servlet-name>resources</servlet-name>
                        <servlet-class>
                        org.apache.myfaces.trinidad.webapp.ResourceServlet
                        </servlet-class>
                        </servlet>

                        <servlet>
                        <servlet-name>Seam Resource Servlet</servlet-name>
                        <servlet-class>
                        org.jboss.seam.servlet.ResourceServlet
                        </servlet-class>
                        </servlet>

                        <servlet-mapping>
                        <servlet-name>Faces Servlet</servlet-name>
                        <url-pattern>*.seam</url-pattern>
                        </servlet-mapping>

                        <servlet-mapping>
                        <servlet-name>resources</servlet-name>
                        <url-pattern>/adf/*</url-pattern>
                        </servlet-mapping>

                        <servlet-mapping>
                        <servlet-name>Seam Resource Servlet</servlet-name>
                        <url-pattern>/seam/resource/*</url-pattern>
                        </servlet-mapping>

                        ...


                        • 9. Re: JSFUnit on JBoss 4.2.2
                          Stan Silvert Master

                          Sorry, I forgot that you already posted the java code. Here is the line of code that fails in JSFServerSession:

                          public String getCurrentViewID()
                           {
                           return getFacesContext().getViewRoot().getViewId();
                           }


                          Normally, I would assume that getFacesContext() returned null, resulting in the NullPointerException. But since you already refer to the FacesContext earlier in your code, it must be getViewRoot() that returns null. It looks like you already figured this much out since you have debug code to look at the value of the view root:
                          LOG.debug("ctx view root: " + ctx.getViewRoot());


                          What did that debug code show? null I presume?

                          The only thing unusual I see from a JSFUnit point of view is this line of code in your suite() method:
                          System.setProperty("cactus.contextURL","http://localhost:8080/test-jsfunit");


                          You shouldn't need to set that property because it is already set for you in the JSFUnitFilter.

                          Since you've been removing various filters, have you checked each time that the application still runs? If the view root is not being set then that suggests something weird is happening in JSF itself.

                          Stan

                          • 10. Re: JSFUnit on JBoss 4.2.2
                            Wim Vandenhaute Newbie

                            Hey Stan,

                            I removed setting the cactus.contextURL, that was a remainder of some tryouts.

                            The facescontext viewroot indeed returns null


                            DEBUG [HelpdeskTest] ctx view root: null


                            The application still runs yes, just with the seam filter removed it fails a bit further on a page using seam in the view but that is to be expected off course.

                            I will let you know if I find out more.

                            Regards,

                            Wim.

                            • 11. Re: JSFUnit on JBoss 4.2.2
                              Stan Silvert Master

                              If you have a simple example that reproduces the problem, I'd be very interested in taking a look at it. I've never seen this problem with an empty view root before.

                              Thanks,

                              Stan

                              • 12. Re: JSFUnit on JBoss 4.2.2
                                Wim Vandenhaute Newbie

                                Hey Stan,

                                Been quite a while since a follow up but I found out that the problem lies in the Trinidad resources servlet

                                 <servlet>
                                 <servlet-name>resources</servlet-name>
                                 <servlet-class>
                                 org.apache.myfaces.trinidad.webapp.ResourceServlet
                                 </servlet-class>
                                 </servlet>
                                
                                 <servlet-mapping>
                                 <servlet-name>resources</servlet-name>
                                 <url-pattern>/adf/*</url-pattern>
                                 </servlet-mapping>
                                


                                Without this servlet its ok ( then I have some troubles with my webapp using trinidad off course but I'll change that )

                                Regards,
                                Wim.

                                • 13. Re: JSFUnit on JBoss 4.2.2
                                  Stan Silvert Master

                                  Thanks for the update.

                                  Stan