Search code examples
javawindows-servicescoberturashutdown-hook

Running a Windows service, and cobertura


I'm trying to run a windows service with cobertura. The only problem is cobertura reports results when the shutdown hook is executed. I am unable to directly modify the code for these results, so I was wondering if it is possible to run a java application as a windows service and still gather cobertura results. I instrument the code, add it to the classpath, but when reporting, I get nothing. When viewing a trace file, it fails to load/save any cobertura information. This leads me to believe that shutdown hooks never get executed, otherwise I would get results.

Thanks for the assistance!


Solution

  • You might want to look at Emma instead, it allows you to instrument in advance.

    http://emma.sourceforge.net/

    When using Cobertura, do you get a .ser file at all?

    I assume that you can't tweak the code to force an export, as shown at the bottom of this FAQ?

    http://cobertura.sourceforge.net/faq.html