10 Replies Latest reply on Sep 8, 2009 4:14 PM by ssilvert

    newbie questions about login into a page

      Hi !

      I just started today to use jsfunit. I have an application which needs a login before you can do anything so I wrote a little login test which seams to get over the login but afterwards I get an exception.

      Here is my test code:

      System.out.println("Starting the test");
      // Send an HTTP request for the initial page
      JSFSession jsfSession = new JSFSession("/index.jsp");

      // A JSFClientSession emulates the browser and lets you test HTML
      JSFClientSession client = jsfSession.getJSFClientSession();

      // A JSFServerSession gives you access to JSF state
      JSFServerSession server = jsfSession.getJSFServerSession();

      // Test navigation to initial viewID
      // System.out.println("Test navigation to inital viewID");
      // assertEquals("/index.jsf", server.getCurrentViewID());

      // Assert that the prompt component is in the component tree and rendered
      // UIComponent username = server.findComponent("j_username");
      // assertTrue(username.isRendered());
      System.out.println("setting username");
      client.setValue("j_username", "test");
      System.out.println("Setting password");
      client.setValue("j_password", "test");
      System.out.println("Click on login");
      client.click("btLoginSubmit");

      System.out.println(client.getPageAsText());

      And here the exception I get:

      15:06:24,935 INFO [STDOUT] 15:06:24,935 WARN [HTMLDocument] getElementById(script1251723984932) did a getElementByName for Internet Explorer
      15:06:25,336 INFO [STDOUT] 15:06:25,336 WARN [HtmlPage] Obsolete content type encountered: 'text/javascript'.
      15:06:25,476 INFO [STDOUT] 15:06:25,476 WARN [HtmlPage] Obsolete content type encountered: 'text/javascript'.
      15:06:25,616 INFO [STDOUT] 15:06:25,616 WARN [HtmlPage] Obsolete content type encountered: 'text/javascript'.
      15:06:25,676 INFO [STDOUT] 15:06:25,675 WARN [HtmlPage] Obsolete content type encountered: 'text/javascript'.
      15:06:26,037 INFO [STDOUT] 15:06:26,037 WARN [HtmlPage] Obsolete content type encountered: 'text/javascript'.
      15:06:26,223 INFO [STDOUT] 15:06:26,223 WARN [HtmlPage] Obsolete content type encountered: 'text/javascript'.
      15:06:26,296 INFO [STDOUT] 15:06:26,296 WARN [HtmlPage] Obsolete content type encountered: 'text/javascript'.
      15:06:26,400 INFO [STDOUT] 15:06:26,400 WARN [HtmlPage] Obsolete content type encountered: 'text/javascript'.
      15:06:26,569 INFO [STDOUT] 15:06:26,569 WARN [HtmlPage] Obsolete content type encountered: 'text/javascript'.
      15:06:26,602 INFO [STDOUT] 15:06:26,602 WARN [HtmlPage] Obsolete content type encountered: 'text/javascript'.
      15:06:26,614 INFO [STDOUT] 15:06:26,614 WARN [HtmlPage] Obsolete content type encountered: 'text/javascript'.
      15:06:26,682 INFO [STDOUT] 15:06:26,682 WARN [HtmlPage] Obsolete content type encountered: 'text/javascript'.
      15:06:26,696 INFO [STDOUT] 15:06:26,695 WARN [HtmlPage] Obsolete content type encountered: 'text/javascript'.
      15:06:26,710 INFO [STDOUT] 15:06:26,710 WARN [HtmlPage] Obsolete content type encountered: 'text/javascript'.
      15:06:26,815 INFO [STDOUT] 15:06:26,815 WARN [HtmlPage] Obsolete content type encountered: 'text/javascript'.
      15:06:26,835 INFO [STDOUT] 15:06:26,835 WARN [HtmlPage] Obsolete content type encountered: 'text/javascript'.
      15:06:26,886 INFO [STDOUT] 15:06:26,886 WARN [HtmlPage] Obsolete content type encountered: 'text/javascript'.
      15:06:26,909 INFO [STDOUT] 15:06:26,909 WARN [HtmlPage] Obsolete content type encountered: 'text/javascript'.
      15:06:30,553 INFO [STDOUT] 15:06:30,553 INFO [NicelyResynchronizingAjaxController] Re-synchronized call to http://localhost:8080/PatientViewer/patientviewer/patientviewer.jsf
      15:06:33,555 ERROR [[ServletRedirector]] Servlet.service() for servlet ServletRedirector threw exception
      java.lang.IllegalStateException: No script object associated with the Page
      at com.gargoylesoftware.htmlunit.html.DomNode.getScriptObject(DomNode.java:869)
      at com.gargoylesoftware.htmlunit.html.DomNode.getScriptObject(DomNode.java:871)
      at com.gargoylesoftware.htmlunit.html.HtmlElement.getEventHandler(HtmlElement.java:834)
      at com.gargoylesoftware.htmlunit.html.HtmlPage.executeEventHandlersIfNeeded(HtmlPage.java:1247)
      at com.gargoylesoftware.htmlunit.html.HtmlPage.cleanUp(HtmlPage.java:218)
      at com.gargoylesoftware.htmlunit.WebWindowImpl.destroyChildren(WebWindowImpl.java:159)
      at com.gargoylesoftware.htmlunit.TopLevelWindow.close(TopLevelWindow.java:106)
      at org.jboss.jsfunit.framework.WebClientSpec.valueUnbound(WebClientSpec.java:308)
      at org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1649)
      at org.apache.catalina.session.StandardSession.expire(StandardSession.java:756)
      at org.apache.catalina.session.StandardSession.expire(StandardSession.java:660)
      at org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1111)
      at org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:150)
      at org.jboss.jsfunit.framework.JSFUnitServletRedirector.cleanUp(JSFUnitServletRedirector.java:68)
      at org.jboss.jsfunit.framework.JSFUnitServletRedirector.doPost(JSFUnitServletRedirector.java:47)
      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:52)
      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:119)
      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:182)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
      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:637)


      Anyone can help on this topic ?

      yours

      Arnold

        • 1. Re: newbie questions about login into a page
          ssilvert

          Hi Arnold,

          This looks like an HtmlUnit problem. Double-check to make sure you are using the right versions of these jars:
          nekohtml-1.9.9.jar
          htmlunit-2.5.jar
          htmlunit-core-js-2.5.jar

          Also, here is a tip. Unless you are testing the login page itself, you can use FormAuthenticationStrategy as shown here:
          http://www.jboss.org/community/wiki/JSFUnitTestingSecurePages

          Stan

          • 2. Re: newbie questions about login into a page

            Hi Stan !

            Thanks for the reply. I checked the jar files and I use the correct versions except of nekohtml-1.9.12.jar. Should I downgrade to the one you specified (I build my project with maven and use the pom dependency entries specified on the jsfunit website) ?
            Will also have a look at the FormAuthenticationStrategy


            yours

            Arnold

            • 3. Re: newbie questions about login into a page

              I also tried to use the FormAuthenitcationStrategy but I get this exception:
              <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="cactus-report.xsl"?>java.lang.IllegalStateException: Component with name=j_username was not found on the login page.
              at org.jboss.jsfunit.framework.FormAuthenticationStrategy.getElement(FormAuthenticationStrategy.java:162)
              at org.jboss.jsfunit.framework.FormAuthenticationStrategy.setValue(FormAuthenticationStrategy.java:139)
              at org.jboss.jsfunit.framework.FormAuthenticationStrategy.doInitialRequest(FormAuthenticationStrategy.java:106)
              at org.jboss.jsfunit.framework.WebClientSpec.doInitialRequest(WebClientSpec.java:259)
              at org.jboss.jsfunit.jsfsession.JSFSession.&lt;init&gt;(JSFSession.java:81)
              at com.j4care.viewer.test.LoginTest.testInitialPage(LoginTest.java:34)
              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:217)
              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:46)
              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:52)
              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:119)
              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:182)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
              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:637)



              The thing I don't get is why it doesn't find the inputField as I declared it that way:

              <h:inputText name="j_username" id="j_username" value="#{login.userId}" onkeydown="return clickButtonOnEnter(this, event, 'loginSubmitButton')" style="width:200px;" >
              <a4j:support event="onsubmit" />
              </h:inputText>
              <h:outputText value="#{language.password}" />
              <h:inputSecret name="j_password" id="j_password" value="#{login.password}" onkeydown="return clickButtonOnEnter(this, event, 'loginSubmitButton')" style="width:200px;" >
              <a4j:support event="onsubmit" />
              </h:inputSecret>

              • 4. Re: newbie questions about login into a page
                ssilvert

                Neko 1.9.12 should be OK. That's the latest release of Neko.

                Are you sure that you passed the correct URL to the JSFSession constructor?

                If you want to see exactly what was returned from the initial request, you can extend FormAuthenticationStrategy with your own class and then override the setValue() method. Then you can see for yourself if there is a component with name="j_username".

                protected void setValue(HtmlPage page, String elementName, String value)
                {
                 System.out.println(page.asText());
                 super.setValue(page, elementName, value);
                }


                Stan

                • 5. Re: newbie questions about login into a page

                  the component name is name="j_id6:j_username" when I inspect the HTML code when I load my login.jsf page.
                  Will try your code asap.

                  Thanks !

                  Arnold

                  • 6. Re: newbie questions about login into a page
                    ssilvert

                     

                    "arnold.maderthaner" wrote:
                    the component name is name="j_id6:j_username" when I inspect the HTML code when I load my login.jsf page.
                    Will try your code asap.

                    Thanks !

                    Arnold


                    That's the reason it didn't find it. The JEE standard is to have the name be "j_username". I'm not sure why JSF made the name="j_id6:j_username". I know why it would set the id that way, but I didn't think it would change the name attribute.

                    Anyway, I suggest giving the form an id like id="myform". Then you can use the alternate constructor for FormAuthenticationStrategy to specify any component names you want for username and password.

                    http://labs.jboss.com/file-access/default/members/jsfunit/freezone/apidocs/org/jboss/jsfunit/framework/FormAuthenticationStrategy.html#FormAuthenticationStrategy(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String)

                    Stan

                    • 7. Re: newbie questions about login into a page

                      the thing is: is this a "static" change JSF does or is it a random number (id-XY..) ?

                      • 8. Re: newbie questions about login into a page
                        ssilvert

                        It's not exactly random, but it can change if you change your markup or switch to a different JSF implementation.

                        That's why the safe thing to do is to set your own component id for the form. Then it will never change. It's good practice to use the id attribute anyway.

                        See this page for a longer discussion of this topic:
                        http://www.jboss.org/community/wiki/UsingComponentIDs

                        Stan

                        • 9. Re: newbie questions about login into a page

                          I added the IDs but I got stuck at the next exception:

                          <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="cactus-report.xsl"?>======= EXCEPTION START ========
                          Exception class=[net.sourceforge.htmlunit.corejs.javascript.WrappedException]
                          com.gargoylesoftware.htmlunit.ScriptException: Wrapped 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/PatientViewer/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js.jsf#2264)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:534)
                          at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)
                          at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:464)
                          at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:992)
                          at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:164)
                          at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:177)
                          at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:574)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:936)
                          at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)
                          at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:941)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1317)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1288)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1257)
                          at org.jboss.jsfunit.framework.FormAuthenticationStrategy.clickSubmitComponent(FormAuthenticationStrategy.java:127)
                          at org.jboss.jsfunit.framework.FormAuthenticationStrategy.doInitialRequest(FormAuthenticationStrategy.java:108)
                          at org.jboss.jsfunit.framework.WebClientSpec.doInitialRequest(WebClientSpec.java:259)
                          at org.jboss.jsfunit.jsfsession.JSFSession.(JSFSession.java:81)
                          at com.j4care.viewer.test.LoginTest.testInitialPage(LoginTest.java:34)
                          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:217)
                          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:46)
                          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:52)
                          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:119)
                          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:182)
                          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
                          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:637)
                          Caused by: net.sourceforge.htmlunit.corejs.javascript.WrappedException: Wrapped 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/PatientViewer/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js.jsf#2264)
                          at net.sourceforge.htmlunit.corejs.javascript.Context.throwAsScriptRuntimeEx(Context.java:1773)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.processPostponedActions(JavaScriptEngine.java:564)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:493)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.setState(XMLHttpRequest.java:165)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.doSend(XMLHttpRequest.java:440)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxFunction_send(XMLHttpRequest.java:375)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:161)
                          at net.sourceforge.htmlunit.corejs.javascript.FunctionObject.call(FunctionObject.java:476)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3330)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)
                          at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
                          at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
                          at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:267)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
                          at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
                          at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:82)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:492)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:457)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)
                          ... 62 more
                          Caused by: 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/PatientViewer/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js.jsf#2264)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:534)
                          at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)
                          at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:432)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:407)
                          at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(HtmlPage.java:965)
                          at com.gargoylesoftware.htmlunit.html.HtmlScript.executeInlineScriptIfNeeded(HtmlScript.java:310)
                          at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:364)
                          at com.gargoylesoftware.htmlunit.html.HtmlScript$1.execute(HtmlScript.java:213)
                          at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:239)
                          at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:595)
                          at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
                          at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:549)
                          at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1025)
                          at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:927)
                          at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:206)
                          at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:329)
                          at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3041)
                          at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1993)
                          at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:910)
                          at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499)
                          at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452)
                          at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
                          at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:798)
                          at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:278)
                          at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:127)
                          at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:101)
                          at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:442)
                          at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:329)
                          at com.gargoylesoftware.htmlunit.javascript.host.Location$1.execute(Location.java:203)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.processPostponedActions(JavaScriptEngine.java:560)
                          ... 83 more
                          Caused by: net.sourceforge.htmlunit.corejs.javascript.WrappedException: Wrapped java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage cannot be cast to com.gargoylesoftware.htmlunit.html.HtmlPage (http://localhost:8080/PatientViewer/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js.jsf#2264)
                          at net.sourceforge.htmlunit.corejs.javascript.Context.throwAsScriptRuntimeEx(Context.java:1773)
                          at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:183)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.getImpl(ScriptableObject.java:2019)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.get(ScriptableObject.java:286)
                          at com.gargoylesoftware.htmlunit.javascript.SimpleScriptable.get(SimpleScriptable.java:73)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.get(XMLHttpRequest.java:489)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.getProperty(ScriptableObject.java:1616)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getObjectPropNoWarn(ScriptRuntime.java:1460)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3021)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)
                          at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:492)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.setState(XMLHttpRequest.java:165)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.doSend(XMLHttpRequest.java:440)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxFunction_send(XMLHttpRequest.java:375)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:161)
                          at net.sourceforge.htmlunit.corejs.javascript.FunctionObject.call(FunctionObject.java:476)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3330)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)
                          at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:178)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$5.doRun(JavaScriptEngine.java:423)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)
                          ... 113 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.FrameWindow.getEnclosingPage(FrameWindow.java:94)
                          at com.gargoylesoftware.htmlunit.WebClient$CurrentWindowTracker.webWindowContentChanged(WebClient.java:1889)
                          at com.gargoylesoftware.htmlunit.WebClient.fireWindowContentChanged(WebClient.java:866)
                          at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:445)
                          at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:329)
                          at com.gargoylesoftware.htmlunit.html.BaseFrame.(BaseFrame.java:70)
                          at com.gargoylesoftware.htmlunit.html.HtmlInlineFrame.(HtmlInlineFrame.java:48)
                          at com.gargoylesoftware.htmlunit.html.DefaultElementFactory.createElementNS(DefaultElementFactory.java:231)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.createFrom(XmlUtil.java:157)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:211)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.appendChild(XmlUtil.java:146)
                          at com.gargoylesoftware.htmlunit.xml.XmlPage.(XmlPage.java:114)
                          at com.gargoylesoftware.htmlunit.xml.XmlPage.(XmlPage.java:73)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxGet_responseXML(XMLHttpRequest.java:243)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:161)
                          ... 137 more
                          WrappedException: net.sourceforge.htmlunit.corejs.javascript.WrappedException: Wrapped 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/PatientViewer/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js.jsf#2264)
                          at net.sourceforge.htmlunit.corejs.javascript.Context.throwAsScriptRuntimeEx(Context.java:1773)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.processPostponedActions(JavaScriptEngine.java:564)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:493)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.setState(XMLHttpRequest.java:165)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.doSend(XMLHttpRequest.java:440)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxFunction_send(XMLHttpRequest.java:375)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:161)
                          at net.sourceforge.htmlunit.corejs.javascript.FunctionObject.call(FunctionObject.java:476)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3330)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)
                          at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
                          at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
                          at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:267)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
                          at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
                          at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:82)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:492)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:457)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)
                          at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)
                          at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:464)
                          at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:992)
                          at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:164)
                          at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:177)
                          at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:574)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:936)
                          at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)
                          at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:941)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1317)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1288)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1257)
                          at org.jboss.jsfunit.framework.FormAuthenticationStrategy.clickSubmitComponent(FormAuthenticationStrategy.java:127)
                          at org.jboss.jsfunit.framework.FormAuthenticationStrategy.doInitialRequest(FormAuthenticationStrategy.java:108)
                          at org.jboss.jsfunit.framework.WebClientSpec.doInitialRequest(WebClientSpec.java:259)
                          at org.jboss.jsfunit.jsfsession.JSFSession.(JSFSession.java:81)
                          at com.j4care.viewer.test.LoginTest.testInitialPage(LoginTest.java:34)
                          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:217)
                          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:46)
                          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:52)
                          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:119)
                          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:182)
                          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
                          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:637)
                          Caused by: 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/PatientViewer/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js.jsf#2264)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:534)
                          at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)
                          at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:432)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:407)
                          at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(HtmlPage.java:965)
                          at com.gargoylesoftware.htmlunit.html.HtmlScript.executeInlineScriptIfNeeded(HtmlScript.java:310)
                          at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:364)
                          at com.gargoylesoftware.htmlunit.html.HtmlScript$1.execute(HtmlScript.java:213)
                          at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:239)
                          at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:595)
                          at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
                          at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:549)
                          at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1025)
                          at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:927)
                          at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:206)
                          at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:329)
                          at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3041)
                          at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1993)
                          at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:910)
                          at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499)
                          at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452)
                          at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
                          at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:798)
                          at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:278)
                          at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:127)
                          at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:101)
                          at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:442)
                          at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:329)
                          at com.gargoylesoftware.htmlunit.javascript.host.Location$1.execute(Location.java:203)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.processPostponedActions(JavaScriptEngine.java:560)
                          ... 83 more
                          Caused by: net.sourceforge.htmlunit.corejs.javascript.WrappedException: Wrapped java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage cannot be cast to com.gargoylesoftware.htmlunit.html.HtmlPage (http://localhost:8080/PatientViewer/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js.jsf#2264)
                          at net.sourceforge.htmlunit.corejs.javascript.Context.throwAsScriptRuntimeEx(Context.java:1773)
                          at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:183)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.getImpl(ScriptableObject.java:2019)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.get(ScriptableObject.java:286)
                          at com.gargoylesoftware.htmlunit.javascript.SimpleScriptable.get(SimpleScriptable.java:73)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.get(XMLHttpRequest.java:489)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.getProperty(ScriptableObject.java:1616)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getObjectPropNoWarn(ScriptRuntime.java:1460)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3021)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)
                          at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:492)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.setState(XMLHttpRequest.java:165)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.doSend(XMLHttpRequest.java:440)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxFunction_send(XMLHttpRequest.java:375)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:161)
                          at net.sourceforge.htmlunit.corejs.javascript.FunctionObject.call(FunctionObject.java:476)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3330)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)
                          at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:178)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$5.doRun(JavaScriptEngine.java:423)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)
                          ... 113 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.FrameWindow.getEnclosingPage(FrameWindow.java:94)
                          at com.gargoylesoftware.htmlunit.WebClient$CurrentWindowTracker.webWindowContentChanged(WebClient.java:1889)
                          at com.gargoylesoftware.htmlunit.WebClient.fireWindowContentChanged(WebClient.java:866)
                          at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:445)
                          at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:329)
                          at com.gargoylesoftware.htmlunit.html.BaseFrame.(BaseFrame.java:70)
                          at com.gargoylesoftware.htmlunit.html.HtmlInlineFrame.(HtmlInlineFrame.java:48)
                          at com.gargoylesoftware.htmlunit.html.DefaultElementFactory.createElementNS(DefaultElementFactory.java:231)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.createFrom(XmlUtil.java:157)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:211)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.appendChild(XmlUtil.java:146)
                          at com.gargoylesoftware.htmlunit.xml.XmlPage.(XmlPage.java:114)
                          at com.gargoylesoftware.htmlunit.xml.XmlPage.(XmlPage.java:73)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxGet_responseXML(XMLHttpRequest.java:243)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:161)
                          ... 137 more
                          Inside wrapped exception:
                          ======= EXCEPTION START ========
                          Exception class=[net.sourceforge.htmlunit.corejs.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/PatientViewer/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js.jsf#2264)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:534)
                          at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)
                          at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:432)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:407)
                          at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(HtmlPage.java:965)
                          at com.gargoylesoftware.htmlunit.html.HtmlScript.executeInlineScriptIfNeeded(HtmlScript.java:310)
                          at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:364)
                          at com.gargoylesoftware.htmlunit.html.HtmlScript$1.execute(HtmlScript.java:213)
                          at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:239)
                          at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:595)
                          at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
                          at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:549)
                          at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1025)
                          at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:927)
                          at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:206)
                          at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:329)
                          at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3041)
                          at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1993)
                          at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:910)
                          at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499)
                          at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452)
                          at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
                          at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:798)
                          at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:278)
                          at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:127)
                          at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:101)
                          at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:442)
                          at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:329)
                          at com.gargoylesoftware.htmlunit.javascript.host.Location$1.execute(Location.java:203)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.processPostponedActions(JavaScriptEngine.java:560)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:493)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.setState(XMLHttpRequest.java:165)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.doSend(XMLHttpRequest.java:440)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxFunction_send(XMLHttpRequest.java:375)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:161)
                          at net.sourceforge.htmlunit.corejs.javascript.FunctionObject.call(FunctionObject.java:476)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3330)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)
                          at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
                          at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
                          at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:267)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
                          at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
                          at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:82)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:492)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:457)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)
                          at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)
                          at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:464)
                          at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:992)
                          at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:164)
                          at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:177)
                          at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:574)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:936)
                          at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)
                          at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:941)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1317)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1288)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1257)
                          at org.jboss.jsfunit.framework.FormAuthenticationStrategy.clickSubmitComponent(FormAuthenticationStrategy.java:127)
                          at org.jboss.jsfunit.framework.FormAuthenticationStrategy.doInitialRequest(FormAuthenticationStrategy.java:108)
                          at org.jboss.jsfunit.framework.WebClientSpec.doInitialRequest(WebClientSpec.java:259)
                          at org.jboss.jsfunit.jsfsession.JSFSession.(JSFSession.java:81)
                          at com.j4care.viewer.test.LoginTest.testInitialPage(LoginTest.java:34)
                          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:217)
                          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:46)
                          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:52)
                          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:119)
                          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:182)
                          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
                          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:637)
                          Caused by: net.sourceforge.htmlunit.corejs.javascript.WrappedException: Wrapped java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage cannot be cast to com.gargoylesoftware.htmlunit.html.HtmlPage (http://localhost:8080/PatientViewer/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js.jsf#2264)
                          at net.sourceforge.htmlunit.corejs.javascript.Context.throwAsScriptRuntimeEx(Context.java:1773)
                          at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:183)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.getImpl(ScriptableObject.java:2019)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.get(ScriptableObject.java:286)
                          at com.gargoylesoftware.htmlunit.javascript.SimpleScriptable.get(SimpleScriptable.java:73)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.get(XMLHttpRequest.java:489)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.getProperty(ScriptableObject.java:1616)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getObjectPropNoWarn(ScriptRuntime.java:1460)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3021)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)
                          at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:492)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.setState(XMLHttpRequest.java:165)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.doSend(XMLHttpRequest.java:440)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxFunction_send(XMLHttpRequest.java:375)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:161)
                          at net.sourceforge.htmlunit.corejs.javascript.FunctionObject.call(FunctionObject.java:476)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3330)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)
                          at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:178)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$5.doRun(JavaScriptEngine.java:423)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)
                          ... 113 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.FrameWindow.getEnclosingPage(FrameWindow.java:94)
                          at com.gargoylesoftware.htmlunit.WebClient$CurrentWindowTracker.webWindowContentChanged(WebClient.java:1889)
                          at com.gargoylesoftware.htmlunit.WebClient.fireWindowContentChanged(WebClient.java:866)
                          at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:445)
                          at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:329)
                          at com.gargoylesoftware.htmlunit.html.BaseFrame.(BaseFrame.java:70)
                          at com.gargoylesoftware.htmlunit.html.HtmlInlineFrame.(HtmlInlineFrame.java:48)
                          at com.gargoylesoftware.htmlunit.html.DefaultElementFactory.createElementNS(DefaultElementFactory.java:231)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.createFrom(XmlUtil.java:157)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:211)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.appendChild(XmlUtil.java:146)
                          at com.gargoylesoftware.htmlunit.xml.XmlPage.(XmlPage.java:114)
                          at com.gargoylesoftware.htmlunit.xml.XmlPage.(XmlPage.java:73)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxGet_responseXML(XMLHttpRequest.java:243)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:161)
                          ... 137 more
                          WrappedException: net.sourceforge.htmlunit.corejs.javascript.WrappedException: Wrapped java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage cannot be cast to com.gargoylesoftware.htmlunit.html.HtmlPage (http://localhost:8080/PatientViewer/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js.jsf#2264)
                          at net.sourceforge.htmlunit.corejs.javascript.Context.throwAsScriptRuntimeEx(Context.java:1773)
                          at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:183)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.getImpl(ScriptableObject.java:2019)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.get(ScriptableObject.java:286)
                          at com.gargoylesoftware.htmlunit.javascript.SimpleScriptable.get(SimpleScriptable.java:73)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.get(XMLHttpRequest.java:489)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptableObject.getProperty(ScriptableObject.java:1616)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getObjectPropNoWarn(ScriptRuntime.java:1460)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3021)
                          at script(http://localhost:8080/PatientViewer/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js.jsf:2264)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)
                          at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:492)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.setState(XMLHttpRequest.java:165)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.doSend(XMLHttpRequest.java:440)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxFunction_send(XMLHttpRequest.java:375)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:161)
                          at net.sourceforge.htmlunit.corejs.javascript.FunctionObject.call(FunctionObject.java:476)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3330)
                          at script(http://localhost:8080/PatientViewer/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js.jsf:2280)
                          at script(http://localhost:8080/PatientViewer/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js.jsf:2588)
                          at script(http://localhost:8080/PatientViewer/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js.jsf:2953)
                          at script(http://localhost:8080/PatientViewer/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js.jsf:2989)
                          at script(http://localhost:8080/PatientViewer/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js.jsf:2962)
                          at script(http://localhost:8080/PatientViewer/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js.jsf:2970)
                          at script(http://localhost:8080/PatientViewer/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js.jsf:3058)
                          at script(http://localhost:8080/PatientViewer/a4j/g/3_3_1.GA/org/ajax4jsf/framework.pack.js.jsf:2594)
                          at script(script in http://localhost:8080/PatientViewer/patientviewer/patientviewer.jsf from (891, 86) to (893, 17):892)
                          at script(script in http://localhost:8080/PatientViewer/patientviewer/patientviewer.jsf from (1088, 11) to (1090, 12):1089)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)
                          at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:178)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$5.doRun(JavaScriptEngine.java:423)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)
                          at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)
                          at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:432)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:407)
                          at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(HtmlPage.java:965)
                          at com.gargoylesoftware.htmlunit.html.HtmlScript.executeInlineScriptIfNeeded(HtmlScript.java:310)
                          at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:364)
                          at com.gargoylesoftware.htmlunit.html.HtmlScript$1.execute(HtmlScript.java:213)
                          at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:239)
                          at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:595)
                          at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
                          at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:549)
                          at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1025)
                          at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:927)
                          at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:206)
                          at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:329)
                          at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3041)
                          at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1993)
                          at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:910)
                          at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499)
                          at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452)
                          at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
                          at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:798)
                          at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:278)
                          at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:127)
                          at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:101)
                          at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:442)
                          at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:329)
                          at com.gargoylesoftware.htmlunit.javascript.host.Location$1.execute(Location.java:203)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.processPostponedActions(JavaScriptEngine.java:560)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:493)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.setState(XMLHttpRequest.java:165)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.doSend(XMLHttpRequest.java:440)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxFunction_send(XMLHttpRequest.java:375)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:161)
                          at net.sourceforge.htmlunit.corejs.javascript.FunctionObject.call(FunctionObject.java:476)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:3330)
                          at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:2487)
                          at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
                          at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
                          at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:267)
                          at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
                          at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
                          at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:82)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:492)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:457)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:528)
                          at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)
                          at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
                          at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:464)
                          at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:992)
                          at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:164)
                          at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:177)
                          at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:574)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:936)
                          at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:515)
                          at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:941)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1317)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1288)
                          at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1257)
                          at org.jboss.jsfunit.framework.FormAuthenticationStrategy.clickSubmitComponent(FormAuthenticationStrategy.java:127)
                          at org.jboss.jsfunit.framework.FormAuthenticationStrategy.doInitialRequest(FormAuthenticationStrategy.java:108)
                          at org.jboss.jsfunit.framework.WebClientSpec.doInitialRequest(WebClientSpec.java:259)
                          at org.jboss.jsfunit.jsfsession.JSFSession.(JSFSession.java:81)
                          at com.j4care.viewer.test.LoginTest.testInitialPage(LoginTest.java:34)
                          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:217)
                          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:46)
                          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:52)
                          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:119)
                          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:182)
                          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
                          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:637)
                          Caused by: java.lang.ClassCastException: com.gargoylesoftware.htmlunit.xml.XmlPage cannot be cast to com.gargoylesoftware.htmlunit.html.HtmlPage
                          at com.gargoylesoftware.htmlunit.html.FrameWindow.getEnclosingPage(FrameWindow.java:94)
                          at com.gargoylesoftware.htmlunit.WebClient$CurrentWindowTracker.webWindowContentChanged(WebClient.java:1889)
                          at com.gargoylesoftware.htmlunit.WebClient.fireWindowContentChanged(WebClient.java:866)
                          at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:445)
                          at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:329)
                          at com.gargoylesoftware.htmlunit.html.BaseFrame.(BaseFrame.java:70)
                          at com.gargoylesoftware.htmlunit.html.HtmlInlineFrame.(HtmlInlineFrame.java:48)
                          at com.gargoylesoftware.htmlunit.html.DefaultElementFactory.createElementNS(DefaultElementFactory.java:231)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.createFrom(XmlUtil.java:157)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:211)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.copy(XmlUtil.java:213)
                          at com.gargoylesoftware.htmlunit.xml.XmlUtil.appendChild(XmlUtil.java:146)
                          at com.gargoylesoftware.htmlunit.xml.XmlPage.(XmlPage.java:114)
                          at com.gargoylesoftware.htmlunit.xml.XmlPage.(XmlPage.java:73)
                          at com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest.jsxGet_responseXML(XMLHttpRequest.java:243)
                          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                          at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:161)
                          ... 137 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.FrameWindow.getEnclosingPage(FrameWindow.java:94)
                          at com.gargoylesoftware.htmlunit.WebClient$CurrentWindowTracker.webWindowContentChanged(WebClient.java:1889)
                          at com.gargoylesoftware.htmlunit.WebClient.fireWindowContentChanged(WebClient.java:866)
                          at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:445)
                          at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:329)
                          at com.gargoylesoftware.htmlunit.html.BaseFrame.(BaseFrame.java:70)
                          at com.gargoylesoftware.htmlunit.html.HtmlInlineFrame.(HtmlInlineFrame.java:48)
                          at com.gargoylesoftware.htmlunit.html.DefaultElementFactory.createElementNS(DefaultE

                          • 10. Re: newbie questions about login into a page
                            ssilvert

                            Can you post the full markup of the xhtml or jsp page?
                            What fancy stuff are you wanting this login screen to do?
                            Does it work from the browser?
                            Are you using HtmlUnit 2.5? 2.6 has some incompatibility with RichFaces.

                            Stan