Wednesday, July 29, 2009

Cobertura ExceptionInInitializerError with Java 1.6.0_14

I ran into a problem running Cobertura via Maven with Java 1.6.0_14 and version 2.2 of the cobertura-maven-plugin.

Basically, every class, whether it be a Java or Groovy, was reported to have 0% coverage. The exception I found in the build log:
Results :

Tests run: 31, Failures: 0, Errors: 0, Skipped: 0

Exception in thread "Thread-0" java.lang.ExceptionInInitializerError
at java.io.File.deleteOnExit(File.java:939)
at net.sourceforge.cobertura.util.FileLocker.(FileLocker.java:80)
at net.sourceforge.cobertura.coveragedata.ProjectData.saveGlobalProjectData(ProjectData.java:230)
at net.sourceforge.cobertura.coveragedata.SaveTimer.run(SaveTimer.java:31)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.IllegalStateException: Shutdown in progress
at java.lang.Shutdown.add(Shutdown.java:62)
at java.lang.System$2.registerShutdownHook(System.java:1146)
at java.io.DeleteOnExitHook.(DeleteOnExitHook.java:20)
... 5 more
Anyone who runs into a similar problem can resolve it by upgrading to version 2.3 of the plugin which uses Cobertura 1.9.2. Upgrading to 1.9.2 would likely resolve the issue for non-Maven users too.

6 comments:

  1. Thank you. Your suggestion worked.
    Aaron Stewart

    ReplyDelete
  2. Thanks for your suggestion. This worked well

    ReplyDelete
  3. ey!! Thanks!! I had the same problem, but I were using Ant...

    ReplyDelete