ClassCastException: JavaScript$Control after webapp redeployment

Jeff C <[email protected]>
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <[email protected]>
Hi, Thanks in advance to anyone who can shed some light on this. 

I have been sucessfully using httpunit to drive a backend screen based application.

This code is embedded in a web application (.war file, contained in an .ear file).

The problem seems to be if the .ear is re-deployed, 
httpunit or the js portion is not re-initialized completely.

The httpunit call:

GetMethodWebRequest getReq = new GetMethodWebRequest(urlHelper.getLoginURL());
wResp = wc.getResponse(getReq);


fails with:

java.lang.ClassCastException: 
 com/meterware/httpunit/javascript/JavaScript$Control 
  incompatible with 
 com/meterware/httpunit/javascript/JavaScript$Control

The stack trace:

[Servlet.LOG]: 983120537:2007.01.22-13:12:33:203 CRNBaseAction : Action Error: java.lang.RuntimeException: Event 'if (window.init) init();' failed: org.mozilla.javascript.JavaScriptException: java.lang.ClassCastException: com/meterware/httpunit/javascript/JavaScript$Control incompatible with com/meterware/httpunit/javascript/JavaScript$Control
    at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.handleScriptException(JavaScript.java)
    at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEvent(JavaScript.java)
    at com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(ScriptableDelegate.java:56)
    at com.meterware.httpunit.WebResponse$Scriptable.load(WebResponse.java:689)
    at com.meterware.httpunit.javascript.JavaScript.load(JavaScript.java:89)
    at com.meterware.httpunit.javascript.JavaScriptEngineFactory.load(JavaScriptEngineFactory.java:58)
    at com.meterware.httpunit.RequestContext.runScripts(RequestContext.java)
    at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:122)
    at com.meterware.httpunit.WebClient.getResponse(WebClient.java:113)
    at com.hcsc.crnclient.action.CRNGetReport.crnLogin(CRNGetReport.java)
    at com.hcsc.crnclient.action.CRNGetReport.doAction(CRNGetReport.java)
    at com.hcsc.crnclient.action.CRNBaseAction.execute(CRNBaseAction.java:80)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:673)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2905)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220)
    at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1829)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:84)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:469)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:408)
    at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:101)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1455)


The application is un-usable at this point without re-starting the server.

I am trying to determine if there is a way to force a complete re-initialization from an application context listener, or some other strategy to correct this.

I have been scouring the net and running this code through the debugger but hit the wall at method inv3.invoke()...

Any suggestions or insights would be appreciated.

Thanks.

-Jeff
 
---------------------------------
Need a quick answer? Get one in minutes from people who know. Ask your question on Yahoo! Answers.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.