• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Ant and Cactus - classpath issues

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello there,
We are trying to run in-container tests using Ant and Cactus. As far as we know, the classpath is configured properly.
When we run our build file, the output is as follows:
<error message="TestSampleServlet" type="java.lang.ClassNotFoundException">java.lang.ClassNotFoundException: TestSampleServlet
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
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)
</error>
The directory in which our test classes are located is included in cactus classpath. The error above doesn't state if this classpath error is occurring in the client or the server.
The interesting point is that when we run our test using a web browser, everything works accordingly.
http://localhost:8080/test/ServletTestRunner?suite=TestSampleServlet
Please could anyone help ?
Thanks a lot !
Juarez Junior
SCPJ2/SCWCD/SCBCD
 
Juarez Alvares Barbosa Junior
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Problem was fixed. Thanks,
Juarez
 
Ranch Hand
Posts: 716
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How?
 
Al Newman
Ranch Hand
Posts: 716
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To answer my own question, as I recall the classloader problem occured because the <cactus> element needed the class file of the cactus test on it's classpath, not merely inside the ear/war file but the actual compiled .class file.
Looking at my changes from 10 days ago it appears as if I added a <pathelement location="${env.target_dir}/build/tmp/cactus-test"/>
statement to the <classpath> subelement of the <cactus> element. This points to the top of the package directory heirarchy for the CactusTest.class file.
That is, if the java file is in
package foo.foo2;
and the actual class file is in ${env.target_dir}/build/tmp/cactus-test/foo/foo2/CactusTest.class
Then the classpath has to have the base dir ${env.target_dir}/build/tmp/cactus-test on it to work. One of the lovely little thorns of Cactus.
Hope this helps.
[ November 21, 2003: Message edited by: Alfred Neumann ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic