Jacoco与Spring Boot应用程序集成在检测过程中出现错误

时间:2019-07-17 11:40:43

标签: spring-boot jacoco

我必须获得有关Spring Boot应用程序集成测试的内容。现在,当我尝试在Spring Boot应用程序的启动中使用javaagent时,出现了错误。另外我在JAVA_OPTS中使用了以下args

-javaagent:/tmp/jacocoagent.jar=destfile=/mnt/shared/jacoco.exec

        at org.jacoco.agent.rt.internal_035b120.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 sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:459)
        at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:336)
        at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93)
Caused by: java.io.IOException: Error while instrumenting xxx/xxx/core/config/CoreAutoConfiguration$$FastClassBySpringCGLIB$$e1df4252.
        at org.jacoco.agent.rt.internal_035b120.core.instr.Instrumenter.instrumentError(Instrumenter.java:158)
        at org.jacoco.agent.rt.internal_035b120.core.instr.Instrumenter.instrument(Instrumenter.java:108)
        at org.jacoco.agent.rt.internal_035b120.CoverageTransformer.transform(CoverageTransformer.java:91)
        ... 52 more
Caused by: java.lang.IllegalStateException: Cannot process instrumented class xxx/xxx/core/config/CoreAutoConfiguration$$FastClassBySpringCGLIB$$e1df4252. Please supply original non-instrumented classes.
        at org.jacoco.agent.rt.internal_035b120.core.internal.instr.InstrSupport.assertNotInstrumented(InstrSupport.java:237)
        at org.jacoco.agent.rt.internal_035b120.core.internal.instr.ClassInstrumenter.visitField(ClassInstrumenter.java:55)
        at org.jacoco.agent.rt.internal_035b120.asm.ClassVisitor.visitField(ClassVisitor.java:287)
        at org.jacoco.agent.rt.internal_035b120.asm.ClassReader.readField(ClassReader.java:906)
        at org.jacoco.agent.rt.internal_035b120.asm.ClassReader.accept(ClassReader.java:683)
        at org.jacoco.agent.rt.internal_035b120.asm.ClassReader.accept(ClassReader.java:400)
        at org.jacoco.agent.rt.internal_035b120.core.instr.Instrumenter.instrument(Instrumenter.java:88)
        at org.jacoco.agent.rt.internal_035b120.core.instr.Instrumenter.instrument(Instrumenter.java:106)
        ... 53 more
java.lang.instrument.IllegalClassFormatException: Error while instrumenting xxx/xxx/core/config/CoreAutoConfiguration$$EnhancerBySpringCGLIB$$e954c394$$FastClassBySpringCGLIB$$3d9ac05.
        at org.jacoco.agent.rt.internal_035b120.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 sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:459)
        at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:336)
        at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93)
Caused by: java.io.IOException: Error while instrumenting xxx/xxx/core/config/CoreAutoConfiguration$$EnhancerBySpringCGLIB$$e954c394$$FastClassBySpringCGLIB$$3d9ac05.
        at org.jacoco.agent.rt.internal_035b120.core.instr.Instrumenter.instrumentError(Instrumenter.java:158)
        at org.jacoco.agent.rt.internal_035b120.core.instr.Instrumenter.instrument(Instrumenter.java:108)
        at org.jacoco.agent.rt.internal_035b120.CoverageTransformer.transform(CoverageTransformer.java:91)
        ... 52 more
Caused by: java.lang.IllegalStateException: Cannot process instrumented class xxx/xxx/core/config/CoreAutoConfiguration$$EnhancerBySpringCGLIB$$e954c394$$FastClassBySpringCGLIB$$3d9ac05. Please supply original non-instrumented classes.
        at org.jacoco.agent.rt.internal_035b120.core.internal.instr.InstrSupport.assertNotInstrumented(InstrSupport.java:237)
        at org.jacoco.agent.rt.internal_035b120.core.internal.instr.ClassInstrumenter.visitField(ClassInstrumenter.java:55)
        at org.jacoco.agent.rt.internal_035b120.asm.ClassVisitor.visitField(ClassVisitor.java:287)
        at org.jacoco.agent.rt.internal_035b120.asm.ClassReader.readField(ClassReader.java:906)
        at org.jacoco.agent.rt.internal_035b120.asm.ClassReader.accept(ClassReader.java:683)
        at org.jacoco.agent.rt.internal_035b120.asm.ClassReader.accept(ClassReader.java:400)
        at org.jacoco.agent.rt.internal_035b120.core.instr.Instrumenter.instrument(Instrumenter.java:88)


0 个答案:

没有答案