Java Mailing List Archive

http://www.ant-tasks.com/

Home » Ant Users List »

Re: java.lang.ClassNotFoundException" when running junit task

JOMO00

2008-08-28

Replies: Find Java Web Hosting

Author LoginPost Reply

Hi,
I already have great problems with ant and junit. I run ant 1.6.5 and junit
4.5 is this combination ok?
Should i better use ant 1.7.0 or 1.7.1?

I always get a ClassDefNotFoundException or ClassNotFoundException.
I tried to put junit.jar and my source directory to classpath, but i always
get a Exception.
here is my script:
...
<path id="junit.classpath">
<pathelement location="C:/Documents and Settings/heinrich" />
<pathelement location="${destpath}/${sourceDir}" />
</path>
<target name="test" depends="check_out_configuration">
<junit printsummary="${printsummary}" fork="no" haltonfailure="yes">
<classpath refid="junit.classpath" />
<test name="JUnit.junit.samples.AllTests"
todir="${destpath}/${outputDir}/reports" />
<formatter type="xml" usefile="no" />
</junit>
<junitreport todir="${destpath}/${outputDir}/html">
<fileset dir="${destpath}/${outputDir}/reports">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${destpath}/${outputDir}/html" />
</junitreport>
</target>
...
Please give me an overview of what i have to add to my classpath. Which
.jar-files and other files or directories.





venkata prasad wrote:
>
> Hi All,
>
> I am getting the below error while execting junit task.
>
>
>
> Testsuite: BaseServiceCommunicationManagerTest
>
> Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
>
>
>
>        Caused an ERROR
>
> BaseServiceCommunicationManagerTest
>
> java.lang.ClassNotFoundException: BaseServiceCommunicationManagerTest
>
>        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:306)
>
>        at
> sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
>
>        at java.lang.ClassLoader.loadClass (ClassLoader.java:251)
>
>        at
> java.lang.ClassLoader.loadClassInternal (ClassLoader.java:319)
>
>        at java.lang.Class.forName0(Native Method)
>
>        at java.lang.Class.forName (Class.java:164)
>
>
>
> Below is the build script.
>
>
>
>
>
> <project name="testing" default="junit.tool" basedir=".">
>
>
>
>
>
> <path id="depends.jar.path">
>
>     <fileset dir="C:\ccviews\build_dynapp-1111\vbocig-dynapp"
> includes="**/*.jar"/>
>
>     <fileset dir="./output" includes="DAWS.ear"/>
>
>     <fileset dir="./output" includes="Dynapps.war"/>
>
>     <fileset dir="D:/ERA/tools/junit4.4" includes="junit-4.4.jar"/>
>
>
>
>     <fileset dir="D:\bea\weblogic92\server\lib" includes="weblogic.jar
> "/>
>
> </path>
>
>
>
> <target name="junit.tool">
>
> <junit printsummary="yes" showoutput="yes" haltonfailure="true"
> fork="yes">
>
>
>
>  <classpath refid="depends.jar.path"/>
>
>  <formatter type="plain"/>
>
>
>
> <batchtest fork="yes" todir="./junit">
>
>        <fileset
> dir="./output/DynappsEar/WEB-INF/classes/com/cig/dynapp/test">
>
>                <include name="
> BaseServiceCommunicationManagerTest.class"/>
>
>        </fileset>
>
>  </batchtest>
>
>
>
> </junit>
>
> </target>
>
> </project>
>
>
>
> I am running at ant-1.7 and junit-4.4.
>
>
>
>
>
> Thanks,
>
> Prasad
>
>

--
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.