1 Reply Latest reply on Nov 4, 2016 1:20 PM by teacurran

    Jacoco extension + Jacoco Agent throws lots of exceptions

    teacurran

      I have several projects in my organization that have a mix of unit tests.

      Half of them use Arquillian, half use Mockito/CDIUnit.

       

      In order to get complete code coverage, we have to run the Jacoco Maven Agent and the Arquillian Jacoco Exception.

       

      It works fine but when we run both, both try to instrument all classes and the Arquillian tests will throw thousands of exceptions:

      java.lang.instrument.IllegalClassFormatException: Error while instrumenting class com/google/common/collect/AbstractIndexedListIterator.
      at org.jacoco.agent.rt.internal_6da5971.CoverageTransformer.transform(CoverageTransformer.java:93)
      at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
      at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
      at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:361)
      at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:482)
      at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:277)
      at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:92)
      

       

      My question is, is there any way to include both the maven listener and the Arquillian Jacoco Exension?  Can we configure the Arquillian extension so it doesn't try to re-instrument the classes, or at least doesn't print the stack trace?

       

      I am anticipating someone will say to not mix Arquillian and Mockito, but if that is the only answer, my teams are going to vote to ditch Arquillian.

       

      You can see a small project that is configured with both types of tests included here:

      GitHub - teacurran/alwaysawake-server

       

      And to see an example of the stack traces thrown during build, you can see that here:

      teacurran-alwaysawake-server.master.ci #8 Console [Jenkins]

       

      Anyone have any ideas?  Thanks in advance.