1 2 Previous Next 26 Replies Latest reply on Jun 19, 2008 7:12 PM by Stan Silvert

    Wrapped java.lang.RuntimeException: Could not retrieve XPath

    Brian Gregory Newbie

      I've managed to come up with a simple case that illustrates this exception:
      It appears to be related to reRender="" attribute in a4j controls.

      ======= EXCEPTION START ========
      Exception class=[org.mozilla.javascript.WrappedException]
      com.gargoylesoftware.htmlunit.ScriptException: Wrapped java.lang.RuntimeException: Could not retrieve XPath >//parsererror< on HtmlHtml[<html xmlns="http://www.w3.org/1999/xhtml">] (http://localhost:8080/project/a4j_3_2_1-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript.faces#48)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:534)
      at org.mozilla.javascript.Context.call(Context.java:499)
      at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:445)
      at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:912)
      at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:143)
      at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:156)
      at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:551)
      at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:1231)
      at org.mozilla.javascript.Context.call(Context.java:499)
      at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511)
      at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:1235)
      at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:120)
      at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:93)
      at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:72)
      at org.jboss.jsfunit.jsfsession.JSFClientSession.click(JSFClientSession.java:171)
      at com.g_webdesign.NavTestCase.testAjaxButton(NavTestCase.java:50)
      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)
      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:122)
      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:595)
      Caused by: org.mozilla.javascript.WrappedException: Wrapped java.lang.RuntimeException: Could not retrieve XPath >//parsererror< on HtmlHtml[<html xmlns="http://www.w3.org/1999/xhtml">] (http://localhost:8080/project/a4j_3_2_1-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript.faces#48)
      at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1654)
      at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:175)
      at org.mozilla.javascript.ScriptableObject.getImpl(ScriptableObject.java:1980)
      at org.mozilla.javascript.ScriptableObject.get(ScriptableObject.java:280)
      at com.gargoylesoftware.htmlunit.javascript.SimpleScriptable.get(SimpleScriptable.java:64)
      at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1575)
      at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1397)
      at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1383)
      at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3054)
      at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
      at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:473)
      at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.setState(XMLHttpRequest.java:141)
      at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.doSend(XMLHttpRequest.java:412)
      at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxFunction_send(XMLHttpRequest.java:350)
      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.mozilla.javascript.MemberBox.invoke(MemberBox.java:160)
      at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:474)
      at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3335)
      at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
      at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
      at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
      at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:169)
      at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003)
      at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:160)
      at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:77)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:473)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:438)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:530)
      ... 56 more
      Caused by: java.lang.RuntimeException: Could not retrieve XPath >//parsererror< on HtmlHtml[<html xmlns="http://www.w3.org/1999/xhtml">]
      at com.gargoylesoftware.htmlunit.html.xpath.XPathUtils.getByXPath(XPathUtils.java:85)
      at com.gargoylesoftware.htmlunit.javascript.host.HTMLCollection.computeElements(HTMLCollection.java:248)
      at com.gargoylesoftware.htmlunit.javascript.host.HTMLCollection.getElements(HTMLCollection.java:235)
      at com.gargoylesoftware.htmlunit.javascript.host.HTMLCollection.jsxGet_length(HTMLCollection.java:393)
      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.mozilla.javascript.MemberBox.invoke(MemberBox.java:160)
      ... 86 more
      Caused by: java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage
      at com.gargoylesoftware.htmlunit.html.HtmlElement.getPage(HtmlElement.java:1475)
      at com.gargoylesoftware.htmlunit.html.HtmlElement.getPage(HtmlElement.java:78)
      at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.<init>(EventHandler.java:53)
      at com.gargoylesoftware.htmlunit.javascript.host.HTMLElement.createEventHandler(HTMLElement.java:200)
      at com.gargoylesoftware.htmlunit.javascript.host.HTMLElement.setDomNode(HTMLElement.java:187)
      at com.gargoylesoftware.htmlunit.javascript.host.FormField.setDomNode(FormField.java:47)
      at com.gargoylesoftware.htmlunit.javascript.SimpleScriptable.makeScriptableFor(SimpleScriptable.java:216)
      at com.gargoylesoftware.htmlunit.javascript.host.XMLDocument.makeScriptableFor(XMLDocument.java:171)
      at com.gargoylesoftware.htmlunit.html.DomNode.getScriptObject(DomNode.java:832)
      at com.gargoylesoftware.htmlunit.javascript.NamedNodeMap.<init>(NamedNodeMap.java:73)
      at com.gargoylesoftware.htmlunit.html.HtmlElement.getAttributes(HtmlElement.java:561)
      at org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.nextNode(DOM2DTM.java:530)
      at org.apache.xml.dtm.ref.DTMDefaultBaseTraversers$IndexedDTMAxisTraverser.getNextIndexed(DTMDefaultBaseTraversers.java:570)
      at org.apache.xml.dtm.ref.DTMDefaultBaseTraversers$DescendantFromRootTraverser.first(DTMDefaultBaseTraversers.java:1734)
      at org.apache.xpath.axes.DescendantIterator.nextNode(DescendantIterator.java:211)
      at org.apache.xpath.axes.NodeSequence.nextNode(NodeSequence.java:281)
      at org.apache.xpath.axes.NodeSequence.runTo(NodeSequence.java:435)
      at org.apache.xml.dtm.ref.DTMNodeList.<init>(DTMNodeList.java:79)
      at org.apache.xpath.objects.XNodeSet.nodelist(XNodeSet.java:339)
      at com.gargoylesoftware.htmlunit.html.xpath.XPathUtils.getByXPath(XPathUtils.java:66)
      ... 94 more
      WrappedException: org.mozilla.javascript.WrappedException: Wrapped java.lang.RuntimeException: Could not retrieve XPath >//parsererror< on HtmlHtml[<html xmlns="http://www.w3.org/1999/xhtml">] (http://localhost:8080/project/a4j_3_2_1-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript.faces#48)
      at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1654)
      at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:175)
      at org.mozilla.javascript.ScriptableObject.getImpl(ScriptableObject.java:1980)
      at org.mozilla.javascript.ScriptableObject.get(ScriptableObject.java:280)
      at com.gargoylesoftware.htmlunit.javascript.SimpleScriptable.get(SimpleScriptable.java:64)
      at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1575)
      at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1397)
      at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1383)
      at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3054)
      at script(http://localhost:8080/project/a4j_3_2_1-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript.faces:48)
      at script(http://localhost:8080/project/a4j_3_2_1-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript.faces:86)
      at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
      at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:473)
      at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.setState(XMLHttpRequest.java:141)
      at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.doSend(XMLHttpRequest.java:412)
      at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxFunction_send(XMLHttpRequest.java:350)
      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.mozilla.javascript.MemberBox.invoke(MemberBox.java:160)
      at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:474)
      at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3335)
      at script(http://localhost:8080/project/a4j_3_2_1-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript.faces:91)
      at script(http://localhost:8080/project/a4j_3_2_1-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript.faces:147)
      at script(http://localhost:8080/project/a4j_3_2_1-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript.faces:146)
      at script(onclick event for HtmlButtonInput[<input id="mainDisplay:j_id5:commandButton" name="mainDisplay:j_id5:commandButton" onclick="A4J.AJAX.Submit(&apos;_viewRoot&apos;,&apos;mainDisplay:j_id5&apos;,event,{&apos;parameters&apos;:{&apos;mainDisplay:j_id5:commandButton&apos;:&apos;mainDisplay:j_id5:commandButton&apos;} ,&apos;actionUrl&apos;:&apos;/project/refresh.faces&apos;} );return false;" value="Refresh" type="button">]:1)
      at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
      at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
      at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
      at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:169)
      at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003)
      at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:160)
      at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:77)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:473)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:438)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:530)
      at org.mozilla.javascript.Context.call(Context.java:499)
      at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:445)
      at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:912)
      at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:143)
      at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:156)
      at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:551)
      at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:1231)
      at org.mozilla.javascript.Context.call(Context.java:499)
      at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511)
      at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:1235)
      at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:120)
      at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:93)
      at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:72)
      at org.jboss.jsfunit.jsfsession.JSFClientSession.click(JSFClientSession.java:171)
      at com.g_webdesign.NavTestCase.testAjaxButton(NavTestCase.java:50)
      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)
      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:122)
      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:595)
      Caused by: java.lang.RuntimeException: Could not retrieve XPath >//parsererror< on HtmlHtml[<html xmlns="http://www.w3.org/1999/xhtml">]
      at com.gargoylesoftware.htmlunit.html.xpath.XPathUtils.getByXPath(XPathUtils.java:85)
      at com.gargoylesoftware.htmlunit.javascript.host.HTMLCollection.computeElements(HTMLCollection.java:248)
      at com.gargoylesoftware.htmlunit.javascript.host.HTMLCollection.getElements(HTMLCollection.java:235)
      at com.gargoylesoftware.htmlunit.javascript.host.HTMLCollection.jsxGet_length(HTMLCollection.java:393)
      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.mozilla.javascript.MemberBox.invoke(MemberBox.java:160)
      ... 86 more
      Caused by: java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage
      at com.gargoylesoftware.htmlunit.html.HtmlElement.getPage(HtmlElement.java:1475)
      at com.gargoylesoftware.htmlunit.html.HtmlElement.getPage(HtmlElement.java:78)
      at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.<init>(EventHandler.java:53)
      at com.gargoylesoftware.htmlunit.javascript.host.HTMLElement.createEventHandler(HTMLElement.java:200)
      at com.gargoylesoftware.htmlunit.javascript.host.HTMLElement.setDomNode(HTMLElement.java:187)
      at com.gargoylesoftware.htmlunit.javascript.host.FormField.setDomNode(FormField.java:47)
      at com.gargoylesoftware.htmlunit.javascript.SimpleScriptable.makeScriptableFor(SimpleScriptable.java:216)
      at com.gargoylesoftware.htmlunit.javascript.host.XMLDocument.makeScriptableFor(XMLDocument.java:171)
      at com.gargoylesoftware.htmlunit.html.DomNode.getScriptObject(DomNode.java:832)
      at com.gargoylesoftware.htmlunit.javascript.NamedNodeMap.<init>(NamedNodeMap.java:73)
      at com.gargoylesoftware.htmlunit.html.HtmlElement.getAttributes(HtmlElement.java:561)
      at org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.nextNode(DOM2DTM.java:530)
      at org.apache.xml.dtm.ref.DTMDefaultBaseTraversers$IndexedDTMAxisTraverser.getNextIndexed(DTMDefaultBaseTraversers.java:570)
      at org.apache.xml.dtm.ref.DTMDefaultBaseTraversers$DescendantFromRootTraverser.first(DTMDefaultBaseTraversers.java:1734)
      at org.apache.xpath.axes.DescendantIterator.nextNode(DescendantIterator.java:211)
      at org.apache.xpath.axes.NodeSequence.nextNode(NodeSequence.java:281)
      at org.apache.xpath.axes.NodeSequence.runTo(NodeSequence.java:435)
      at org.apache.xml.dtm.ref.DTMNodeList.<init>(DTMNodeList.java:79)
      at org.apache.xpath.objects.XNodeSet.nodelist(XNodeSet.java:339)
      at com.gargoylesoftware.htmlunit.html.xpath.XPathUtils.getByXPath(XPathUtils.java:66)
      ... 94 more
      Inside wrapped exception:
      java.lang.RuntimeException: Could not retrieve XPath >//parsererror< on HtmlHtml[<html xmlns="http://www.w3.org/1999/xhtml">]
      at com.gargoylesoftware.htmlunit.html.xpath.XPathUtils.getByXPath(XPathUtils.java:85)
      at com.gargoylesoftware.htmlunit.javascript.host.HTMLCollection.computeElements(HTMLCollection.java:248)
      at com.gargoylesoftware.htmlunit.javascript.host.HTMLCollection.getElements(HTMLCollection.java:235)
      at com.gargoylesoftware.htmlunit.javascript.host.HTMLCollection.jsxGet_length(HTMLCollection.java:393)
      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.mozilla.javascript.MemberBox.invoke(MemberBox.java:160)
      at org.mozilla.javascript.ScriptableObject.getImpl(ScriptableObject.java:1980)
      at org.mozilla.javascript.ScriptableObject.get(ScriptableObject.java:280)
      at com.gargoylesoftware.htmlunit.javascript.SimpleScriptable.get(SimpleScriptable.java:64)
      at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1575)
      at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1397)
      at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1383)
      at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3054)
      at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
      at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:473)
      at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.setState(XMLHttpRequest.java:141)
      at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.doSend(XMLHttpRequest.java:412)
      at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxFunction_send(XMLHttpRequest.java:350)
      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.mozilla.javascript.MemberBox.invoke(MemberBox.java:160)
      at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:474)
      at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3335)
      at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484)
      at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
      at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
      at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:169)
      at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003)
      at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:160)
      at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:77)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:473)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:438)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:530)
      at org.mozilla.javascript.Context.call(Context.java:499)
      at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511)
      at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:445)
      at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:912)
      at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:143)
      at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:156)
      at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:551)
      at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:1231)
      at org.mozilla.javascript.Context.call(Context.java:499)
      at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511)
      at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:1235)
      at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:120)
      at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:93)
      at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:72)
      at org.jboss.jsfunit.jsfsession.JSFClientSession.click(JSFClientSession.java:171)
      at com.g_webdesign.NavTestCase.testAjaxButton(NavTestCase.java:50)
      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)
      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:122)
      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:595)
      Caused by: java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage
      at com.gargoylesoftware.htmlunit.html.HtmlElement.getPage(HtmlElement.java:1475)
      at com.gargoylesoftware.htmlunit.html.HtmlElement.getPage(HtmlElement.java:78)
      at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.<init>(EventHandler.java:53)
      at com.gargoylesoftware.htmlunit.javascript.host.HTMLElement.createEventHandler(HTMLElement.java:200)
      at com.gargoylesoftware.htmlunit.javascript.host.HTMLElement.setDomNode(HTMLElement.java:187)
      at com.gargoylesoftware.htmlunit.javascript.host.FormField.setDomNode(FormField.java:47)
      at com.gargoylesoftware.htmlunit.javascript.SimpleScriptable.makeScriptableFor(SimpleScriptable.java:216)
      at com.gargoylesoftware.htmlunit.javascript.host.XMLDocument.makeScriptableFor(XMLDocument.java:171)
      at com.gargoylesoftware.htmlunit.html.DomNode.getScriptObject(DomNode.java:832)
      at com.gargoylesoftware.htmlunit.javascript.NamedNodeMap.<init>(NamedNodeMap.java:73)
      at com.gargoylesoftware.htmlunit.html.HtmlElement.getAttributes(HtmlElement.java:561)
      at org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.nextNode(DOM2DTM.java:530)
      at org.apache.xml.dtm.ref.DTMDefaultBaseTraversers$IndexedDTMAxisTraverser.getNextIndexed(DTMDefaultBaseTraversers.java:570)
      at org.apache.xml.dtm.ref.DTMDefaultBaseTraversers$DescendantFromRootTraverser.first(DTMDefaultBaseTraversers.java:1734)
      at org.apache.xpath.axes.DescendantIterator.nextNode(DescendantIterator.java:211)
      at org.apache.xpath.axes.NodeSequence.nextNode(NodeSequence.java:281)
      at org.apache.xpath.axes.NodeSequence.runTo(NodeSequence.java:435)
      at org.apache.xml.dtm.ref.DTMNodeList.<init>(DTMNodeList.java:79)
      at org.apache.xpath.objects.XNodeSet.nodelist(XNodeSet.java:339)
      at com.gargoylesoftware.htmlunit.html.xpath.XPathUtils.getByXPath(XPathUtils.java:66)
      ... 94 more
      == CALLING JAVASCRIPT ==
      function () {
      [native code, arity=0]
      }
      
      ======= EXCEPTION END ========
      


      Here is the form I used:

      <a4j:form>
      <h:panelGrid id="reDrawThisSection">
       <h:outputText value="#{backingBean.value}"/>
       <a4j:commandButton id="commandButton" reRender="reDrawThisSection" value="Refresh"/>
      </h:panelGrid>
      </a4j:form>
      


      and my test code:

       public void testAjaxButton() throws IOException {
       JSFSession jsfSession = new JSFSession("/refresh.faces");
       JSFClientSession client = jsfSession.getJSFClientSession();
      
       client.click("commandButton");
       }
      





        1 2 Previous Next