ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JOMO00 <heinrichrob...@hotmail.com>
Subject Re: java.lang.ClassNotFoundException" when running junit task
Date Thu, 28 Aug 2008 07:05:56 GMT

Hi All,
I read just read the thread below. Ich have the same Exception by unsing ant
and <junit>. I know there is a problem with the classpath, but I don't know
what is wrong. Which *jar files do I need an my classpath?Here my script

<property name="test.class.name" value="JUnit.junit.samples.AllTests" />
	
<path id="test.classpath">
      <fileset dir="${destpath}/${outputDir}">
          <include name="*.jar" /> 
          </fileset>
      <fileset dir="C:/Documents and Settings/heinrich">
         <include name="**/*.jar" /> 
      </fileset>
</path>

<target name="test" depends="compile">
<junit printsummary="${printsummary}" fork="no" haltonfailure="yes">
     <classpath refid="test.classpath" /> 
     <test name="${test.class.name}" />  
     <formatter type="plain" usefile="false" /> 
</junit>
</target> 

My Error in detail is: 
 
 [junit] Running JUnit.junit.samples.AllTests
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
    [junit] Testsuite: JUnit.junit.samples.AllTests
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
    [junit] Caused an ERROR
    [junit] JUnit.junit.samples.AllTests
    [junit] java.lang.ClassNotFoundException: JUnit.junit.samples.AllTests
    [junit] at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    [junit] at java.security.AccessController.doPrivileged(Native Method)
    [junit] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    [junit] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    [junit] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    [junit] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    [junit] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    [junit] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    [junit] at java.lang.Class.forName0(Native Method)
    [junit] at java.lang.Class.forName(Class.java:247)
    [junit] at
org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
    [junit] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
    [junit] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
	
Thank you for your help!
JOMO00
 

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
> 
> 

-- 
View this message in context: http://www.nabble.com/java.lang.ClassNotFoundException%22-when-running-junit-task-tp14167580p19195253.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message