[ 
https://issues.apache.org/jira/browse/OPENJPA-2339?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13588810#comment-13588810
 ] 

Kevin Sutter commented on OPENJPA-2339:
---------------------------------------

It would seem that your JoCoCo project is doing more validation of the class 
files than normal Java 6 runtime processing.  The stackmap issues became 
apparent when customers moved to the more stringent Java 7.  If you google this 
topic, you'll find that just all bytecode manipulation utilities (asm, serp, 
etc) had issues when first running with Java 7.  Java 6 (and previous versions) 
had been more tolerant of stackmap inconsistencies.  But, that was no longer 
the case with Java 7.

So, to support Java 7, OpenJPA introduced the use of ASM to clean up our 
stackmap table entries after Serp did the initial bytecode enhancement.  But, 
we only do this extra processing when we detect a Java 7 class file.  Thus, 
Rick's suggestion of trying Java 7 is probably worthwhile.

Also, just to explain the changes in openjpa-2298...  These changes would apply 
to either Java 6 or Java 7 environments.  But, based on your stated issues, I 
doubt that this change alone would get you up and running.  You'll probably 
need the ASM post-processing cleanup of the stackmap tables.
                
> OpenJPA Ant enhancer task generates .class files with missing stackmap frame
> ----------------------------------------------------------------------------
>
>                 Key: OPENJPA-2339
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2339
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.2.0, 2.2.1
>         Environment: OpenJPA 2.2.0 & 2.2.1, JaCoCo latest from git, Java 6
>            Reporter: Dominik Stadler
>            Assignee: Kevin Sutter
>            Priority: Critical
>         Attachments: TestJaCoCoProblem.zip
>
>
> I have a project which uses JaCoCo for code-coverage testing. Some of the 
> tests load JPA Entities.
> Any JPA entities cause error messages "Missing or invalid stackmap frames." 
> in JaCoCo code, which the developers of JaCoco indicate is a problem in the 
> code enhancing the .class file before, i.e. here Open JPA Enhancer. 
> OPENJPA-2085 seems related, but it is fixed in 2.2.0, which I am using. Was 
> this only fixed for Java 7?
> I also upgraded to serp-1.14.1, which seems to have some related fixes, but 
> the problem persists.
> See https://github.com/jacoco/eclemma/issues/35 for a related discussion.
> See the attached sample project/ant-file which reproduces the problem. Simply 
> run "ant test" to trigger the error.
> A full stacktrace is 
>     [junit] Running MandantTest
>     [junit] java.lang.instrument.IllegalClassFormatException: Error while 
> instrumenting class Mandant.
>     [junit]     at 
> org.jacoco.agent.rt.internal_f6710df.CoverageTransformer.transform(CoverageTransformer.java:91)
>     [junit]     at 
> sun.instrument.TransformerManager.transform(TransformerManager.java:188)
>     [junit]     at 
> sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:385)
>     [junit]     at java.lang.ClassLoader.defineClass1(Native Method)
>     [junit]     at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
>     [junit]     at 
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
>     [junit]     at 
> java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
>     [junit]     at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
>     [junit]     at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
>     [junit]     at java.security.AccessController.doPrivileged(Native Method)
>     [junit]     at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
>     [junit]     at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
>     [junit]     at 
> sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
>     [junit]     at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
>     [junit]     at MandantTest.test(MandantTest.java:10)
>     [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     [junit]     at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>     [junit]     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>     [junit]     at java.lang.reflect.Method.invoke(Method.java:616)
>     [junit]     at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
>     [junit]     at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>     [junit]     at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
>     [junit]     at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>     [junit]     at 
> org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
>     [junit]     at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
>     [junit]     at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
>     [junit]     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
>     [junit]     at 
> org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
>     [junit]     at 
> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
>     [junit]     at 
> org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
>     [junit]     at 
> org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
>     [junit]     at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
>     [junit]     at 
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:541)
>     [junit]     at 
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1064)
>     [junit]     at 
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:923)
>     [junit] Caused by: java.lang.IllegalStateException: Missing or invalid 
> stackmap frames.
>     [junit]     at 
> org.jacoco.agent.rt.internal_f6710df.core.internal.instr.FrameTracker.assertValidFrames(FrameTracker.java:613)
>     [junit]     at 
> org.jacoco.agent.rt.internal_f6710df.core.internal.instr.FrameTracker.pop(FrameTracker.java:602)
>     [junit]     at 
> org.jacoco.agent.rt.internal_f6710df.core.internal.instr.FrameTracker.visitVarInsn(FrameTracker.java:386)
>     [junit]     at 
> org.jacoco.agent.rt.internal_f6710df.asm.MethodVisitor.visitVarInsn(Unknown 
> Source)
>     [junit]     at 
> org.jacoco.agent.rt.internal_f6710df.asm.MethodVisitor.visitVarInsn(Unknown 
> Source)
>     [junit]     at 
> org.jacoco.agent.rt.internal_f6710df.asm.tree.VarInsnNode.accept(Unknown 
> Source)
>     [junit]     at 
> org.jacoco.agent.rt.internal_f6710df.asm.tree.InsnList.accept(Unknown Source)
>     [junit]     at 
> org.jacoco.agent.rt.internal_f6710df.asm.tree.MethodNode.accept(Unknown 
> Source)
>     [junit]     at 
> org.jacoco.agent.rt.internal_f6710df.core.internal.flow.ClassProbesAdapter$1.visitEnd(ClassProbesAdapter.java:124)
>     [junit]     at 
> org.jacoco.agent.rt.internal_f6710df.asm.ClassReader.b(Unknown Source)
>     [junit]     at 
> org.jacoco.agent.rt.internal_f6710df.asm.ClassReader.accept(Unknown Source)
>     [junit]     at 
> org.jacoco.agent.rt.internal_f6710df.asm.ClassReader.accept(Unknown Source)
>     [junit]     at 
> org.jacoco.agent.rt.internal_f6710df.core.instr.Instrumenter.instrument(Instrumenter.java:74)
>     [junit]     at 
> org.jacoco.agent.rt.internal_f6710df.core.instr.Instrumenter.instrument(Instrumenter.java:87)
>     [junit]     at 
> org.jacoco.agent.rt.internal_f6710df.CoverageTransformer.transform(CoverageTransformer.java:89)
>     [junit]     ... 34 more

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to