You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Sheldon Fernandes <sh...@patni.com> on 2002/01/14 11:35:23 UTC
"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
.AbstractTestCaller -
>getTestClassClass([org.apache.cactus.sample.TestSampleServlet])
15:37:33,363 [Servlet.Engine.Transports:9] DEBUG
.AbstractTestCaller - <getTestClassClass
15:37:33,724 [Servlet.Engine.Transports:9] ERROR
.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(AbstractTes
tCaller.java:305)
at
org.apache.cactus.server.AbstractTestCaller.doTest(AbstractTestCaller.java:1
30)
at
org.apache.cactus.server.AbstractTestController.handleRequest(AbstractTestCo
ntroller.java:122)
at
org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.
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(ServletManager
.java:827)
at
com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycl
eServlet.java:159)
at
com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServle
t.java:286)
at
com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycle
Servlet.java:106)
at
com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:47
2)
at
com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletMan
ager.java:1012)
at
com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManag
er.java:913)
at
com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(W
ebAppRequestDispatcher.java:499)
at
com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequest
Dispatcher.java:278)
at
com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestD
ispatcher.java:105)
at
com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker.java:67)
at
com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.
java:123)
at
com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedIn
vocation.java:67)
at
com.ibm.servlet.engine.invocation.CacheableInvocationContext.invoke(Cacheabl
eInvocationContext.java:106)
at
com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequ
estProcessor.java:125)
at
com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener
.java:315)
at
com.ibm.servlet.engine.http11.HttpConnection.handleRequest(HttpConnection.ja
va: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
RE: "ClassCastException" in Cactus integrated into WSAD
Posted by Vincent Massol <vm...@octo.com>.
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:sheldon.fernandes@patni.com]
Sent: 14 January 2002 10:35
To: vmassol@octo.com; cactus-user@jakarta.apache.org
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