3 Replies Latest reply on Apr 16, 2010 8:00 AM by ssilvert

    Empty page after adding JSFUnit jar to NetBeans project

    stanax

      Hello
      I am using JSF : Sun JSF RI 2.0.x Mojarra and I tried to use JSFUnit in NEtBeans/Eclipse, I created new web dynamic project , do simple JSF page and run on server, everything OK, but when I added to project JSFUnit library and try to run my application on server, empty page is shown, but in HTML code is JSF tags. It seems to some problem with web.xml or something else. I tried it with JSFUnit wersions 1.0 and 1.2.
      Where could be problem?
      Thanks for answer
                 Ales
          

        • 1. Re: Empty page after adding JSFUnit jar to NetBeans project
          ssilvert

          It looks like a problem mapping to the Faces Servlet.  But I can't think of why just putting the JSFUnit jar in there would cause a problem.  It does cause wrapping of the FacesContext, but it only does that when you are running a test.

           

          Have you tried using file extension mapping instead of path mapping?

           

          Stan

          • 2. Re: Empty page after adding JSFUnit jar to NetBeans project
            stanax

            You mean change in web.xml

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

             

            to <url-pattern>*.xhtml</url-pattern>   ?

            This still not works.

             

            In simple Hello Word aplication(only one index.xhtml page, no java classes) it throws :

             

            java.lang.NullPointerException in web browser 

            WARNING: ApplicationDispatcher[/HelloWordJSF] PWC1231: Servlet.service() for servlet Faces Servlet threw exception
            javax.servlet.ServletException: PWC1232: Exceeded maximum depth for nested request dispatches: 20
                    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:787)
                    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:664)
                    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:497)

             

            .......

             

            WARNING: ApplicationDispatcher[/HelloWordJSF] PWC1231: Servlet.service() for servlet Faces Servlet threw exception
            java.lang.NullPointerException
                    at com.sun.faces.context.flash.ELFlash.getPhaseMapForReading(ELFlash.java:748)
                    at com.sun.faces.context.flash.ELFlash.isEmpty(ELFlash.java:466)
                    at com.sun.faces.facelets.util.DevTools.writeVariables(DevTools.java:318)
                    at com.sun.faces.facelets.util.DevTools.writeVariables(DevTools.java:208)
                    at com.sun.faces.facelets.util.DevTools.debugHtml(DevTools.java:123)
                    at com.sun.faces.renderkit.RenderKitUtils.renderHtmlErrorPage(RenderKitUtils.java:1139)

             

            Before adding Jars it works, after adding it shows this.

             

            I am using NetBeans and GlassFish.And I create simply project, then I add jars and then I run it by NetBeans on server. I dont use ant, maven or something else for it.

             

                          Ales

            • 3. Re: Empty page after adding JSFUnit jar to NetBeans project
              ssilvert

              Ales Stanko wrote:

               

              You mean change in web.xml

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

               

              to <url-pattern>*.xhtml</url-pattern>   ?

              This still not works.

               

              No.  With extension mapping, you do it like this:

               

                 {code}<servlet-mapping>
                      <servlet-name>Faces Servlet</servlet-name>
                      <url-pattern>*.jsf</url-pattern>
                  </servlet-mapping>{code}

               

              Then you call http://localhost:8080/MyTime/index.jsf.  JSF is responsible for loading /index.xhtml.  BTW, are you putting this in /faces/index.html?  It should be in the root.

               

              I know there are others who use JSFUnit with Glassfish, but it's not one of the containers I test against.

               

              Stan