Sheldon,
Here is how it works : The Redirector, which is located in one WAR needs to dynamically load your test class. Thus if you move the test classes in another war it will fail with the error message you're getting. All classes under test + test classes + cactus settings must be in the same WAR. However, if you're using Ant you can define several targets to package your application : - one for testing - one for production -Vincent -----Original Message----- From: Sheldon Fernandes [mailto:[EMAIL PROTECTED]] Sent: 14 January 2002 10:35 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: "ClassCastException" in Cactus integrated into WSAD Hi, I have integrated Cactus into WSAD by creating a web project containing the Redirectors. The project also contains all the sample tests, which are run through "TestAll.java". These tests run sucessfully. Now, if I move the test cases into another project (i.e. another war file, different from the one containing the redirectors) and try to run them, I get a ClassCastException. The following is an extract from the cactus_server.log generated by log4j. ************************************************************************ ***************************************************** 15:37:33,363 [Servlet.Engine.Transports:9] DEBUG server.AbstractTestCaller - >getTestClassClass([org.apache.cactus.sample.TestSampleServlet]) 15:37:33,363 [Servlet.Engine.Transports:9] DEBUG server.AbstractTestCaller - <getTestClassClass 15:37:33,724 [Servlet.Engine.Transports:9] ERROR server.AbstractTestCaller - Error instanciating class [org.apache.cactus.sample.TestSampleServlet(testPostMethod)] java.lang.ClassCastException: org.apache.cactus.sample.TestSampleServlet at org.apache.cactus.server.AbstractTestCaller.getTestClassInstance(Abstrac tTestCaller.java:305) at org.apache.cactus.server.AbstractTestCaller.doTest(AbstractTestCaller.ja va:130) at org.apache.cactus.server.AbstractTestController.handleRequest(AbstractTe stController.java:122) at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirec tor.java:134) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletMan ager.java:827) at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLife cycleServlet.java:159) at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleSe rvlet.java:286) at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifec ycleServlet.java:106) at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.jav a:472) at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(Servle tManager.java:1012) at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletM anager.java:913) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispat ch(WebAppRequestDispatcher.java:499) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppReq uestDispatcher.java:278) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequ estDispatcher.java:105) at com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker.java:67 ) at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvo ker.java:123) at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(Cach edInvocation.java:67) at com.ibm.servlet.engine.invocation.CacheableInvocationContext.invoke(Cach eableInvocationContext.java:106) at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(Servlet RequestProcessor.java:125) at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEList ener.java:315) at com.ibm.servlet.engine.http11.HttpConnection.handleRequest(HttpConnectio n.java:60) at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java: 313) at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:242) at com.ibm.ws.util.CachedThread.run(ThreadPool.java:122) ************************************************************************ ***************************************************** The lib folders of both projects contain the same files i.e. cactus.jar, httpclient.jar, junit.jar and log4j.jar and both projects have the same build path settings (i.e. client side classpath is the same). I have also updated the server-side classpath so that the redirector can locate the testcases. What could be the problem? Can't I put my test cases and redirectors in differrent war files? Thanks, Sheldon
