1.

I’m Using Jboss. When I Stop The Server, The Coverage Data File Is Not Written. Or The Coverage Data File Is 0 Bytes. Or Cobertura-report And Cobertura-merge Complain That The Coverage Data File Is Invalid (possibly Throwing An Eofexception).?

Answer»

Cobertura only writes the COVERAGE data FILE at SHUTDOWN. It does this by adding a shutdown hook with Runtime.getRuntime().addShutdownHook(). JBoss has its own shutdown hook that calls System.halt() when its FINISHED. If the JBoss shutdown hook finishes before the Cobertura shutdown hook, then the CALL to System.halt() causes the JVM to halt and the cobertura.ser file will be incomplete.

To fix this, set -Djboss.shutdown.forceHalt=false when starting JBoss.

Cobertura only writes the coverage data file at shutdown. It does this by adding a shutdown hook with Runtime.getRuntime().addShutdownHook(). JBoss has its own shutdown hook that calls System.halt() when its finished. If the JBoss shutdown hook finishes before the Cobertura shutdown hook, then the call to System.halt() causes the JVM to halt and the cobertura.ser file will be incomplete.

To fix this, set -Djboss.shutdown.forceHalt=false when starting JBoss.



Discussion

No Comment Found