I am using the latest jar of Cobertura 2.0 and have done the setup defined here https://stackoverflow.com/a/212960/
After completing my test cases, when I try to close tomcat (ver 7) to collect coverage data, I get the following error:
Exception in thread "Thread-2" java.lang.NoClassDefFoundError: net/sourceforge/cobertura/coveragedata/TouchCollector$ApplyToClassDataLightClassmapListener at net.sourceforge.cobertura.coveragedata.TouchCollector.applyTouchesToSingleClassOnProjectData(TouchCollector.java:70) at net.sourceforge.cobertura.coveragedata.TouchCollector.applyTouchesOnProjectData(TouchCollector.java:58) at net.sourceforge.cobertura.coveragedata.ProjectData.saveGlobalProjectData(ProjectData.java:324) at net.sourceforge.cobertura.coveragedata.SaveTimer.run(SaveTimer.java:34) at java.lang.Thread.run(Thread.java:722) Caused by: java.lang.ClassNotFoundException: net.sourceforge.cobertura.coveragedata.TouchCollector$ApplyToClassDataLightClassmapListener at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) ... 5 more
Some additional observations
The associated class is present in the Cobertura banner file.
The missing class is a static nested class code cobertura github
There was a link to a bug related to this for an earlier release of cobertura March 3, 2010, 1.9.4.1
/ li>
Any quick fixes I can make and then rebuild cobertura from source to fix this?
UPDATE:
In the course of further trial and error, it seems that something is connected with the final interceptions. Instead of WEB-INF/lib I moved cobertura.jar to tomcat7/lib , which means that jar is now available to a later point when tomcat stops. As a result, the previous Cobertura NoClassDef error disappeared, but I get NoClassDef errors for classes in my application (presumably when cobertura starts trying to write coverage data for each of the classes). The cobertura stream fails and the ser file is not updated.
source share