IllegalClassFormatException with Java 8 while instrumentation

85 views
Skip to first unread message

bharath tumma

unread,
Oct 28, 2015, 10:38:55 AM10/28/15
to JaCoCo and EclEmma Users

I am facing an error while server startup with jacoco 0.7.5 setup & jdk 1.8.51 at instrumenting class.
The exception - IllegalClassFormatException has been thrown and the root cause is - RunTimeException saying "Class FIle too Large".
Here, this is generated class through our framework. Hence, i cannot split/divide it into multiple classes.

To avoid this exception, I have used option - excludes in catalina.bat file. This resulted in no exception but generated jacoco.exec file doesn't contain projects sources related information. It is covering only tomcat server related files inforamtion. Even if i generate report by using this exec, there is 0% coverage for project sources.

So can you please assist me to get rid of class size issue. Is there any issue with jacoco against jdk 8. Thanks for help.

Marc Hoffmann

unread,
Oct 28, 2015, 12:14:07 PM10/28/15
to jac...@googlegroups.com
Hi,

JaCoCo 0.7.5 supports Java 8. There are limitations regarding the the
class file size, as JaCoCo adds additional code to trace execution at
runtime.

Regarding the other issue: If you only see Tomcat classes this is likely
that the agent is attached to the wrong JVM. As far as I know Tomcat
uses a separate JVM to launch the actual container. Please consult the
Tomcat project how to set JVM properties properly for the actual
container.

Also note that JaCoCo need a proper JVM shutdown to write-out execution
data.

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/695f05a6-655d-48db-8f0c-b6f69d9bd6ff%40googlegroups.com
> [1].
> For more options, visit https://groups.google.com/d/optout [2].
>
>
> Links:
> ------
> [1]
> https://groups.google.com/d/msgid/jacoco/695f05a6-655d-48db-8f0c-b6f69d9bd6ff%40googlegroups.com?utm_medium=email&utm_source=footer
> [2] https://groups.google.com/d/optout

bharath tumma

unread,
Oct 28, 2015, 11:50:19 PM10/28/15
to JaCoCo and EclEmma Users
  Thank you marchof.. Can we have support for  large class file size in future release of jacoco.. as i cannot split/divide problem classes into multiple classes becasue those are generated class through our framework.


bharath tumma

unread,
Oct 29, 2015, 1:47:30 AM10/29/15
to JaCoCo and EclEmma Users

  Thank you marchof.. Can we have support for  large class file size in future release of jacoco.. as i cannot split/divide problem classes into multiple classes becasue those are generated class through our framework. if we possible can you suggest me any workaround solution


Marc R. Hoffmann

unread,
Oct 29, 2015, 1:55:40 AM10/29/15
to jac...@googlegroups.com
Hi,

if Java supports larger class files one day (very unlikely) we can do too. JaCoCo is based on byte code instrumentation (i.e. adding additional instructions) and will therefore always increase class file size. The are no plans to switch to a different technique.

Regards,
-marc


On 29.10.15 04:50, bharath tumma wrote:
  Thank you marchof.. Can we have support for  large class file size in future release of jacoco.. as i cannot split/divide problem classes into multiple classes becasue those are generated class through our framework.


--
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.

Marc R. Hoffmann

unread,
Oct 29, 2015, 1:56:26 AM10/29/15
to jac...@googlegroups.com
BTW, if the class is generated anyways, what is the point of collecting code coverage for it?


On 29.10.15 04:50, bharath tumma wrote:
  Thank you marchof.. Can we have support for  large class file size in future release of jacoco.. as i cannot split/divide problem classes into multiple classes becasue those are generated class through our framework.


--
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.

bharath tumma

unread,
Oct 29, 2015, 2:15:09 AM10/29/15
to JaCoCo and EclEmma Users
I have used option - excludes in catalina.bat file like below
SET JACOCO=-javaagent:D:\share\jacoco-0.7.5.201505241946\lib\jacocoagent.jar=destfile=d:\jacoco.exec,append=true,includes=*,excludes="com/pass/project/vtong/generated/ppl/shared/bo/BoBoAirComponentBaseValueImpl:com/pass/project/vtong/generated/ppl/shared/bo/BoBoItineraryBaseValueImpl",output=file
set JAVA_OPTS=%JAVA_OPTS% %JACOCO%


 This resulted in no exception but generated jacoco.exec file doesn't contain projects sources related information. It is covering only tomcat server related files inforamtion. Even if i generate report by using this exec, there is 0% coverage for project sources.

I am doing proper JVM shutdown to collect data but i am not able to see project source files related data in jacoco.exec.

If i use options like below in catalina,bat with other small project where we don't have large class files for which excludes is not required
SET JACOCO=-javaagent:D:\share\jacoco-0.7.5.201505241946\lib\jacocoagent.jar=destfile=d:\jacoco.exec,append=true,includes=*
set JAVA_OPTS=%JAVA_OPTS% %JACOCO%
then i am able to get proper jacoco.exec with project source files related data and i am getting proper jacoco coverage report..

Could you please suggest me..

bharath tumma

unread,
Oct 29, 2015, 6:35:41 AM10/29/15
to JaCoCo and EclEmma Users
Those excluded classes are very important in our application that’s why report is not having coverage information...seems these excluded classes  are involved in the process everywhere after login….

Can you suggest me any other workaround solution.. if this is not possible can you suggest me any other tool which generate code coverage report with large class file size. suitable tool for me.. 

Marc Hoffmann

unread,
Oct 29, 2015, 8:07:18 AM10/29/15
to jac...@googlegroups.com
There are different options to implement code coverage tools, see first
section here:

http://eclemma.org/jacoco/trunk/doc/implementation.html

Instrumentation will always increase code size. I don't know of any
activetly maintained code coverage tool based on JVMTI. If I remember
correctly Eclipse TPTP (http://www.eclipse.org/tptp/) used to offer a
code coverage tool based on the experimental JVMPI -- which is not
available any more since Java 6.

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/be097ca5-1744-4535-9c30-ccf67bf65fef%40googlegroups.com
> [1].
> For more options, visit https://groups.google.com/d/optout [2].
>
>
> Links:
> ------
> [1]
> https://groups.google.com/d/msgid/jacoco/be097ca5-1744-4535-9c30-ccf67bf65fef%40googlegroups.com?utm_medium=email&utm_source=footer
> [2] https://groups.google.com/d/optout

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