Hi David, As you can see from the stack trace, the error is on the client side: it is the Ant JUnit test runner that gives the error. Thus it means you have included the cactus jar in the classpath of the executing <junit> task.
I'd also suggest that you try Cactus 1.5. It has a much improved Ant integration with 2 nice ready-made Ant tasks: <cactifywar> and <cactus>. Thanks -Vincent > -----Original Message----- > From: Karr, David [mailto:[EMAIL PROTECTED] > Sent: 25 November 2003 19:08 > To: [EMAIL PROTECTED] > Subject: NoClassDefFound for ServletTestCase with cactus jar in WEB- > INF/lib > > I'm using Cactus 1.4.1, Tomcat 4.1.24, and JDK 1.4.2. > > I have an existing web application that has a set of Cactus tests that > work fine. > > I now have a new application where I'm using a slightly different > directory structure, but is otherwise pretty similar. > > I tried to copy all the setup pieces from the first application to the > second. The Cactus setup is causing me problems in the second > application. > > In both cases, I build a "test.war" that gets installed into the Tomcat > "webapps" dir. Each war has a "WEB-INF/lib" directory which contains > (among others) the "cactus-1.4.1.jar" file. > > I'm starting with a single "stubbed" test case class in the second > application, just to make sure I get through all the setup tasks. Once > the stubbed test case executes properly, all the hard work is done. > > For some reason, the second application is failing with an exception > like the following. As I said, the "cactus-1.4.1.jar" file is in the > "WEB-INF/lib" of the war file, just like in the application where this > is working. The "org.apache.cactus.ServletTestCase" class is in that > jar. I don't understand what I could possibly do to screw this up. > I'll respond with some of the relevant configuration files if someone > doesn't have a quick answer. > > java.lang.NoClassDefFoundError: org/apache/cactus/ServletTestCase > at java.lang.ClassLoader.defineClass0(Native Method) > at java.lang.ClassLoader.defineClass(ClassLoader.java:537) > at > java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) > at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) > at java.net.URLClassLoader.access$100(URLClassLoader.java:55) > at java.net.URLClassLoader$1.run(URLClassLoader.java:194) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:187) > at java.lang.ClassLoader.loadClass(ClassLoader.java:289) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) > at java.lang.ClassLoader.loadClass(ClassLoader.java:235) > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) > at java.lang.Class.forName0(Native Method) > at java.lang.Class.forName(Class.java:141) > at > org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>(JUni > tTestRunner.java:237) > at > org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>(JUni > tTestRunner.java:210) > at > org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitT > estRunner.java:520) > Exception in thread "main" > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
