Results 1 to 4 of 4
- 09-18-2012, 01:09 PM #1
Member
- Join Date
- Sep 2012
- Posts
- 3
- Rep Power
- 0
cobertura code coverage showing classnotfound error for log4j.jar in hudson
XML Code:Error: [report] nothing to do: no runtime coverage data found in any of the data files Am able to get instrumented classes,but i could not find my runtime coverage data.Am getting the output in hudson using build.xml(ant).Can anyone please help me out...The following is my build.xml file... <path id="classpath.test"> <pathelement location="${dir.dest}/test.jar"/> <fileset dir="C:\Program Files\Java\jre7\lib\ext"> <include name="**/*.jar"/> </fileset> </path> <path id="emma.lib"> <pathelement location="C:\Program Files\Java\jre7\lib\ext\emma-2.0.5312.jar" /> <pathelement location="C:\Program Files\Java\jre7\lib\ext\emma_ant-2.0.5312.jar" /> </path> <taskdef resource="emma_ant.properties" classpathref="emma.lib" /> <target name="compile" depends="init,prepare" > <javac classpathref="classpath.test" debug="on" srcdir="${src.dir}" destdir="${out.dir}" /> <emma enabled="${emma.enabled}" > <instr instrpathref="run.classpath" destdir="${out.instr.dir}" metadatafile="${coverage.dir}/coverage.emma" merge="true"> <filter excludes="*Test*"/> </instr> </emma> </target> <target name="run" depends="jar"> <java classpathref="classpath.test" classname="MainArea" fork="true"/> </target> <target name="junit" depends="run"> <junit fork="true" haltonfailure="false" printsummary="yes" failureproperty="test.failed"> <classpath refid="classpath.test"/> <classpath> <pathelement location="${basedir}/src" /> <pathelement location="${out.instr.dir}" /> <pathelement location="C:\Program Files\Java\jre7\lib\ext\junit-4.10.jar" /> <pathelement location="C:\Program Files\Java\jre7\lib\ext\emma-2.0.5312.jar" /> <pathelement location="C:\Program Files\Java\jre7\lib\ext\emma_ant-2.0.5312.jar" /> </classpath> <formatter type="brief" usefile="false"/> <formatter type="xml"/> <batchtest todir="."> <fileset dir="./workspace"> <include name = "MainAreaTest.java"/> </fileset> </batchtest> <jvmarg value="-Demma.coverage.out.file=${coverage.dir}/coverage.emma"/> <jvmarg value="-Demma.coverage.out.merge=true"/> </junit> </target> <target name="emma.report" depends="junit"> <emma enabled="${emma.enabled}" verbosity="verbose"> <report sourcepath="./workspace" > <fileset dir="${coverage.dir}" > <include name="*.emma" /> </fileset> <txt outfile="${coverage.dir}/coverage.txt"/> <html outfile="${coverage.dir}/coverage.html"/> <xml outfile="${coverage.dir}/coverage.xml"/> </report> </emma> </target> </project> I got the output like this.... compile: [javac] Compiling 5 source files to C:\Users\.hudson\jobs\Code_Coverage\out [instr] processing instrumentation path ... [instr] instrumentation path processed in 78 ms [instr] [7 class(es) instrumented, 0 resource(s) copied] [instr] metadata merged into [C:\Users\.hudson\jobs\Code_Coverage\coverage\coverage.emma] {in 0 ms} emma.report: [report] [EMMA v2.0, build 5312 (2005/06/12 19:32:43)] [report] input data path: [report] { [report] C:\Users\.hudson\jobs\Code_Coverage\coverage\coverage.emma [report] } [report] source path: [report] { [report] C:\Users\.hudson\jobs\Code_Coverage\workspace [report] } [report] processing input file [C:\Users\.hudson\jobs\Code_Coverage\coverage\coverage.emma] ... [report] loaded 7 metadata entries [report] 1 file(s) read and merged in 0 ms [report] nothing to do: no runtime coverage data found in any of the data files
- 09-18-2012, 01:52 PM #2
Member
- Join Date
- Sep 2012
- Posts
- 3
- Rep Power
- 0
cobertura code coverage showing classnotfound error for log4j.jar in hudson
Hi,
Am working with cobertura code coverage in integration with hudson using ant.I can get the coverage report when i execute in the command prompt ie without using hudson.when i execute the same code in hudson i am getting an error as classdefnot found for log4j.jar file.eventhough i deploy log4j.jar file in both myapplication/lib and classpath,But my code executing fine in command prompt.My build.xml is
XML Code:<?xml version="1.0"?> <project name="anttest" default="coverage" basedir="."> <property name="dir.src" value="."/> <property name="dir.build" value="build"/> <property name="dir.dest" value="dest"/> <property name="dir.instr" value="instr"/> <property name="dir.coverage" value="coverage"/> <path id="classpath.test"> <pathelement location="${dir.dest}/test.jar"/> <fileset dir="C:\Program Files\Java\jre6\lib\ext"> <include name="**/*.jar"/> </fileset> </path> <taskdef classpath="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\ROOT\WEB-INF\lib\cobertura.jar" resource="tasks.properties"/> <path id="cobertura"> <fileset dir="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\ROOT\WEB-INF\lib"> <include name="cobertura.jar"/> <include name="log4j.jar"/> <include name="asm-2.2.1.jar"/> <include name="apache-jakarta-oro.jar"/> </fileset> </path> <target name="clean" description="Removing the all generated files."> <delete dir="${dir.build}"/> <delete dir="${dir.dest}"/> <!--<delete dir="C:\Users\ss5000762\.hudson\jobs\Code_Coverage\htmlreports\HTML_Report\workspace"/>--> </target> <target name="prepare" depends="clean"> <mkdir dir="${dir.build}"/> <mkdir dir="${dir.dest}"/> </target> <target name="compile" depends="prepare" description="Compilation of all source code."> <javac fork="yes" classpathref="classpath.test" debug="true" srcdir="${dir.src}" destdir="${dir.build}" /> </target> <target name="instrumentation" depends="compile"> <echo message="instrument starts"/> <cobertura-instrument classpathref="cobertura" todir="${dir.instr}"> <fileset dir="${dir.build}"> <include name="**/*.class"/> </fileset> </cobertura-instrument> </target> <target name="jar" depends="instrumentation"> <jar jarfile="${dir.dest}/test.jar" basedir="${dir.build}"> <manifest> <attribute name="Main-Class" value="MainArea"/> </manifest> </jar> </target> <target name="run" depends="jar"> <java jar="${dir.dest}/test.jar" fork="true"/> </target> <target name="junit" depends="run"> <junit fork="true" haltonfailure="false" printsummary="yes" failureproperty="test.failed"> <formatter type="brief" usefile="false"/> <formatter type="xml"/> <classpath> <path refid="classpath.test"/> </classpath> <batchtest todir="C:\ant\apache-ant-1.7.1\workspace"> <fileset dir="."> <include name = "MainAreaTest.java"/> </fileset> </batchtest> </junit> </target> <target name="coverage" depends="junit"> <cobertura-merge classpathref="cobertura"> <fileset dir="${basedir}"> <include name="**/cobertura.ser"/> </fileset> </cobertura-merge> <!--<cobertura-report classpathref="cobertura" format="xml" srcdir="${dir.src}" destdir="${dir.coverage}"/> <cobertura-report classpathref="cobertura" format="html" srcdir="${dir.src}/*.ser" destdir="${dir.coverage}"/>--> <cobertura-report classpathref="cobertura" format="html" destdir="${dir.coverage}" > <fileset dir="${dir.src}"> <include name="**/*.java" /> <exclude name="**/*stub.java" /> </fileset> </cobertura-report> </target> </project>
Iam getting the following error in hudson,
XML Code:Started by user anonymous [workspace] $ cmd.exe /C '"C:\ant\apache-ant-1.7.1\bin\ant.bat && exit %%ERRORLEVEL%%"' Buildfile: build.xml clean: [delete] Deleting directory C:\Users\SS5000762\.hudson\jobs\cobertura code\build [delete] Deleting directory C:\Users\SS5000762\.hudson\jobs\cobertura code\dest prepare: [mkdir] Created dir: C:\Users\SS5000762\.hudson\jobs\cobertura code\build [mkdir] Created dir: C:\Users\SS5000762\.hudson\jobs\cobertura code\dest compile: [javac] Compiling 5 source files to C:\Users\SS5000762\.hudson\jobs\cobertura code\build instrumentation: [echo] instrument starts BUILD FAILED java.lang.NoClassDefFoundError: org/apache/log4j/Category at net.sourceforge.cobertura.ant.InstrumentTask.execute(InstrumentTask.java:144) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.performTasks(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337) at org.apache.tools.ant.Project.executeTarget(Project.java:1306) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1189) at org.apache.tools.ant.Main.runBuild(Main.java:758) at org.apache.tools.ant.Main.startAnt(Main.java:217) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Category at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1400) at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1341) at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1088) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 18 more Total time: 0 seconds [DEBUG] Skipping watched dependency update for build: cobertura code #61 due to result: FAILURE Finished: FAILURE
- 09-18-2012, 04:30 PM #3
Re: cobertura code coverage showing classnotfound error for log4j.jar in hudson
Don't double post. I've merged the two threads.
Go through the Forum Rules -- particularly the second paragraph.
dbIf you're forever cleaning cobwebs, it's time to get rid of the spiders.
- 09-20-2012, 12:11 PM #4
Member
- Join Date
- Sep 2012
- Posts
- 3
- Rep Power
- 0
Re: cobertura code coverage showing classnotfound error for log4j.jar in hudson
hi,
Actually we are trying to generate coverage report using both emma and cobertura plugins in hudson.we are facing different errors while using both plugins,thats why we posted it as two threads.kindly help us to solve these issues..
Similar Threads
-
Old gui showing instead of new gui code
By aianta in forum New To JavaReplies: 7Last Post: 11-28-2011, 03:30 AM -
Coverage
By Martin.Keprta in forum EclipseReplies: 0Last Post: 07-26-2011, 02:08 PM -
hudson Error - SEVERE: Failed to initialize Hudson
By ak88 in forum NetworkingReplies: 1Last Post: 02-14-2011, 02:08 PM -
Cobertura 1.9
By levent in forum Java SoftwareReplies: 0Last Post: 06-06-2007, 11:14 AM
Bookmarks