Xiaoxi Zheng, thank you for providing class files.
Marc, FYI
new URLClassLoader(new URL[]{dir.toURL()})
.loadClass("weblogic.ejb.container.manager.BaseEntityManager")
.getDeclaredMethods();
triggers java.lang.VerifyError for instrumented classes,
and for original - java.lang.NoClassDefFoundError:
javax/transaction/Transaction
still some classes are missing, but I suppose that NoClassDefFoundError
happens after the place where VerifyError happens.
And indeed further analysis will require time as method is huge and complex.
On Thursday, July 27, 2017 at 6:05:54 PM UTC+2, Marc R. Hoffmann wrote:
>
> FYI, here are the decompiled versions of the original and instrumented
> class files:
>
> https://gist.github.com/marchof/c5ba614ea03015f304517bbb3d72d7c7
>
> Method in question is quite complex, needs further analysis.
>
> Regards,
> -marc
>
>
>
> On 2017-07-25 13:37, xiaoxi zheng wrote:
>
> Many thanks for quick response,
> Yes, the provided class has already been instrumented by other tool(not
> through agent, it was instrumented offline), but the instrumented class is
> good (perhaps not perfectly) since I am able to verify it with java
> $className;$CLASSPATH and it is working well during testing without jacoco
> agent.
> I understood that Jacoco should be the first agent, but unfortunately, but
> that instrumentation is part of its product building, so we will have to
> use instrumented class + jacocoagent to run test and also with the
> instrumented classes to generate coverage report.
> I used the classdumpdir option to dump the dependencies classes and
> attached it.
> Actually there are a number of classes are instrumented by the tool, but
> only one class has problem, so yes, I am currently excluding this offending
> class in the test.
>
> Here is Java version
> java version "1.8.0_131"
> Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
> Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
>
> 在 2017年7月24日星期一 UTC+8下午10:10:21,Evgeny Mandrikov写道:
>>
>> Hi,
>>
>> I assume that provided class file is after instrumentation by another
>> agent, but before instrumentation by JaCoCo. Is it correct?
>>
>> If this is the case, then maybe first agent made a damage. This is the
>> most common cause of such errors and as of today we are not aware of
>> examples where JaCoCo produces invalid class files from valid inputs. And
>> if class file was damaged, then strange to expect that JaCoCo can recover
>> it. Because of this and to avoid other problems - our general
>> recommendation: JaCoCo agent should be applied first, i.e. should be listed
>> in command-line prior to other agents. Could you please try this and report
>> the result back?
>>
>> Also provided class file has dependencies on other classes, and as far as
>> I know there is no easy way to verify correctness of its bytecode or its
>> instrumented version in absence of class files of its dependencies. However
>> JaCoCo agent has parameter "classdumpdir" (see
>> http://www.jacoco.org/jacoco/trunk/doc/agent.html) that allows to dump
>> all classes prior to instrumentation. So will be beneficial if you will use
>> this parameter and provide us all dumped classes, in order to be able to
>> verify correctness of initial class and correctness of JaCoCo
>> instrumentation. Or even better if you can somehow provide small, complete
>> and isolated example demonstrating the same problem. In any case please
>> also specify exact version of Java VM that you use.
>>
>> As a last resort there are agent parameters "includes" and "excludes"
>> that can be used to exclude problematic class from JaCoCo instrumentation.
>>
>>
>> Regards,
>> Evgeny
>>
>>
>> On Sunday, July 23, 2017 at 6:30:10 PM UTC+2, xiaoxi zheng wrote:
>>>
>>> Hi,
>>> I got VerifyError below when running application with JaCoCo(tried both
>>> on 0.7.2 and 0.7.9) instrumented class BaseEntityManager (attached).
>>> Please note the class has already been instrumented by other bytecode
>>> tool, but it is good without -javaagent:jacocoagent.jar. The full error is
>>> also attached.
>>>
>>> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>> java.lang.VerifyError: Stack map does not match the one at exception
>>> handler 917
>>> Exception Details:
>>> Location:
>>>
>>> weblogic/ejb/container/manager/BaseEntityManager.executeUpdateStmt(Ljava/util/List;Ljavax/transaction/Transaction;Ljava/util/Set;ZZLjava/util/Collection;)V
>>>
>>> @917: astore
>>> Reason:
>>> Type 'java/lang/Object' (current frame, locals[20]) is not
>>> assignable to null (stack map, locals[20])
>>> Current Frame:
>>> bci: @893
>>> flags: { }
>>> locals: { 'weblogic/ejb/container/manager/BaseEntityManager',
>>> 'java/util/List', 'javax/transaction/Transaction', 'java/util/Set',
>>> integer, integer, 'java/util/Collection', '[Z', integer,
>>> 'java/sql/Connection', null, 'java/util/Map',
>>> 'weblogic/ejb/container/persistence/spi/CMPBean', integer, integer, '[Z',
>>> integer, null, integer, integer, 'java/lang/Object', top, top, top, top,
>>> top, top, top, top, top, top, top, top,
>>> 'weblogic/diagnostics/instrumentation/LocalHolder' }
>>> stack: { 'java/sql/SQLException' }
>>> Stackmap Frame:
>>> bci: @917
>>> flags: { }
>>> locals: { 'weblogic/ejb/container/manager/BaseEntityManager',
>>> 'java/util/List', 'javax/transaction/Transaction', 'java/util/Set',
>>> integer, integer, 'java/util/Collection', '[Z', integer,
>>> 'java/sql/Connection', null, 'java/util/Map',
>>> 'weblogic/ejb/container/persistence/spi/CMPBean', integer, integer, '[Z',
>>> integer, null, integer, integer, null, top, top, top, top, top, top, top,
>>> top, top, top, top, top, 'weblogic/diagnostics/instrumentation/LocalHolder'
>>> }
>>> stack: { 'java/sql/SQLException' }
>>>
>>
> --
> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jacoco/3b48a707-3c99-4a2e-a798-48f28e1fb6b5%40googlegroups.com
>
> <https://groups.google.com/d/msgid/jacoco/3b48a707-3c99-4a2e-a798-48f28e1fb6b5%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jacoco/ed7e4bf4-32ef-4498-80bf-934d897d6245%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.