14 Replies Latest reply on Jun 7, 2010 2:16 PM by Stan Silvert

    Trouble getting JSFUnit tests working

    Sean Tiley Newbie

      Hello, I am very new to JSFUnit but am having difficulty getting a simple test case to run.

      I have had various errors and been able to overcome these (with the help of this forum).

      The last error I got was related to
      http://jira.jboss.org/jira/browse/JSFUNIT-65.

      I updated my JTidy jar as suggested but now I am getting the following error and I am not sure what I can do.


      java.lang.OutOfMemoryError: Java heap space
      at java.lang.Object.clone(Native Method)
      at org.w3c.tidy.Node.clone(Node.java:322)
      at org.w3c.tidy.Node.cloneNode(Node.java:1489)
      at org.w3c.tidy.Node.cloneNode(Node.java:1496)
      at org.w3c.tidy.Node.cloneNode(Node.java:1496)
      at org.w3c.tidy.Node.cloneNode(Node.java:1496)
      at org.w3c.tidy.Node.cloneNode(Node.java:1496)
      at org.w3c.tidy.DOMNodeImpl.cloneNode(DOMNodeImpl.java:507)
      at com.meterware.httpunit.ParsedHTML.getDOM(ParsedHTML.java:971)
      at com.meterware.httpunit.WebResponse.getDOM(WebResponse.java:538)
      at org.jboss.jsfunit.facade.JSFClientSession.doWebRequest(JSFClientSession.java:189)
      at org.jboss.jsfunit.facade.JSFClientSession.doInitialRequest(JSFClientSession.java:122)
      at org.jboss.jsfunit.facade.JSFClientSession.(JSFClientSession.java:75)
      at com.msc.compass.jsf.JSFUnitTest.testInitialPage(JSFUnitTest.java:17)
      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 junit.framework.TestCase.runTest(TestCase.java:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      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)


      The SEAM app is working as I can get to it via a browser. The app is deployed to Tomcat 6.0.14, JDK 1.6.0_03.

      I am using Eclipse 3.3 to author my test cases.

      Any ideas / suggestions would be greatly appreciated.

      Thanks
      Sean

        • 1. Re: Trouble getting JSFUnit tests working
          Stan Silvert Master

          You probably just need to allocate more heap space. But you can also get OutOfMemoryError for strange reasons sometimes. Here is a good tutorial:
          OutOfMemoryExceptions

           

          Stan

          • 2. Re: Trouble getting JSFUnit tests working
            Sean Tiley Newbie

            Thanks for the reply Stan.
            I set the JAVA_OPTS in the environment variables to the following
            -Xmx512m -Xms128m and now, at least I am seeing the JUNIT report in the browser, but the error message is the same


            Summary
            Tests Failures Errors Success rate Time
            1 0 1 0.00% 17.361
            Note: failures are anticipated and checked for with assertions while errors are unanticipated.

            --------------------------------------------------------------------------------

            TestCase org.jboss.foo.JSFUnitTest
            Name Status Type Time(s)
            testInitialPage Error Java heap space

            java.lang.OutOfMemoryError: Java heap space
            at java.lang.Object.clone(Native Method)
            at org.w3c.tidy.Node.clone(Node.java:322)
            at org.w3c.tidy.Node.cloneNode(Node.java:1489)
            at org.w3c.tidy.Node.cloneNode(Node.java:1496)
            at org.w3c.tidy.Node.cloneNode(Node.java:1496)
            at org.w3c.tidy.Node.cloneNode(Node.java:1496)
            at org.w3c.tidy.DOMNodeImpl.cloneNode(DOMNodeImpl.java:507)
            at com.meterware.httpunit.ParsedHTML.getDOM(ParsedHTML.java:975)
            at com.meterware.httpunit.WebResponse.getDOM(WebResponse.java:538)
            at org.jboss.jsfunit.facade.JSFClientSession.doWebRequest(JSFClientSession.java:189)
            at org.jboss.jsfunit.facade.JSFClientSession.doInitialRequest(JSFClientSession.java:122)
            at org.jboss.jsfunit.facade.JSFClientSession.(JSFClientSession.java:75)
            at org.jboss.foo.JSFUnitTest.testInitialPage(JSFUnitTest.java:47)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            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)

            • 3. Re: Trouble getting JSFUnit tests working
              Stan Silvert Master

              Did you try reducing the size of the thread stack (bottom of the tutorial)?

              BTW, what app server are you using?

              Stan

              • 4. Re: Trouble getting JSFUnit tests working
                Sean Tiley Newbie

                Hi there,
                I am using JDK 1.6, Tomcat 6.0.14 On WinXP 64 bit with 8 GB Ram

                I tried the following settings for JAVA_OPTS (each line)

                -Xmx512m -Xms128m -Xss128k
                -Xmx1024m -Xms256m -Xss128k
                -Xss128k

                I set these values in the Windows Environment variables and in the catalina batch file

                What I am struggling with is that the SEAM application works fine when I hit it in IE, why does my simple test case (just navigate to the login screen) require more memory.

                Looking at the stack trace, it looks like it is coming from tidy so I used tidy to validate the response I get in IE and there are no reported issues.

                 public void testInitialPage() throws IOException, SAXException
                 {
                 // Send an HTTP request for the initial page
                 JSFClientSession client = null;
                 client = new JSFClientSession("/login.seam");
                
                 // A JSFServerSession gives you access to JSF state
                 JSFServerSession server = new JSFServerSession(client);
                
                 }
                


                I am not sure where the response is available for inspection but can I
                somehow get the response from the initial request and see what it is?


                Interestingly
                I decided to try the ready-made war from this wiki page
                http://wiki.jboss.org/wiki/GettingStartedGuide and am getting the exact same error running the tests as described on that URL as I am running my test against my application.


                Unit Test Results
                Designed for use with Cactus.

                --------------------------------------------------------------------------------

                Summary
                Tests Failures Errors Success rate Time
                1 0 1 0.00% 3.422
                Note: failures are anticipated and checked for with assertions while errors are unanticipated.

                --------------------------------------------------------------------------------

                TestCase org.jboss.foo.JSFUnitTest
                Name Status Type Time(s)
                testInitialPage Error Java heap space

                java.lang.OutOfMemoryError: Java heap space
                at java.lang.Object.clone(Native Method)
                at org.w3c.tidy.Node.clone(Node.java:322)
                at org.w3c.tidy.Node.cloneNode(Node.java:1489)
                at org.w3c.tidy.Node.cloneNode(Node.java:1496)
                at org.w3c.tidy.Node.cloneNode(Node.java:1496)
                at org.w3c.tidy.Node.cloneNode(Node.java:1496)
                at org.w3c.tidy.DOMNodeImpl.cloneNode(DOMNodeImpl.java:507)
                at com.meterware.httpunit.ParsedHTML.getDOM(ParsedHTML.java:975)
                at com.meterware.httpunit.WebResponse.getDOM(WebResponse.java:538)
                at org.jboss.jsfunit.facade.JSFClientSession.doWebRequest(JSFClientSession.java:189)
                at org.jboss.jsfunit.facade.JSFClientSession.doInitialRequest(JSFClientSession.java:122)
                at org.jboss.jsfunit.facade.JSFClientSession.(JSFClientSession.java:75)
                at org.jboss.foo.JSFUnitTest.testInitialPage(JSFUnitTest.java:47)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                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)



                • 5. Re: Trouble getting JSFUnit tests working
                  Stan Silvert Master

                  I tried the Getting Started WAR with:
                  Windows Vista
                  Tomcat 6.0.14
                  JDK 1.5
                  add commons-el-1.0.jar
                  add commons-logging-1.0.jar

                  Everything worked fine.

                  When I switched to JDK 1.6, I got:
                  java.lang.AbstractMethodError: org.w3c.tidy.DOMDocumentImpl.getXmlStandalone()

                  Switching to jtidy-8.0-20060730.195103-1.jar, I got:
                  java.lang.OutOfMemoryError: Java heap space

                  Switching to jtidy-8.0-20060801.131059-3.jar, I got:
                  java.lang.NoSuchMethodError: org.w3c.tidy.Tidy.setCharEncoding(I)V

                  Changing JSFUnit core to use Neko instead of JTidy, I got (JDK 1.5 and 1.6):
                  java.lang.NoClassDefFoundError: org/apache/xerces/xni/parser/XMLPullParserConfiguration

                  Changing back to jtidy-8.0-20060730.195103-1.jar and JDK 1.6, I set -Xms1024m. I got:
                  java.lang.OutOfMemoryError: Java heap space
                  But the test took 58 seconds to run out of heap!

                  So the problem appears to be with JDK 1.6. I found these two links:
                  http://forum.java.sun.com/thread.jspa?threadID=5235829
                  http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6536111

                  A couple of things about this JDK bug:
                  1) In our case, I don't think we have really huge XML. Increasing heap size just makes it take longer to run out of memory.
                  2) Despite 28 votes, Sun has deemed this bug a low priority!!

                  For now it looks like the only course of action is to use JDK 1.5. Has anyone else had success with JSFUnit and JDK 1.6?

                  Stan

                  • 6. Re: Trouble getting JSFUnit tests working
                    Sean Tiley Newbie

                    Thanks again for all your help, it is working now.

                    I do have another question.

                    I am writing tests and one of the pages I am testing has 2 tabs (<rich:tab/>)

                    How in JSFUnit can I click on one of these.

                    The source for the tab is as follows

                    <rich:tab label="WORKING ON" id="WORKINGON">

                    <rich:dataTable id="workingTasks"
                    var="task"
                    value="#{tasks}"
                    rendered="#{tasks.rowCount>0}"
                    border="1"
                    rowClasses="oddrow,evenrow"
                    styleClass="tableContent">

                    Any help is appreciated

                    Sean

                    • 7. Re: Trouble getting JSFUnit tests working
                      Stan Silvert Master

                      You use the RichFacesClient.clickTab() method. See http://labs.jboss.com/file-access/default/members/jsfunit/freezone/apidocs/org/jboss/jsfunit/richfaces/RichFacesClient.html


                      Also see the live JSFUnit/RichFaces demo for lots of JSFUnit code examples:
                      http://labs.jboss.com/jsfunit/demo.html

                      BTW, in the future, please start a new thread for new questions.

                      Thanks for your interest in JSFUnit,

                      Stan

                      • 8. Re: Trouble getting JSFUnit tests working
                        easy rider Newbie

                        What was the solution? I have the same problem (java.lang.OutOfMemoryError: Java heap space)

                         


                        Spring 3.0.2, tomcat 6 , jsf 1.2, jsfunit 1.2 , JDK 1.6

                         

                         

                         

                        Thanx in advance

                        • 9. Re: Trouble getting JSFUnit tests working
                          Stan Silvert Master

                          easy rider wrote:

                           

                          What was the solution? I have the same problem (java.lang.OutOfMemoryError: Java heap space)

                           


                          Spring 3.0.2, tomcat 6 , jsf 1.2, jsfunit 1.2 , JDK 1.6

                           

                           

                           

                          Thanx in advance

                           

                          I think the solution was to use Neko instead of Tidy.  We don't use Tidy any more.

                           

                          It's hard to say why you are getting an OutOfMemoryError.  It can be caused by a lot of things.  Here is a good place to start in evaluating the problem:

                          OutOfMemoryExceptions

                           

                          Stan

                          • 10. Re: Trouble getting JSFUnit tests working
                            easy rider Newbie

                            My stacktrace:

                             

                            java.lang.OutOfMemoryError: Java heap space

                                at java.util.Arrays.copyOfRange(Unknown Source)

                                at java.lang.String.<init>(Unknown Source)

                                at net.sourceforge.htmlunit.corejs.javascript.Decompiler.sourceToString(Decompiler.java:272)

                                at net.sourceforge.htmlunit.corejs.javascript.Decompiler.getEncodedSource(Decompiler.java:113)

                                at net.sourceforge.htmlunit.corejs.javascript.IRFactory.transformTree(IRFactory.java:102)

                                at net.sourceforge.htmlunit.corejs.javascript.Context.compileImpl(Context.java:2430)

                                at net.sourceforge.htmlunit.corejs.javascript.Context.compileString(Context.java:1383)

                                at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory$TimeoutContext.compileString(HtmlUnitContextFactory.java:174)

                                at net.sourceforge.htmlunit.corejs.javascript.Context.compileString(Context.java:1372)

                                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$2.doRun(JavaScriptEngine.java:373)

                                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:521)

                                at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)

                                at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)

                                at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.compile(JavaScriptEngine.java:382)

                                at com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:1057)

                                at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:967)

                                at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:353)

                                at com.gargoylesoftware.htmlunit.html.HtmlScript$1.execute(HtmlScript.java:215)

                                at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:235)

                                at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:718)

                                at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)

                                at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:676)

                                at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1136)

                                at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1038)

                                at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:206)

                                at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:329)

                                at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:2999)

                                at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1991)

                                at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:895)

                                at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499)

                                at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452)

                                at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

                             

                             

                              We use RichFaces 3.3.3.

                             

                            Any ideas ?

                            • 11. Re: Trouble getting JSFUnit tests working
                              Stan Silvert Master

                              The stack trace only tells what was happening when you finally ran out of heap.  It may or may not be related to the thing that is gobbling up your heap space.

                               

                              What have you tried?  Have you read the page I suggested and followed the related links?  The solution may be as simple as allocating more heap space.

                               

                              Stan

                              • 12. Re: Trouble getting JSFUnit tests working
                                easy rider Newbie

                                I've tried to increse heap space for my Eclipse. The current settings:

                                 

                                --launcher.XXPermSize
                                128m
                                --launcher.XXMaxPermSize
                                256m
                                -vmargs
                                -Xms128m
                                -Xmx512m

                                 

                                But with no effect.

                                 

                                Any three of my tests go through, the fourth one causes OutOfMemoryEception. Should i post the whole stacktrace ?

                                • 13. Re: Trouble getting JSFUnit tests working
                                  easy rider Newbie

                                  My full stacktrace before i get java.lang.OutOfMemoryError: Java heap space

                                   

                                   

                                  WARN  htmlunit.IncorrectnessListenerImpl - Obsolete content type encountered: 'text/javascript'.
                                  WARN  html.HTMLDocument - getElementById(script1275885493300) did a getElementByName for Internet Explorer
                                  ERROR javascript.StrictErrorReporter - runtimeError: message=[The data necessary to complete this operation is not yet available.] sourceName=[http://localhost:8080/ServiceRepo/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf] line=[5715] lineSource=[null] lineOffset=[0]
                                  ERROR javascript.StrictErrorReporter - runtimeError: message=[The data necessary to complete this operation is not yet available.] sourceName=[http://localhost:8080/ServiceRepo/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf] line=[5715] lineSource=[null] lineOffset=[0]
                                  ERROR javascript.StrictErrorReporter - runtimeError: message=[The data necessary to complete this operation is not yet available.] sourceName=[http://localhost:8080/ServiceRepo/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf] line=[5715] lineSource=[null] lineOffset=[0]
                                  WARN  htmlunit.IncorrectnessListenerImpl - Obsolete content type encountered: 'text/javascript'.
                                  ERROR background.JavaScriptJobManagerImpl - Job run failed with unexpected RuntimeException: TypeError: Cannot call method "appendChild" of null (http://localhost:8080/ServiceRepo/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf#5745)


                                  ======= EXCEPTION START ========
                                  EcmaError: lineNumber=[5745] column=[0] lineSource=[null] name=[TypeError] sourceName=[http://localhost:8080/ServiceRepo/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf] message=[TypeError: Cannot call method "appendChild" of null (http://localhost:8080/ServiceRepo/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf#5745)]
                                  com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot call method "appendChild" of null (http://localhost:8080/ServiceRepo/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf#5745)
                                      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:527)
                                      at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
                                      at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
                                      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:457)
                                      at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:910)
                                      at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptFunctionJob.runJavaScript(JavaScriptFunctionJob.java:53)
                                      at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptExecutionJob.run(JavaScriptExecutionJob.java:76)
                                      at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl$ExecutingJobTracker.run(JavaScriptJobManagerImpl.java:101)
                                      at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
                                      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
                                      at java.util.concurrent.FutureTask.run(Unknown Source)
                                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
                                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
                                      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
                                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                                      at java.lang.Thread.run(Unknown Source)
                                  Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: TypeError: Cannot call method "appendChild" of null (http://localhost:8080/ServiceRepo/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf#5745)
                                      at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3753)
                                      at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3731)
                                      at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3759)
                                      at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3778)
                                      at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.undefCallError(ScriptRuntime.java:3797)
                                      at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2317)
                                      at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2310)
                                      at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1515)
                                      at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
                                      at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
                                      at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:429)
                                      at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:264)
                                      at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3157)
                                      at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
                                      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:485)
                                      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$4.doRun(JavaScriptEngine.java:450)
                                      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:521)
                                      ... 15 more
                                  Enclosed exception:
                                  net.sourceforge.htmlunit.corejs.javascript.EcmaError: TypeError: Cannot call method "appendChild" of null (http://localhost:8080/ServiceRepo/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf#5745)
                                      at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3753)
                                      at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3731)
                                      at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3759)
                                      at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3778)
                                      at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.undefCallError(ScriptRuntime.java:3797)
                                      at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2317)
                                      at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2310)
                                      at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1515)
                                      at script(http://localhost:8080/ServiceRepo/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf:5745)
                                      at script(http://localhost:8080/ServiceRepo/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf:5700)
                                      at script(http://localhost:8080/ServiceRepo/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf:4931)
                                      at script(http://localhost:8080/ServiceRepo/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf:5700)
                                      at script(http://localhost:8080/ServiceRepo/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf:5718)
                                      at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
                                      at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
                                      at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:429)
                                      at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:264)
                                      at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3157)
                                      at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
                                      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:485)
                                      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$4.doRun(JavaScriptEngine.java:450)
                                      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:521)
                                      at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
                                      at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
                                      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:457)
                                      at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:910)
                                      at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptFunctionJob.runJavaScript(JavaScriptFunctionJob.java:53)
                                      at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptExecutionJob.run(JavaScriptExecutionJob.java:76)
                                      at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl$ExecutingJobTracker.run(JavaScriptJobManagerImpl.java:101)
                                      at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
                                      at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
                                      at java.util.concurrent.FutureTask.run(Unknown Source)
                                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
                                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
                                      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
                                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                                      at java.lang.Thread.run(Unknown Source)
                                  == CALLING JAVASCRIPT ==

                                   

                                    function () {
                                        if (O.isReady) {
                                            return;
                                        }
                                        try {
                                            document.documentElement.doScroll("left");
                                        }
                                        catch (e) {
                                            setTimeout(arguments.callee, 0);
                                            return;
                                        }
                                        O.ready();
                                    }

                                   

                                  ======= EXCEPTION END ========

                                  • 14. Re: Trouble getting JSFUnit tests working
                                    Stan Silvert Master

                                    easy rider wrote:

                                     

                                    My full stacktrace before i get java.lang.OutOfMemoryError: Java heap space

                                     

                                     


                                    ERROR background.JavaScriptJobManagerImpl - Job run failed with unexpected RuntimeException: TypeError: Cannot call method "appendChild" of null (http://localhost:8080/ServiceRepo/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf#5745)


                                    ======= EXCEPTION START ========
                                    EcmaError: lineNumber=[5745] column=[0] lineSource=[null] name=[TypeError] sourceName=[http://localhost:8080/ServiceRepo/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf] message=[TypeError: Cannot call method "appendChild" of null (http://localhost:8080/ServiceRepo/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf#5745)]
                                    com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot call method "appendChild" of null (http://localhost:8080/ServiceRepo/a4j/g/3_3_3.Final/org/ajax4jsf/framework.pack.js.jsf#5745)
                                        at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:527)
                                      
                                    == CALLING JAVASCRIPT ==

                                     

                                      function () {
                                          if (O.isReady) {
                                              return;
                                          }
                                          try {
                                              document.documentElement.doScroll("left");
                                          }
                                          catch (e) {
                                              setTimeout(arguments.callee, 0);
                                              return;
                                          }
                                          O.ready();
                                      }

                                     

                                    ======= EXCEPTION END ========

                                    I'm not sure if that previous error is the thing that is eating your heap, but it's possible.

                                     

                                    I found someone else who got the "appendChild of null" error.  The HtmlUnit guys, Marc and Daniel, say that it's either a bug in your javascript or in their code.  But I'm not sure how much that helps.  You might need to bring this to the attention of the HtmlUnit team.

                                     

                                    http://markmail.org/message/3gi2xxi4vlixla46#query:%22Cannot%20call%20method%20appendChild%20of%20null%22+page:1+mid:znzyioc33bys5d3g+state:results

                                     

                                    Stan