This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant/Cactus classpath problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant/Cactus classpath problems" Watch "Ant/Cactus classpath problems" New topic

Ant/Cactus classpath problems

Paul A Green

Joined: Sep 17, 2003
Posts: 6
Hi All,
I'm trying to run some tests on a cactified WAR file, using Ant to trigger Cactus to do the job. I'm having some problems with NoClassDefFound errors. When I set the <cactus> task's "fork" attribute to "yes", Ant cannot see the "xml-apis.jar", which it should be using to format the XML reports of the test results, despite that jar being in the ant/lib directory alongside ant.jar itself, and also being on the classpath of the <taskdef> for the <cactus> tasks. I have opened up this jar to check that the particular class that is not being found, "org.w3c.dom.Node", is there, and it is.
If I set the <cactus> task's "fork" attribute to "no", an XML report is produced, but my tests fail at the first hurdle because classes that were added to the WAR file during "cactification" cannot be found. I have opened up the cactified WAR file to check that those classes are present, and they are. In an ideal world, I would like to have "fork" set to "yes" so that my tests can't interfere with each other.
I'm obviously missing some classpath issue here. Can anyone help?
Paul A Green

Joined: Sep 17, 2003
Posts: 6
Hi Again,
OK, i've cracked it, so I thought i'd better say so before anyone wastes their time thinking about it. Apologies to anyone who already has. It was a bit of a schoolboy error (do people outside the UK use that expression?) by me, i'm ashamed to say. The tests I was trying to run using Cactus had originally been vanilla JUnit tests. In Changing over to Cactus, I had forgotten to have my test classes extend Cactus' "ServletTestCase" instead of JUnit's "TestCase". Still, I guess that's the "experience" they mean when they say "salary according to experience".
I agree. Here's the link:
subject: Ant/Cactus classpath problems
It's not a secret anymore!