Ajax with onblur event issue
kragoth Oct 22, 2008 9:01 PMOk... This is gona be a long post :P
Here is the problem.
I have 2 drop down menus. Both of which are firing an ajax call on the onblur event. This is working fine in the browser but... when writing my jsfunit test it causes this exception.
======= EXCEPTION START ======== Exception class=[org.mozilla.javascript.WrappedException] com.gargoylesoftware.htmlunit.ScriptException: Wrapped java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage cannot be cast to com.gargoylesoftware.htmlunit.html.HtmlPage (http://localhost:8080/gekko-tje/a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript#86) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:534) at org.mozilla.javascript.Context.call(Context.java:502) 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:502) at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511) at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:1235) at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:1212) at com.gargoylesoftware.htmlunit.html.HtmlPage.setFocusedElement(HtmlPage.java:1796) at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:270) at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:250) at gekko.web.jsfunit.pages.AbstractGekkoPageDriver.selectListValue(AbstractGekkoPageDriver.java:180) at gekko.web.jsfunit.pages.tenure.accounts.AccountDetailsMaintenancePageDriver.setLegislativeGroup(AccountDetailsMaintenancePageDriver.java:74) at gekko.web.jsfunit.pages.tenure.TenureMaintenanceTest.testCreateTenureViaBatch(TenureMaintenanceTest.java:120) 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:168) at junit.framework.TestCase.runBare(TestCase.java:134) 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:217) at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java) at org.jboss.jsfunit.framework.JSFUnitServletRedirector.doPost(JSFUnitServletRedirector.java:42) at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72) at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:217) at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java) at org.jboss.jsfunit.framework.JSFUnitServletRedirector.doGet(JSFUnitServletRedirector.java:48) 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.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:42) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:302) at org.ajax4jsf.Filter.doFilter(Filter.java:175) at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:276) at org.ajax4jsf.Filter.doFilter(Filter.java:175) 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:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619) Caused by: org.mozilla.javascript.WrappedException: Wrapped java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage cannot be cast to com.gargoylesoftware.htmlunit.html.HtmlPage (http://localhost:8080/gekko-tje/a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript#86) at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1657) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:176) at org.mozilla.javascript.ScriptableObject.getImpl(ScriptableObject.java:2000) at org.mozilla.javascript.ScriptableObject.get(ScriptableObject.java:287) at com.gargoylesoftware.htmlunit.javascript.SimpleScriptable.get(SimpleScriptable.java:64) at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1597) at org.mozilla.javascript.ScriptRuntime.getObjectPropNoWarn(ScriptRuntime.java:1421) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3048) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164) 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 java.lang.reflect.Method.invoke(Method.java:597) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161) at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:478) 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:164) 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:3004) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162) 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) ... 79 more Caused by: java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage cannot be cast to com.gargoylesoftware.htmlunit.html.HtmlPage at com.gargoylesoftware.htmlunit.html.HtmlElement.getPage(HtmlElement.java:1475) at com.gargoylesoftware.htmlunit.html.HtmlElement.removeAttribute(HtmlElement.java:446) at com.gargoylesoftware.htmlunit.html.HtmlOption.setSelectedInternal(HtmlOption.java:253) at com.gargoylesoftware.htmlunit.html.HtmlSelect.doSelectOption(HtmlSelect.java:292) at com.gargoylesoftware.htmlunit.html.HtmlSelect.appendChild(HtmlSelect.java:231) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:203) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.appendChild(XmlUtil.java:138) at com.gargoylesoftware.htmlunit.xml.XmlPage.<init>(XmlPage.java:117) at com.gargoylesoftware.htmlunit.xml.XmlPage.<init>(XmlPage.java:75) at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxGet_responseXML(XMLHttpRequest.java:219) 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 org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161) ... 108 more WrappedException: org.mozilla.javascript.WrappedException: Wrapped java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage cannot be cast to com.gargoylesoftware.htmlunit.html.HtmlPage (http://localhost:8080/gekko-tje/a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript#86) at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1657) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:176) at org.mozilla.javascript.ScriptableObject.getImpl(ScriptableObject.java:2000) at org.mozilla.javascript.ScriptableObject.get(ScriptableObject.java:287) at com.gargoylesoftware.htmlunit.javascript.SimpleScriptable.get(SimpleScriptable.java:64) at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1597) at org.mozilla.javascript.ScriptRuntime.getObjectPropNoWarn(ScriptRuntime.java:1421) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3048) at script(http://localhost:8080/gekko-tje/a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript:86) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164) 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 java.lang.reflect.Method.invoke(Method.java:597) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161) at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:478) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3335) at script(http://localhost:8080/gekko-tje/a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript:91) at script(http://localhost:8080/gekko-tje/a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript:144) at script(http://localhost:8080/gekko-tje/a4j_3_2_0-SNAPSHOTorg.ajax4jsf.javascript.AjaxScript:143) at script(onblur event for HtmlSelect[<select id="MasterPageForm:selectFinancialGroup" name="MasterPageForm:selectFinancialGroup" class="GekkoSelectOneMenu" size="1" onblur="A4J.AJAX.Submit('_viewRoot','MasterPageForm',event,{'parameters':{'MasterPageForm:j_id89':'MasterPageForm:j_id89'} ,'actionUrl':'/gekko-tje/tenure/maintain/account/accountDetails.jsf'} )">]:1) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164) 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:3004) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162) 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:502) 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:502) at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511) at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:1235) at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:1212) at com.gargoylesoftware.htmlunit.html.HtmlPage.setFocusedElement(HtmlPage.java:1796) at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:270) at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:250) at gekko.web.jsfunit.pages.AbstractGekkoPageDriver.selectListValue(AbstractGekkoPageDriver.java:180) at gekko.web.jsfunit.pages.tenure.accounts.AccountDetailsMaintenancePageDriver.setLegislativeGroup(AccountDetailsMaintenancePageDriver.java:74) at gekko.web.jsfunit.pages.tenure.TenureMaintenanceTest.testCreateTenureViaBatch(TenureMaintenanceTest.java:120) 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:168) at junit.framework.TestCase.runBare(TestCase.java:134) 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:217) at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java) at org.jboss.jsfunit.framework.JSFUnitServletRedirector.doPost(JSFUnitServletRedirector.java:42) at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72) at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:217) at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java) at org.jboss.jsfunit.framework.JSFUnitServletRedirector.doGet(JSFUnitServletRedirector.java:48) 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.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:42) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:302) at org.ajax4jsf.Filter.doFilter(Filter.java:175) at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:276) at org.ajax4jsf.Filter.doFilter(Filter.java:175) 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:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage cannot be cast to com.gargoylesoftware.htmlunit.html.HtmlPage at com.gargoylesoftware.htmlunit.html.HtmlElement.getPage(HtmlElement.java:1475) at com.gargoylesoftware.htmlunit.html.HtmlElement.removeAttribute(HtmlElement.java:446) at com.gargoylesoftware.htmlunit.html.HtmlOption.setSelectedInternal(HtmlOption.java:253) at com.gargoylesoftware.htmlunit.html.HtmlSelect.doSelectOption(HtmlSelect.java:292) at com.gargoylesoftware.htmlunit.html.HtmlSelect.appendChild(HtmlSelect.java:231) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:203) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.appendChild(XmlUtil.java:138) at com.gargoylesoftware.htmlunit.xml.XmlPage.<init>(XmlPage.java:117) at com.gargoylesoftware.htmlunit.xml.XmlPage.<init>(XmlPage.java:75) at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxGet_responseXML(XMLHttpRequest.java:219) 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 org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161) ... 108 more Inside wrapped exception: java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage cannot be cast to com.gargoylesoftware.htmlunit.html.HtmlPage at com.gargoylesoftware.htmlunit.html.HtmlElement.getPage(HtmlElement.java:1475) at com.gargoylesoftware.htmlunit.html.HtmlElement.removeAttribute(HtmlElement.java:446) at com.gargoylesoftware.htmlunit.html.HtmlOption.setSelectedInternal(HtmlOption.java:253) at com.gargoylesoftware.htmlunit.html.HtmlSelect.doSelectOption(HtmlSelect.java:292) at com.gargoylesoftware.htmlunit.html.HtmlSelect.appendChild(HtmlSelect.java:231) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:203) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:204) at com.gargoylesoftware.htmlunit.xml.XmlUtil.appendChild(XmlUtil.java:138) at com.gargoylesoftware.htmlunit.xml.XmlPage.<init>(XmlPage.java:117) at com.gargoylesoftware.htmlunit.xml.XmlPage.<init>(XmlPage.java:75) at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxGet_responseXML(XMLHttpRequest.java:219) 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 org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161) at org.mozilla.javascript.ScriptableObject.getImpl(ScriptableObject.java:2000) at org.mozilla.javascript.ScriptableObject.get(ScriptableObject.java:287) at com.gargoylesoftware.htmlunit.javascript.SimpleScriptable.get(SimpleScriptable.java:64) at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1597) at org.mozilla.javascript.ScriptRuntime.getObjectPropNoWarn(ScriptRuntime.java:1421) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3048) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2484) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164) 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 java.lang.reflect.Method.invoke(Method.java:597) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161) at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:478) 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:164) 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:3004) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162) 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:502) 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:502) at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511) at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:1235) at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:1212) at com.gargoylesoftware.htmlunit.html.HtmlPage.setFocusedElement(HtmlPage.java:1796) at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:270) at com.gargoylesoftware.htmlunit.html.HtmlSelect.setSelectedAttribute(HtmlSelect.java:250) at gekko.web.jsfunit.pages.AbstractGekkoPageDriver.selectListValue(AbstractGekkoPageDriver.java:180) at gekko.web.jsfunit.pages.tenure.accounts.AccountDetailsMaintenancePageDriver.setLegislativeGroup(AccountDetailsMaintenancePageDriver.java:74) at gekko.web.jsfunit.pages.tenure.TenureMaintenanceTest.testCreateTenureViaBatch(TenureMaintenanceTest.java:120) 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:168) at junit.framework.TestCase.runBare(TestCase.java:134) 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:217) at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java) at org.jboss.jsfunit.framework.JSFUnitServletRedirector.doPost(JSFUnitServletRedirector.java:42) at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72) at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:217) at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java) at org.jboss.jsfunit.framework.JSFUnitServletRedirector.doGet(JSFUnitServletRedirector.java:48) 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.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:42) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:302) at org.ajax4jsf.Filter.doFilter(Filter.java:175) at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:276) at org.ajax4jsf.Filter.doFilter(Filter.java:175) 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:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619) == CALLING JAVASCRIPT == function () { [native code, arity=0] } ======= EXCEPTION END ========
This happens when executing the following lines of java in my test
lockedTenureAccountMaintDriver.setFinancialGroup("1"); lockedTenureAccountMaintDriver.setLegislativeGroup("1");
The exception occurs when executing the second line.
Underneath my abstraction each line executes this method:
public void selectListValue(String componentId, String value) { HtmlSelect selectBox = (HtmlSelect)testContext.getClient().getElement(componentId); selectBox.setSelectedAttribute(value, true); }
So it appears that the onblur event of the first drop down is messing with the selection of my second menu.
Here is the relevant section of .xhtml
<gekko:fieldset id="financialGroupFieldset"> <gekko:legend id="financialGroupLegend"> <h:outputText value="Financial Group" /> <gekko:lookupButton id="lookupFinancialGroup" action="#{AccountMaintenanceController.displayFinancialGroups()}" style="border:none;" rendered="#{not TenureKeyController.viewMode}" /> </gekko:legend> <h:panelGrid id="financialGroupPanelGrid" styleClass="formTable" columns="1" width="100%"> <gekko:selectOneMenu id="selectFinancialGroup" dataValue="#{AccountDetailsDataBean.financialGroups}" value="#{AccountMaintenanceController.currentAccount.financialGroup}" var="group" valueLabel="#{group.code}" label="Control level" gekkoRequired="true" readonly="#{TenureKeyController.viewMode}" > <a4j:support event="onblur" reRender="financialGroupPanelGrid" bypassUpdates="false"/> </gekko:selectOneMenu> <gekko:formRow id="fundCodeFormRow" for="fundCodeOutput" label="Fund code"> <h:outputText id="fundCodeOutput" value="#{AccountMaintenanceController.currentAccount.financialGroup.description}" /> </gekko:formRow> <gekko:formRow id="SAPGroupingFormRow" for="SAPGroupingOutput" label="SAP grouping"> <h:outputText id="SAPGroupingOutput" value="TODO" /> </gekko:formRow> <gekko:formRow id="CompanyCodeFormRow" for="CompanyCodeOutput" label="Company code"> <h:outputText id="CompanyCodeOutput" value="TODO" /> </gekko:formRow> <gekko:formRow id="assetTypeFormRow" for="assetTypeOutput" label="Asset type"> <h:outputText id="assetTypeOutput" value="TODO" /> </gekko:formRow> <gekko:formRow id="agencyFormRow" for="agencyOutput" label="Agency"> <h:outputText id="agencyOutput" value="TODO" /> </gekko:formRow> <gekko:formRow id="leaseTypeFormRow" for="leaseTypeOutput" label="Lease type"> <h:outputText id="leaseTypeOutput" value="TODO" /> </gekko:formRow> </h:panelGrid> </gekko:fieldset> <gekko:fieldset id="legislativeGroupFieldset"> <gekko:legend id="legislativeGroupLegend"> <h:outputText value="Legislative Group" /> <gekko:lookupButton id="lookupLegislativeGroup" action="#{AccountMaintenanceController.displayLegislativeGroups()}" style="border:none;" rendered="#{not TenureKeyController.viewMode}" /> </gekko:legend> <h:panelGrid id="legislativeGroupPanelGrid" styleClass="formTable" columns="1" width="100%"> <gekko:selectOneMenu id="selectLegislativeGroup" dataValue="#{AccountDetailsDataBean.legislativeGroups}" value="#{AccountMaintenanceController.currentAccount.legislativeGroup}" var="group" valueLabel="#{group.legislativeId}" gekkoRequired="true" label="ID" readonly="#{TenureKeyController.viewMode}" > <a4j:support event="onblur" reRender="legislativeGroupPanelGrid" bypassUpdates="false"/> </gekko:selectOneMenu> <gekko:formRow id="LGDescriptionFormRow" for="LGDescriptionOutput" label="Description"> <h:outputText id="LGDescriptionOutput" value="#{AccountMaintenanceController.currentAccount.legislativeGroup.description}" /> </gekko:formRow> <gekko:formRow id="LGDueDateFormRow" for="LGDueDateOutput" label="Due Date"> <h:outputText id="LGDueDateOutput" value="TODO" /> </gekko:formRow> <gekko:formRow id="LGInvoiceFrequencyFormRow" for="LGInvoiceFrequencyOutput" label="Invoice Frequency"> <h:outputText id="LGInvoiceFrequencyOutput" value="TODO" /> </gekko:formRow> </h:panelGrid> </gekko:fieldset>
I've tried using other events such as onchange etc but I still get the exception.
Any ideas or should I raise this as a JIRA? (I havn't had a lot of time to work on JSFUnit stuff recently so I'm not even running latest build cause I can't get it to work. I'm hoping to spend a bit of time upgrading next week.)
Thanks,
Tim