ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knuplesch, Juergen" <Juergen.Knuple...@icongmbh.de>
Subject AW: java.lang.ClassNotFoundException" when running junit task
Date Fri, 29 Aug 2008 06:46:02 GMT
Hello,

Obviously you do not have the Testclass BaseServiceCommunicationManagerTest in the classpath.

You do not do anything elementary wrong. It is "just" a classpath-problem. (Missing jars,
wrong written classes esp. Upper / lowercase)
This happens a lot and sometimes you loose your faith in IT.
But this happens to almost everyone.
The only solution: Never give up, till you find the error.

Lets have a look:
You call JUnit.junit.samples.AllTests: 

Are this the sample Tests of junit?
Have you written a test on your own?
Where 

The AllTests probably adds BaseServiceCommunicationManagerTest to the Testsuite.

Check your classpath for BaseServiceCommunicationManagerTest.class. 
Check your jarfiles on the classpath for this class.

If java does not lie, you do not have it on your classpath.


Good luck

Jürgen

-- 
Jürgen Knuplesch
-----Ursprüngliche Nachricht-----
Von: JOMO00 [mailto:heinrichrobert@hotmail.com] 
Gesendet: Donnerstag, 28. August 2008 18:24
An: user@ant.apache.org
Betreff: Re: java.lang.ClassNotFoundException" when running junit task


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

--
View this message in context: http://www.nabble.com/java.lang.ClassNotFoundException%22-when-running-junit-task-tp14167580p19204128.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


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


Mime
View raw message