1 2 Previous Next 17 Replies Latest reply on Aug 17, 2010 8:17 AM by Stan Silvert

    JSFUnit with NetBeans

    Stefan Gommer Newbie

      Hallo ich würde JSFUnit gern in NetBeans nutzen. Beim anlegen klappt ja auch alles schön und gut, aber sobald ich die ant-1.5.4,jar Datei einbinde bekomme ich ständig einen Java VM fehler. Wenn diese allerdings fehlt einen "HttpSession Can not found" Fehler. Ebenso kommt der Fehler ("HttpSession Can not found") falls ich die ant-1.8.1.jar einbinde.

       

       

       

       

      fehler.jpg

       

      Test Methode:

      @Test
          public void testPersonGruss() throws IOException{
              JSFSession jsfSession = new JSFSession("/meineSeite.html");

          }

       

      Eingebundene Jar-Dateien:

      jbossjsfunitcore1.2.0.Final.jar
      aspectjrt1.2.1.jar
      cactus131.7.1.jar
      junit3.8.1.jar
      nekohtml1.9.14.jar
      htmlunit2.7.jar
      htmlunitcorejs2.7.jar
      cssparser0.9.5.jar
      commonshttpclient3.1.jar
      commonsio1.4.jar.jar
      sac1.3.jar
      commonslang2.4.jar
      commonscodec1.4.jar
      commonslogging1.1.1.jar
      commonscollections3.2.jar
      cactusant131.7.1.jar
      cargo0.5.jar
      ant1.5.4.jar

      xercesImpl‐2.8.1.jar

      xalan‐2.7.0.jar

        • 1. Re: JSFUnit mit NetBeans
          Stan Silvert Master

          Stefan Gommer wrote:

           


          @Test
              public void testPersonGruss() throws IOException{
                  JSFSession jsfSession = new JSFSession("/meineSeite.html");

              }

           

           

          Sorry, I only speak English.  The line above is probably incorrect.  The argument to JSFSession must map to the FacesServlet.  So it should be something like:

           

          JSFSession jsfSession = new JSFSession("/meineSeite.jsf");

           

          Also, it looks like you are using JUnit 4, annotations.  This will not currently work with JSFUnit.

           

          Stan

          • 2. Re: JSFUnit mit NetBeans
            Stefan Gommer Newbie

            Ohh right. That was my last confused ideer. ^^

            In the test before i used JUnit 3.8.2 and JSFSession jsfSession = new JSFSession("/meineSeite.jsf");

             

            The failurecomes when i am bind the library ant-1.5.4.jar

            Error: Forked Java VM exited abnormally. Please note the time in the report does not reflect the time until the VM exit.

            The failure comes too when i am clean the TestCase. Seems like this:

             

            public void testPersonGruss() throws IOException{

             

            }

            • 3. Re: JSFUnit mit NetBeans
              Stan Silvert Master

              I've see that problem with other (non-JSFUnit) tests.  I get around it by passing -Djunit.fork=false.

               

              Stan

              • 4. Re: JSFUnit mit NetBeans
                Stefan Gommer Newbie

                It sound good. I have set it as a VM Option but it takes no effect

                Can you tell me where i have to set it?

                I Cant believe it. It must be a so small failure but i cant find it

                 

                i'm looket at all setable places with no result. Then i'm searched with google without a result, too.

                 

                I think it must be a problem with ant-1.5.4.jar. Can i disable the NetBeans ant or something like that?

                • 5. Re: JSFUnit mit NetBeans
                  Stan Silvert Master

                  I think you need to set it when the container starts up, rather than when the test starts.  I'm not sure how you are starting the container.

                   

                  Stan

                  • 6. Re: JSFUnit mit NetBeans
                    Stefan Gommer Newbie

                    Thanks a lot,

                    i'm found it in MyProj\nbproject\build-impl.xml.

                     

                    Now comes the failure: caused an ERROR: Can not find HttpSession. Perhaps JSFUnitFilter has not run?

                     


                    JSFUnif_Fehler.jpg

                    I'm searched in the jboss community and found this http://community.jboss.org/message/70785. But it isnt helpfull

                     

                    That was my second trove. http://community.jboss.org/message/69905

                    Has enybody an idee? Need Help ^^

                     

                    That makes a problem: JSFSession jsfSession = new JSFSession("/index.xhtml");

                    • 7. Re: JSFUnit mit NetBeans
                      Stan Silvert Master

                      The argument to JSFSession must map to the FacesServlet.  It's usually something like one of these:

                       

                      new JSFSession("/index.jsf");  // extension mapping

                      new JSFSession("/index.faces"); // extension mapping

                      new JSFSession("/faces/index.xhtml");  // path mapping

                       

                      Stan

                      • 8. Re: JSFUnit mit NetBeans
                        Stefan Gommer Newbie

                        thanks for yout suggestion, but it dont helps.

                        My tests:

                        new JSFSession("/index.jsf");

                        new JSFSession("/faces/index.jsf");

                         

                        new JSFSession("/index.faces");

                        new JSFSession("/faces/index.faces");

                         

                        new  JSFSession("/index.xhtml");

                        new  JSFSession("/faces/index.xhtml");

                         

                        I dont think ist is a Source-Code problem. It seems like a *.jar (Library) problem.

                        Can it be a version problem of my jars or a jar is missing??

                         

                        That are my jar-Files:

                        jbossjsfunitcore1.2.0.Final.jar
                        aspectjrt1.2.1.jar
                        cactus131.7.1.jar
                        junit3.8.1.jar
                        nekohtml1.9.14.jar
                        htmlunit2.7.jar
                        htmlunitcorejs2.7.jar
                        cssparser0.9.5.jar
                        commonshttpclient3.1.jar
                        commonsio1.4.jar.jar
                        sac1.3.jar
                        commonslang2.4.jar
                        commonscodec1.4.jar
                        commonslogging1.1.1.jar
                        commonscollections3.2.jar
                        cactusant131.7.1.jar
                        cargo0.5.jar
                        ant1.5.4.jar

                        xercesImpl‐2.8.1.jar

                        xalan‐2.7.0.jar

                        • 9. Re: JSFUnit mit NetBeans
                          Stan Silvert Master

                          Just make sure your jars are the same as the JSFUnit Getting Started Page.

                           

                          Can you show me your web.xml?

                           

                          Stan

                          • 10. Re: JSFUnit mit NetBeans
                            Stan Silvert Master

                            Stefan Gommer wrote:

                             


                             

                            Now comes the failure: caused an ERROR: Can not find HttpSession. Perhaps JSFUnitFilter has not run?

                             


                             

                            Hi Stefan,

                             

                            I just ran into this problem myself.  If your test does not extend org.apache.cactus.ServletTestCase then you can get this error.  So just make sure to extend ServletTestCase.

                             

                            Stan

                            • 11. Re: JSFUnit mit NetBeans
                              Stefan Gommer Newbie

                              Sry I was away for a long time. Sry that i'm dont tell it to you.

                               

                              No no that isnt my problem. It works fine to test in out of the browser (Firefox) but i cant start the test out of netBeans because i dont know where i have to set the parameter -Dcactus.contextURL=http://localhost:13843/WebAppTest/

                              I have add it at WebAppTest->Properties->run->VM Option but it dont works.

                               

                              I become the result:

                              - Your webapp does not include your test classes,

                              - The cactus.jar is not located in your WEB-INF/lib directory and your Container has not set the Context classloader to point to the webapp one)
                              - Your webapp does not include your test classes,
                              - The cactus.jar is not located in your WEB-INF/lib directory and your Container has not set the Context classloader to point to the webapp one)

                               

                              1) I dont have a lib folder. Thats an error massage for eclipse.

                              2) I create a folder lib and set all libraries in this one. but no effect.

                              3) I already have implement all libraries in my project. Also the cactus.jar

                              • 12. Re: JSFUnit mit NetBeans
                                Stan Silvert Master

                                Ah yes, that would cause it too.

                                 

                                This should be helpful:

                                http://jakarta.apache.org/cactus/integration/manual/howto_config.html

                                 

                                Stan

                                • 13. Re: JSFUnit mit NetBeans
                                  Stefan Gommer Newbie

                                  Thx for helping i'm new and dont know how to do and where to set.

                                  I think it was a little bit helpfull.

                                  I try to set it and it seems like it is better then befor, but i have got another failer:

                                  30.07.2010 16:30:49 org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
                                  INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused: connect
                                  30.07.2010 16:30:49 org.apache.commons.httpclient.HttpMethodDirector executeWithRetry
                                  INFO: Retrying request

                                   

                                  What i have done:

                                  - set the VM Option to: -Dcactus.config=c:/cactus.txt

                                  - the content of cactus.txt is:

                                  cactus.contextURL=http://localhost:8080/WebAppTest/
                                  cactus.servletRedirectorName=ServletRedirector
                                  cactus.jspRedirectorName=JspRedirector
                                  cactus.filterRedirectorName=FilterRedirector

                                  - I already had the filter Code in my web.xml but i replace it by the documentation filter

                                   

                                  I'm happy that the test is try to begin but the Connection was refused

                                  • 14. Re: JSFUnit with NetBeans
                                    yahya hugirat Newbie

                                    hello,

                                    i am trying to use jsfunit with netbeans 6.9 and glassfish, i have follwed the get starting guide but no success, cann you plz

                                    how did you configured your system. maybe it will help me to start using it

                                    1 2 Previous Next