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

On 25.12.13 18:44, Jayan M N wrote:
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?



On Wed, Dec 25, 2013 at 10:35 PM, Marc R. Hoffmann <[email protected] <mailto:[email protected]>> wrote:

    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


    On 25.12.13 06:12, Jayan M N wrote:
    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
    -----------




    On Tue, Dec 24, 2013 at 8:11 PM, Marc R. Hoffmann
    <[email protected] <mailto:[email protected]>>
    wrote:

        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

        On 24.12.13 15:23, [email protected]
        <mailto:[email protected]> wrote:

            (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


        --


--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to