13 Replies Latest reply on Feb 2, 2011 7:12 AM by dimarzio

    Netbeans, JSFUnit & Glassfish 3.0.1 doesn't work

    dimarzio

      Hello everybody,

       

      So the problem is pretty simple I have already read all documentation & discussions here and 50% of the stuff realy works. But I need another 50 % too

       

      I have the following problem, when I add all JSFUnit (1.3.0) libraries to my project it doesn't work anymore. I get the whole time 404 not found error. There are also any exceptions in the glassfish log. (And yes it is Servlet 3.0... you know) Well, if I try to start the JSFUnit console it works! I can even find my first JSFUnit Test, but it fails, because my application doesn't works...

       

      Any thoughts how can I solve it?

        • 1. Netbeans, JSFUnit & Glassfish 3.0.1 doesn't work
          dimarzio

          Forget to provide an important information: I use maven 3 to manage my dependencies. When I remove all JSFUnit dependencies from my pom it works pretty fine...

          • 2. Re: Netbeans, JSFUnit & Glassfish 3.0.1 doesn't work
            dimarzio

            I just tried it with the demo example hellojsfJEE5. Well I can deploy it and I can start it. But when I try to execute the tests I get 500 Internal Server Error...

             

            com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 500 Internal Server Error for http://localhost:8080/hellojsfJEE5/index.faces

             

             

            The demo example for JBoss 6 shows me the same exeptions. But the good news: some tests are passed! I mean I can see something like Expected A but was B. But the most tests are fail: 500 Internal Server Error

            • 3. Netbeans, JSFUnit & Glassfish 3.0.1 doesn't work
              ssilvert

              Dmitriy Neretin wrote:

               

              com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 500 Internal Server Error for http://localhost:8080/hellojsfJEE5/index.faces

               

              A 500 Internal Server Error means that there was an error executing the application and you need to look at the server's log to find the problem.  What does the server log say?

               

              Stan

              • 4. Re: Netbeans, JSFUnit & Glassfish 3.0.1 doesn't work
                dimarzio

                Thank you for the feedback!

                 

                So, after I tried to start the example .war on the AS 6 the log file is saying:

                 

                 

                2011-01-31 15:05:10,745 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/hellojsfJBoss5].[Faces Servlet]] (http-127.0.0.1-8080-3) Servlet.service() for servlet Faces Servlet threw exception: java.lang.UnsupportedOperationException

                    at javax.faces.context.ExternalContext.getResponseOutputWriter(ExternalContext.java:1223) [:2.0.3-]

                    at com.sun.faces.application.view.JspViewHandlingStrategy.renderView(JspViewHandlingStrategy.java:202) [:2.0.3-]

                    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127) [:2.0.3-]

                    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117) [:2.0.3-]

                ...

                And this for each JSFUnit Test. I get actually the same exception if I try to start the glassfish war

                • 5. Re: Netbeans, JSFUnit & Glassfish 3.0.1 doesn't work
                  ssilvert

                  Can you attach the WAR?

                   

                  Stan

                  • 6. Re: Netbeans, JSFUnit & Glassfish 3.0.1 doesn't work
                    dimarzio

                    Stan Silvert schrieb:

                     

                    Can you attach the WAR?

                     

                    Stan

                    These are the WAR examples from this page

                     

                    http://community.jboss.org/servlet/JiveServlet/download/9819-33-6172/hellojsfJEE5.war

                    http://community.jboss.org/servlet/JiveServlet/download/9819-33-6173/hellojsfJBoss5.war

                     

                    That's it why I am so wondering...

                    • 7. Re: Netbeans, JSFUnit & Glassfish 3.0.1 doesn't work
                      dimarzio

                      Oh my G-O-D It was working all the time!

                       

                      The Problem was, that the application URL was changed! At the beginning it was simply: localhost:8080/myjsfapp and after I added the jsfunit libraries it changed to localhost:8080/myjsfapp/index.jsfunit and if I want rich the jsfunit console I should enter localhost:8080/myjsfapp/jsfunit/index.jsfunit How I found it out? I just deployed my application into the AS 6 and clicked Launch... And it showed me the right URL

                       

                      What did I do wrong? Can somebody explain me?

                       

                      But what I still don't understand, why the example WAR's from this page doesn't work? The tests I wrote for my application are failed too Any ideas?

                      • 8. Re: Netbeans, JSFUnit & Glassfish 3.0.1 doesn't work
                        ssilvert

                        Here is what I found out about the example app.

                         

                        I think there is a bug here, but I have found a workaround.  Those particular WARs your referenced were written to run against JSF 1.2.  So in JBoss AS6, you will need to include this in your web.xml:

                            <context-param>
                              <param-name>org.jboss.jbossfaces.JSF_CONFIG_NAME</param-name>
                              <param-value>Mojarra-1.2</param-value>
                           </context-param>
                        

                         

                        That will run the app under Mojarra 1.2 and get rid of your UnsupportedOperationExceptions.

                         

                        Also, you will need to make sure your web.xml uses the web-app 3.0 xsd:

                        <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
                            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                            xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
                        

                         

                        I don't yet know why this is the case, but you need to do that for JSP-based JSF apps.  Otherwise, it won't bind JSF/JSP components to the managed  beans.

                         

                        Stan

                        • 9. Re: Netbeans, JSFUnit & Glassfish 3.0.1 doesn't work
                          ssilvert

                          Dmitriy Neretin wrote:

                           

                          Oh my G-O-D It was working all the time!

                           

                          The Problem was, that the application URL was changed! At the beginning it was simply: localhost:8080/myjsfapp and after I added the jsfunit libraries it changed to localhost:8080/myjsfapp/index.jsfunit and if I want rich the jsfunit console I should enter localhost:8080/myjsfapp/jsfunit/index.jsfunit How I found it out? I just deployed my application into the AS 6 and clicked Launch... And it showed me the right URL

                           

                          What did I do wrong? Can somebody explain me?

                           

                          That's very strange.  It shouldn't change the extension mapped to the FacesServlet.  That's a bug.

                          • 10. Re: Netbeans, JSFUnit & Glassfish 3.0.1 doesn't work
                            dimarzio

                            Stan Silvert schrieb:

                             

                            That's very strange.  It shouldn't change the extension mapped to the FacesServlet.  That's a bug.

                            I don't really figure out why and how it was happend That's why I would propose you make an new entry in the Jira You are right, I use JSF 2.0 with facelets (Mojara 2.0.2 with component library primefaces RC 2.0.2).

                             

                            And a very big thanks to you !

                            • 11. Re: Netbeans, JSFUnit & Glassfish 3.0.1 doesn't work
                              dimarzio

                              Last news: tests runs

                               

                              And the last question: is it possible to disable javascript when I check my facelets pages? jQuery failures dont't interest me

                              • 12. Re: Netbeans, JSFUnit & Glassfish 3.0.1 doesn't work
                                ssilvert

                                Sounds like you might want to do this:

                                 

                                jsfSession.getWebClient().setJavaScriptEnabled(false);

                                 

                                or

                                 

                                jsfSession.getWebClient().setThrowExceptionOnScriptError(false);

                                 

                                See http://htmlunit.sourceforge.net/apidocs/com/gargoylesoftware/htmlunit/WebClient.html

                                 

                                Stan

                                • 13. Re: Netbeans, JSFUnit & Glassfish 3.0.1 doesn't work
                                  dimarzio

                                  Strange, it didn't work...

                                   

                                  My start page contains following tag: h:outputScript library="js" name="jquery-1.4.4.min.js" If I left it uncommented JSFUnit performs the js check.