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

    Wrapped java.lang.RuntimeException: Could not retrieve XPath

      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. Re: Wrapped java.lang.RuntimeException: Could not retrieve X

          There appears to be a problem in this method (HtmlUnit) in com.gargoylesoftware.htmlunit.javascript.host.EventHandler

           public EventHandler(final DomNode node, final String eventName, final String jsSnippet) {
           node_ = node;
           eventName_ = eventName;
          
           final String functionSignature;
          
           if (node.getPage().getEnclosingWindow().getWebClient().getBrowserVersion().isIE()) {
           functionSignature = "function()";
           }
           else {
           functionSignature = "function(event)";
           }
           jsSnippet_ = functionSignature + " {" + jsSnippet + "\n}";
           }
          


          For some reason the node is a com.gargoylesoftware.htmlunit.html.HtmlElement which forces a cast to HtmlPage in the getPage() method.

          If I comment out the browser check (Since I know the browser isn't set to IE), my test code works fine, but that doesn't explain what causes this.

          Looks like an HtmlUnit bug.

          • 2. Re: Wrapped java.lang.RuntimeException: Could not retrieve X

            The above doesn't seem to be an isolated case, I seem to encounter many cases where an XmlPage (likely the response from an ajax call) is mistakenly used for the current page (expecting an HtmlPage). It seems most common when there is a reRender="" attribute defined on a control.

            • 3. Re: Wrapped java.lang.RuntimeException: Could not retrieve X
              ssilvert

              Thanks for the info. I'm looking at it now. Hopefully, it's a JSFUnit problem. That will be easier to fix.

              Stan

              • 4. Re: Wrapped java.lang.RuntimeException: Could not retrieve X

                I don't know if this is related, but I have a case where a datatable with
                links for each record. This table is re-rendered from an ajax call. Calling
                client.getElement() for the ID of the links (after the ajax update) gives me
                the expected "matches more than one JSF component ID" exception and
                lists the links that were there prior to the ajax call - not what should be
                there now. Calling client.getContentPage() and then dumping the xml
                (HtmlPage.asXml()) does display the updated page.

                BTW, what's up with the page width on this discussion?

                • 5. Re: Wrapped java.lang.RuntimeException: Could not retrieve X
                  ssilvert

                  The stack trace had a long line in it, which made our forum increase the width to its crazy size.

                  Your datatable problem could be related. I have to distinguish between an a4j request that changed the view and one that didn't (like a resource request). I need to take a closer look at that.

                  BTW, HtmlUnit fixed an earlier problem with IE, so you are no longer required to use Firefox emulation. If you use the latest HtmlUnit code you can work around your original problem like this:

                  WebClientSpec wcSpec = new WebClientSpec("/refresh.faces", BrowserVersion.INTERNET_EXPLORER_6_0);
                  JSFSession jsfSession = new JSFSession(wcSpec);
                  JSFClientSession client = jsfSession.getJSFClientSession();
                  client.click("commandButton");


                  Maybe you can try that and see if your datatable problem goes away too.

                  Stan

                  • 6. Re: Wrapped java.lang.RuntimeException: Could not retrieve X

                    Why was client.setSelected() removed? Is there another strategy for h:selectOneMenu now? Please explain. tx

                    • 7. Re: Wrapped java.lang.RuntimeException: Could not retrieve X
                      ssilvert

                       

                      "bgregory" wrote:
                      Why was client.setSelected() removed? Is there another strategy for h:selectOneMenu now? Please explain. tx


                      Plain old click is now working:
                      <h:selectOneMenu id="Weekdays">
                       <f:selectItem id="selectMonday" itemValue="Monday"/>
                       <f:selectItem id="selectTuesday" itemValue="Tuesday"/>
                       <f:selectItem id="selectWednesday" itemValue="Wednesday"/>
                       <f:selectItem id="selectThursday" itemValue="Thursday"/>
                       <f:selectItem id="selectFriday" itemValue="Friday"/>
                       <f:selectItem id="selectSaturday" itemValue="Saturday"/>
                       </h:selectManyListbox>


                      JSFSession jsfSession = new JSFSession("/indexWithExtraComponents.faces");
                       JSFClientSession client = jsfSession.getJSFClientSession();
                       JSFServerSession server = jsfSession.getJSFServerSession();
                      
                       client.click("selectMonday");
                       client.click("selectWednesday");
                       client.click("selectFriday");
                       client.click("submit_button");


                      If you have a use case, I'll be glad to put it back though. Also, I've only tried it with <h:selectManyListbox>, but it should work the same for <h:selectOneMenu>.

                      Stan


                      • 8. Re: Wrapped java.lang.RuntimeException: Could not retrieve X

                        Follow up from prior comment:

                        I built the latest HtmlUnit/JSFUnit from just now (7pm EST) and ran my simple test cases. Using the IE6 browser def it seemed to work fine.

                        Unfortunately I can't run my more complicated tests because the setSelected() API call has dissapeared (see my previous comment).

                        TX for the progress...

                        • 9. Re: Wrapped java.lang.RuntimeException: Could not retrieve X

                          Sweet! You posted faster than me!
                          I'll try it.

                          • 10. Re: Wrapped java.lang.RuntimeException: Could not retrieve X
                            ssilvert

                             

                            "bgregory" wrote:
                            Follow up from prior comment:

                            I built the latest HtmlUnit/JSFUnit from just now (7pm EST) and ran my simple test cases. Using the IE6 browser def it seemed to work fine.

                            Good. I'll set that back as the default so you don't always have to create a WebClientSpec.

                            Stan

                            • 11. Re: Wrapped java.lang.RuntimeException: Could not retrieve X

                              Ok, thinking about this... Every selectItem must now have an id?
                              What about selectItems that aren't declared in the page?

                              <h:selectOneMenu id="filterSelects" value="#{backingBean.selectVal}">
                               <f:selectItems value="#{selectItems}"/>
                              </h:selectOneMenu>
                              


                              Do I have to change the code that generates the select items to also add IDs to them? (I'd prefer not)



                              • 12. Re: Wrapped java.lang.RuntimeException: Could not retrieve X

                                I don't think you can set an ID to a SelectItem generated in code:
                                http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/javax/faces/model/SelectItem.html

                                • 13. Re: Wrapped java.lang.RuntimeException: Could not retrieve X
                                  ssilvert

                                  The UIComponent backing the <f:selectItems> can still have an ID even though that ID doesn't get rendered in HTML. I can look it up on server side and find the proper component to click, which is what I do.

                                  So for your example, you would to do the same kind of thing you do for a DataTable.

                                  For <f:selectItems id="foo" value="#{selectItems}"/>, the id's will end up like foo:0, foo:1, foo:2 ...

                                  For the old method, you had to know the parent component id, the value of the item, and the state you wanted to set - regardless of the current state selection. Plus with the old method, I'm not sure if the onclick event is triggered.

                                  Using plain click() you just need to know the id of the <f:selectItems> and the position in the list.

                                  I think that's easier and looks cleaner. But perhaps there is a case where you know the value of the item but not its position? You can always search the list yourself to find its position though. What do you think?

                                  Stan

                                  • 14. Re: Wrapped java.lang.RuntimeException: Could not retrieve X
                                    ssilvert

                                    That being said, I haven't actually tried this with a <f:selectItems>. I'll have to give that a go.

                                    Stan

                                    1 2 Previous Next