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 Rebecca Hauck <re...@metatv.com> on 2004/03/12 02:15:05 UTC
Test class not found
Hi,
I'm new to Cactus + Ant and am having some trouble getting my tests to
run (trace is below).
I have a cactified war file... the app to be tested + my test class.
Here is what I have in my build.xml file:
<cactifywar srcfile="lib/packager-5.2-148.war"
destfile="${dist.dir}/cact-packager-5.2.war">
<classes dir="${build.dir}/com/test/cactus" includes="**/*.class"/>
</cactifywar>
I then deploy the cactified warfile through an in-house UI deployment
app (as this is part of our real user's scenario)
I restart container (Resin 2.x)
I then run my test from a client machine as a normal Junit test.
I verified the following things:
- My test class is at WEB-INF/classes/ CactusServletTests.class (that's
where it got put after deployment)
- There is only one cactus.jar file on the server side and only one on
the client
- I try:
http://192.168.101.42:9090/cact-packager/ServletRedirector?Cactus_Servic
e=RUN_TEST in a browser and get a blank page as I'm supposed to, so the
jar file is indeed being found with the ServletRedirector.class in it.
Other things I tried: (Is this where my test class is supposed to be b/c
of how I named the package?)
- I manually create WEB-INF/classes/com/test/cactus/ and copy
CactusServletTests.class there - restart Resin.
Any input, advice, help would be GREATLY appreciated. I have read and
read and read all the cactus and ant docs, searched the web high and
low, even tried some other peoples' solutions to the problem.... to no
avail :-(
Thanks!
javax.servlet.ServletException: Error finding class
[com.test.cactus.CactusServletTests] using both the Context classloader
and the webapp classloader. Possible causes include:
- Your webapp does not include your test classes,
- The cactus.jar is not located in your WEB-INF/lib
directory and your Container has not set the Context classloader to
point to the webapp one
at
org.apache.cactus.server.AbstractWebTestCaller.getTestClassClass(Abstrac
tWebTestCaller.java:518)
at
org.apache.cactus.server.AbstractWebTestCaller.getTestClassInstance(Abst
ractWebTestCaller.java:401)
at
org.apache.cactus.server.AbstractWebTestCaller.doTest(AbstractWebTestCal
ler.java:148)
at
org.apache.cactus.server.AbstractWebTestController.handleRequest_aroundB
ody0(AbstractWebTestController.java:130)
at
org.apache.cactus.server.AbstractWebTestController.handleRequest_aroundB
ody1$advice(AbstractWebTestController.java:158)
at
org.apache.cactus.server.AbstractWebTestController.handleRequest(Abstrac
tWebTestController.java)
at
org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(Servle
tTestRedirector.java:138)
at
org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice
(ServletTestRedirector.java:158)
at
org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirec
tor.java)
at
org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(Servlet
TestRedirector.java:109)
at
org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(
ServletTestRedirector.java:158)
at
org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirect
or.java)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:126)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
at
com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.ja
va:96)
at
com.caucho.server.http.Invocation.service(Invocation.java:315)
at
com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246)
at
com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:163
)
at
com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:534)
Re: Test class not found
Posted by Kazuhito SUGURI <su...@lab.ntt.co.jp>.
Hi Rebecca,
In article <83...@mailserver.metatv-ds.metatv.com>,
Thu, 11 Mar 2004 17:15:05 -0800,
"Rebecca Hauck" <re...@metatv.com> wrote:
rebeccahauck> I'm new to Cactus + Ant and am having some trouble getting my tests to
rebeccahauck> run (trace is below).
[snip]
rebeccahauck> - My test class is at WEB-INF/classes/ CactusServletTests.class
[snip]
rebeccahauck> javax.servlet.ServletException: Error finding class
rebeccahauck> [com.test.cactus.CactusServletTests] using both the Context classloader
If your test class is com.test.cactus.CactusServletTests,
the class file should be located under WEB-INF/classes/com/test/cactus/.
rebeccahauck> <classes dir="${build.dir}/com/test/cactus" includes="**/*.class"/>
I guess, this should be
<classes dir="${build.dir}/" includes="com/test/cactus/**"/>
or something similar.
I hope this helps,
----
Kazuhito SUGURI
mailto:suguri.kazuhito@lab.ntt.co.jp