我正在尝试设置运行Jacoco代理(http://mvnrepository.com/artifact/org.jacoco/org.jacoco.agent/0.7.6.201602180812),我收到如下例外情况。
java.lang.instrument.IllegalClassFormatException: Error while instrumenting class ...
at org.jacoco.agent.rt.internal_14f7ee5.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:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3114)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1342)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1823)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1703)
at org.apache.catalina.util.Introspection.loadClass(Introspection.java:143)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:132)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:415)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:892)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:386)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5405)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Error while instrumenting class org/apache/jsp/isml2jsp/cartridges/app_005fbusiness_005fmanager/default_/product/batch/AttributeValue_002d37d0cd03a157eeffaecd90c11598827569e0327d_jsp.
at org.jacoco.agent.rt.internal_14f7ee5.core.instr.Instrumenter.instrumentError(Instrumenter.java:152)
at org.jacoco.agent.rt.internal_14f7ee5.core.instr.Instrumenter.instrument(Instrumenter.java:103)
at org.jacoco.agent.rt.internal_14f7ee5.CoverageTransformer.transform(CoverageTransformer.java:91)
... 25 more
Caused by: java.lang.RuntimeException: Method code too large!
at org.jacoco.agent.rt.internal_14f7ee5.asm.MethodWriter.getSize(MethodWriter.java:2036)
at org.jacoco.agent.rt.internal_14f7ee5.asm.ClassWriter.toByteArray(ClassWriter.java:827)
at org.jacoco.agent.rt.internal_14f7ee5.core.instr.Instrumenter.instrument(Instrumenter.java:84)
at org.jacoco.agent.rt.internal_14f7ee5.core.instr.Instrumenter.instrument(Instrumenter.java:101)
... 26 more
运行Jacoco代理的Java选项设置为:
JAVA_OPTS=$JAVA_OPTS\ -javaagent:/myserver/tomcat/lib/jacocoagent.jar=destfile=/tmp/jacoco.exec
我没有使用Maven或Ant文件来运行它,并且直接在Tomcat启动脚本中设置运行代理的选项。有人可以帮忙吗?