Java 7 JVM VerifyError in Eclipse
Asked Answered
C

4

33

When I compile my project in eclipse indigo using JDK 7, I get the following error dialog

enter image description here

with the following stacktrace

Exception in thread "main" java.lang.VerifyError: Expecting a stackmap frame at branch target 32 in method ... at offset 0
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.getMethod0(Unknown Source)
    at java.lang.Class.getMethod(Unknown Source)
    at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
    at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

I've found a relevant bug here and used the suggested workaround of using jvm option -XX:-UseSplitVerifier and although it works, this bug still confuses me.

Does anyone know why this is happening and why the workaround...works?

--Note--

The project compiles fine using JDK 6.

Cherice answered 1/11, 2011 at 17:54 Comment(0)
N
27

Bug 353467 speaks about "using -XX:-UseSplitVerifier to activate the old verifier".
That is consistent with the JDK TM 6 Adoption Guide which describes that option as:

Traditional verifier can be forced with the -XX:-UseSplitVerifier flag.

Missing or incorrect StackMapTable attributes for version 50.0 class files can result in VerifyError exceptions.
Tools that rewrite bytecode in version 50.0 class files and do not correctly update the StackMapTable may fail to verify and trigger exceptions.

So the comment from 2011-10-03 does point out that:

AspectJ now auto activates the previously optional setting to create stackmaps if the classes are Java7.

Nihon answered 1/11, 2011 at 18:13 Comment(5)
"believed fixed. AspectJ now auto activates the previously optional setting to create stackmaps if the classes are Java7. Please reopen if still an issue."...so I guess this is still an issue then?Cherice
@mre: in the current releases of Eclipse, it is possibly still an issue. But it should be fixed in the current 3.8M3/4.2M3 release.Nihon
I can't verify that the build fixes the problem because there's no AspectJ Development Tool available for Eclipse 3.8..:/Cherice
@Cherice surely you can add AspectJ as a plugin through one of the update site listed in eclipse.org/ajdt/downloads?Nihon
@mre: true so that would mean testing the latest AJDT with an Eclipse 3.7 (which might be already included in your Eclipse Indigo)Nihon
P
1

When I had this problem, I fixed it by deleting my JDK 1.7 system libraries from the project, and added the 1.6 JDK libraries instead. I went to run the project again, and I didn't get the error. When I added the JDK 1.7 libraries in again, it still works, so something in the 'swapping' makes it work.

Primm answered 15/5, 2012 at 14:56 Comment(1)
The same happened with me! It is a workaround to the problem!Spitter
V
0

I hit this problem in Juno, but resolved it by installing the latest 4.2 version from the 4.2 update site here:

http://www.eclipse.org/ajdt/downloads/

That's the same one @VonC gave a year ago -- but since the updated AspectJ is there now (but not in the latest Juno repository nor with what is shipped with Spring), it now constitutes an answer.

But credit to @VonC.

Note that this should work for 3.8 as well as 4.2.

Vitebsk answered 23/10, 2012 at 0:46 Comment(0)
U
0

currently, my environments is jdk 1.7(j2sdk 1.7 update 21) with eclipse 4.2 juno (SR2) I had same problem, so I had fixed it which configured VM arguments Option '-XX:-UseSplitVerifier' but it has ocurred big trouble when I will deploy product based on google-app-engine.

finally I changed java 6 (update 43)

Unyoke answered 30/4, 2013 at 10:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.