jacoco gives ClassNotFoundException for jsp classes- at org.jacoco.asm.ClassWriter.getCommonSuperCla

450 views
Skip to first unread message

jay...@gmail.com

unread,
Dec 24, 2013, 9:23:22 AM12/24/13
to jac...@googlegroups.com
(from http://stackoverflow.com/questions/20741868/jacoco-gives-classnotfoundexception-for-jsp-classes-at-org-jacoco-asm-classwrit)


I am using offline instrumentation feature of jacoco[Some of the tests involve jmockit, I could not make the on-the-fly-instrumentation work]. I am using latest jacoco to instrument a war. This gets ClassNotFoundException from some class (pre-compiled from jsp)

<jacoco:instrument destdir="instrumentedwar">
<fileset dir="wartemp" includes="**/*.war" />
</jacoco:instrument>

Exception:

Caused by: java.io.IOException: Error while instrumenting class reporter.war@WEB-INF/classes/com/reports/
report_jsp.class.
at org.jacoco.core.instr.Instrumenter.instrumentError(Instrumenter.java:147)
at org.jacoco.core.instr.Instrumenter.instrument(Instrumenter.java:141)
at org.jacoco.core.instr.Instrumenter.instrumentAll(Instrumenter.java:174)
at org.jacoco.core.instr.Instrumenter.instrumentZip(Instrumenter.java:196)
at org.jacoco.core.instr.Instrumenter.instrumentAll(Instrumenter.java:177)
at org.jacoco.ant.InstrumentTask.instrument(InstrumentTask.java:91)
... 17 more
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: javax.servlet.jsp.tagext.BodyContent
at org.jacoco.asm.ClassWriter.getCommonSuperClass(Unknown Source)
at org.jacoco.asm.ClassWriter.a(Unknown Source)
at org.jacoco.asm.Frame.a(Unknown Source)
at org.jacoco.asm.Frame.a(Unknown Source)
at org.jacoco.asm.MethodWriter.visitMaxs(Unknown Source)
at org.jacoco.asm.ClassReader.a(Unknown Source)
at org.jacoco.asm.ClassReader.b(Unknown Source)
at org.jacoco.asm.ClassReader.accept(Unknown Source)
at org.jacoco.asm.ClassReader.accept(Unknown Source)
at org.jacoco.asm.ClassWriter.toByteArray(Unknown Source)
at org.jacoco.core.instr.Instrumenter.instrument(Instrumenter.java:79)
at org.jacoco.core.instr.Instrumenter.instrument(Instrumenter.java:139)

The missing class is exist in javax.servlet.jsp-2.2.0.v201112011158.jar (jetty8). It looks like instrumentation looks for parent class;how do I pass it to jacoco:instrument?

(Jacoco Version 0.6.3)
Thanks,
Jayan

Marc R. Hoffmann

unread,
Dec 24, 2013, 9:41:15 AM12/24/13
to jac...@googlegroups.com
This is strange, JaCoCo should never call
ClassWriter.getCommonSuperClass(). Can you please provide the fully
qualified version of the JaCoCo copy you're using?

Cheers,
-marc

Jayan M N

unread,
Dec 25, 2013, 12:12:13 AM12/25/13
to jac...@googlegroups.com
Information on version.

File names
$ls -1 *
jacocoagent.jar
jacocoant.jar
org.jacoco.agent-0.6.3.201306030806-sources.jar
org.jacoco.agent-0.6.3.201306030806.jar
org.jacoco.ant-0.6.3.201306030806-sources.jar
org.jacoco.ant-0.6.3.201306030806.jar
org.jacoco.core-0.6.3.201306030806-sources.jar
org.jacoco.core-0.6.3.201306030806.jar
org.jacoco.report-0.6.3.201306030806-sources.jar
org.jacoco.report-0.6.3.201306030806.jar
readme.txt

$ md5sum *
4f0a7ce96731cb98dd23cdb6638b5175 *jacocoagent.jar
ca7523b9029431ac65874e792f2a9e99 *jacocoant.jar
19a125f5f8cc7019d4500475672b6fd4 *org.jacoco.agent-0.6.3.201306030806-sources.jar
329d9ad61604ba7432fa0347ad9b92f1 *org.jacoco.agent-0.6.3.201306030806.jar
1b113776fedecc8b134af8fa788da6b1 *org.jacoco.ant-0.6.3.201306030806-sources.jar
ca0626a667af38472df7c72fd426c234 *org.jacoco.ant-0.6.3.201306030806.jar
452867f15e8100c1540a35d095073af9 *org.jacoco.core-0.6.3.201306030806-sources.jar
2b3cb2e313b017dda475242c167577ba *org.jacoco.core-0.6.3.201306030806.jar
932503934c599e7829bae80e1237e135 *org.jacoco.report-0.6.3.201306030806-sources.jar
0c3cf018b39303cb7160bd1c1ff855d4 *org.jacoco.report-0.6.3.201306030806.jar
9888782998cfa4af0ee8eb7d15a1a487 *readme.txt

-----------------
link: http://www.eclemma.org/jacoco/trunk/index.html
version: 0.6.3.201306030806
-----------





--
You received this message because you are subscribed to a topic in the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jacoco/b84B-SkfVIs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Marc R. Hoffmann

unread,
Dec 25, 2013, 12:05:11 PM12/25/13
to jac...@googlegroups.com
Hi Jayan,

thanks for reporting this! After some analysis it looks like you encountered a special case we haven't considered before. Please see technical details in the bug I just opened for this: https://github.com/jacoco/jacoco/issues/177

The only work around I see for you is to exclude the JAR or class from instrumentation.

Cheers,
-marc

Jayan M N

unread,
Dec 25, 2013, 12:44:14 PM12/25/13
to jac...@googlegroups.com
Marc, Many thanks for the confirmation.

I am using ant. I did try to ignore specific classes. It seems there is no way to ignore specific classes while instrumenting war? Or is there a way?



--
You received this message because you are subscribed to a topic in the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jacoco/b84B-SkfVIs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.

Marc R. Hoffmann

unread,
Dec 25, 2013, 4:08:30 PM12/25/13
to jac...@googlegroups.com
The way is is to instrument the classes (or respective libs) before you create the WAR. Alternatively you can unzip the WAR and instrument the classes/JARs and then zip again.

Sorry,
-marc

Marc R. Hoffmann

unread,
Dec 26, 2013, 12:30:05 AM12/26/13
to jac...@googlegroups.com, jay...@gmail.com
Jayan,

is there a chance that you provide the file report_jsp.class as a reproducer? You can also send a private email message to me.

Thanks,
-marc
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages