ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Baedorf <michael.baed...@ioag.com>
Subject ClassNotFoundProblem
Date Mon, 25 Jun 2001 10:47:30 GMT
Hi,

I want to use Ant and JUnit. I wrote the following XML file:
<project name="MyProject" default="test" basedir=".">
   <property name="src" value="com/ioag/billingware/server"/>
   <property name="testsrc"
value="d:/testing/com/ioag/billingware/server"/>
   <property name="build" value="d:/build"/>
   <!-- Aufraeumen der Verzeichnisse -->
   <target name="clean">
      <!-- Delete the ${build} and ${dist} directory trees -->
      <delete dir="${build}"/>
   </target>
   <!-- Vorbereiten des Outputverzeichnisses -->
   <target name="prepare">
      <tstamp/>
      <mkdir dir="${build}"/>
   </target>
   <target name="compile" depends="prepare">
      <javac srcdir="${src}" destdir="${build}"/>
   </target>
   <target name="test" depends="compile">
      <junit printsummary="yes" haltonfailure="no">
         
<classpath>
<!-- you need this -->
<pathelement location="d:/ant/lib/optional.jar"/>
<pathelement location="d:/ant/lib/ant.jar"/>
<pathelement location="d:/build"/>
</classpath>

<formatter type="xml"/>
         
         <batchtest>
            <!-- Dateiauswahl -->
            <fileset dir="${testsrc}">
               <include name="*Test.java"/>
            </fileset>
         </batchtest>
      </junit>
   </target>
</project>

But all I got are XML failure files with the following content:
<?xml version="1.0"?>
<testsuite name="AgentenTest" tests="1" failures="0" errors="1"
time="0">
  <error message="AgentenTest"
type="java.lang.ClassNotFoundException"><![CDATA[java.lang.ClassNotFou
ndException: AgentenTest
	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
	at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
	at
org.apache.tools.ant.AntClassLoader.findBaseClass(AntClassLoader.java:
517)
	at
org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:376)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
	at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>(JU
nitTestRunner.java:161)
	at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUn
itTask.java:387)
	at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTa
sk.java:283)
	at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTa
sk.java:263)
	at org.apache.tools.ant.Target.execute(Target.java:153)
	at org.apache.tools.ant.Project.runTarget(Project.java:898)
	at
org.apache.tools.ant.Project.executeTarget(Project.java:536)
	at
org.apache.tools.ant.Project.executeTargets(Project.java:510)
	at org.apache.tools.ant.Main.runBuild(Main.java:421)
	at org.apache.tools.ant.Main.main(Main.java:149)
]]></error>
</testsuite>

The Testclasses are OK because all of them worked with Forte.

What is my mistake?

Can somebody help me?

Thanks

Mime
View raw message