Jacoco Report generation from jacoco.exec

943 views
Skip to first unread message

Sabyasachi Mishra

unread,
Jan 11, 2018, 6:59:32 AM1/11/18
to JaCoCo and EclEmma Users
Hello team,

I am trying to compute code coverage for a build hosted in tomcat. I have attached Jacoco agent to tomcat using Java agent. Now I am able to get Jacoco.exec file and class dumps. Currently I don't have access to source code files.
As  per as my understanding we can do the analysis only by using *.class files and Jacoco.exec files. I have tried the below options but still not able to generate the html report.

java -jar /opt/jacoco/lib/jacococli.jar report /opt/jacoco/Result/jacoco.exec --classfiles /opt/jacoco/Result/classes --html /opt/jacoco/Result/jacoco-report --name jackRpt - This is thrrowing me an exception

I have also tried import the jacoco.exec file and analysed against the class dump files. But I am getting error code of 5001. 

Can anyone please tell me what I am missing or what I am doing wrong.

Thanks in advance.

Regards,
Sabyasachi Mishra 

Marc Hoffmann

unread,
Jan 11, 2018, 7:04:58 AM1/11/18
to jac...@googlegroups.com

Can you please provide the full exception stack trace thrown from the command line tool?

Regards,
-marc

--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/e33d2823-d507-4d6a-9240-ad247e7b4b2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

Sabyasachi Mishra

unread,
Jan 11, 2018, 7:11:43 AM1/11/18
to JaCoCo and EclEmma Users
Below is the exception I am getting

[INFO] Loading execution data file /opt/jacoco/Result/jacoco.exec.
Exception in thread "main" java.io.IOException: Error while analyzing /opt/jacoco/Result/classes/com/fasterxml/jackson/annotation/JsonFormat$Shape.4e5c4d9a972b70b0.class.
       at org.jacoco.cli.internal.core.analysis.Analyzer.analyzerError(Analyzer.java:157)
       at org.jacoco.cli.internal.core.analysis.Analyzer.analyzeClass(Analyzer.java:129)
       at org.jacoco.cli.internal.core.analysis.Analyzer.analyzeClass(Analyzer.java:152)
       at org.jacoco.cli.internal.core.analysis.Analyzer.analyzeAll(Analyzer.java:188)
       at org.jacoco.cli.internal.core.analysis.Analyzer.analyzeAll(Analyzer.java:221)
       at org.jacoco.cli.internal.core.analysis.Analyzer.analyzeAll(Analyzer.java:216)
       at org.jacoco.cli.internal.core.analysis.Analyzer.analyzeAll(Analyzer.java:216)
       at org.jacoco.cli.internal.core.analysis.Analyzer.analyzeAll(Analyzer.java:216)
       at org.jacoco.cli.internal.core.analysis.Analyzer.analyzeAll(Analyzer.java:216)
       at org.jacoco.cli.internal.core.analysis.Analyzer.analyzeAll(Analyzer.java:216)
       at org.jacoco.cli.internal.commands.Report.analyze(Report.java:109)
       at org.jacoco.cli.internal.commands.Report.execute(Report.java:83)
       at org.jacoco.cli.internal.Main.execute(Main.java:89)
       at org.jacoco.cli.internal.Main.main(Main.java:104)
Caused by: java.lang.IllegalStateException: Can't add different class with same name: com/fasterxml/jackson/annotation/JsonFormat$Shape
       at org.jacoco.cli.internal.core.analysis.CoverageBuilder.visitCoverage(CoverageBuilder.java:107)
       at org.jacoco.cli.internal.core.analysis.Analyzer$1.visitEnd(Analyzer.java:96)
       at org.jacoco.cli.internal.asm.ClassVisitor.visitEnd(ClassVisitor.java:339)
       at org.jacoco.cli.internal.core.internal.flow.ClassProbesAdapter.visitEnd(ClassProbesAdapter.java:98)
       at org.jacoco.cli.internal.asm.ClassReader.accept(ClassReader.java:702)
       at org.jacoco.cli.internal.asm.ClassReader.accept(ClassReader.java:500)
       at org.jacoco.cli.internal.core.analysis.Analyzer.analyzeClass(Analyzer.java:111)
       at org.jacoco.cli.internal.core.analysis.Analyzer.analyzeClass(Analyzer.java:127)
       ... 12 more

Marc Hoffmann

unread,
Jan 11, 2018, 4:11:49 PM1/11/18
to jac...@googlegroups.com

The exception message says: "Can't add different class with same name: com/fasterxml/jackson/annotation/JsonFormat$Shape"

Please see FAQ: http://www.jacoco.org/jacoco/trunk/doc/faq.html

Why do I get the error "Can't add different class with same name"?

For coverage report generation all classes within a group must have unique names. You get this error during report generation if JaCoCo is supplied with multiple different class files with the same name. To fix this remove those duplicate classes or create separate reports or report groups for each version.

Note that it is not possible to create groups with the command line tool. You need to decide which version of the class you want to create a coverage report for.

Regards,
-marc

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