9

I’m using Maven 3.2.3 with this version of Java

davea$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home

When I run

mvn clean install

I get errors like the below in my integration tests …

testFindSampleUsersByCodeAscByDefault(org.mainco.subco.user.service.SampleUserService2IT)  Time elapsed: 2.204 sec  <<< ERROR!
java.lang.VerifyError: Expecting a stackmap frame at branch target 57
Exception Details:
  Location:
    org/mainco/subco/user/service/SampleUserServiceImpl$ValueComparator.compare(Lorg/mainco/subco/user/domain/User;Lorg/mainco/subco/user/domain/User;)I @10: ifnull
  Reason:
    Expected stackmap frame at this location.
  Bytecode:
    0x0000000: 2ab4 001b 2bb9 002e 0200 c600 2f2a b400
    0x0000010: 1b2b b900 2e02 00c0 0030 b600 34c6 001c
    0x0000020: 2ab4 001b 2bb9 002e 0200 c000 30b6 0034
    0x0000030: b600 39b6 003e a700 0512 404e 2ab4 001b
    0x0000040: 2cb9 002e 0200 c600 2f2a b400 1b2c b900
    0x0000050: 2e02 00c0 0030 b600 34c6 001c 2ab4 001b
    0x0000060: 2cb9 002e 0200 c000 30b6 0034 b600 39b6
    0x0000070: 003e a700 0512 403a 042d 1904 b600 4436
    0x0000080: 0515 0599 0016 2d19 04b6 0044 2d19 04b6
    0x0000090: 0044 b800 4a6c a700 0403 3606 1506 2ab4
    0x00000a0: 0023 9900 0702 a700 0404 a000 0502 ac04
    0x00000b0: ac                                     

    at org.mainco.subco.user.service.SampleUserServiceImpl.findSampleUsers(SampleUserServiceImpl.java:439)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at com.sun.proxy.$Proxy98.findSampleUsers(Unknown Source)
    at org.mainco.subco.user.service.SampleUserService2IT.testFindSampleUsersByCodeAscByDefault(SampleUserService2IT.java:215)

Here is how my compiler plugin is configured …

            <profile>
                    <id>jdk-8</id>
                    <activation>
                            <jdk>1.8</jdk>
                    </activation>
                    <build>
                            <plugins>
                                    <plugin>
                                            <groupId>org.apache.maven.plugins</groupId>
                                            <artifactId>maven-compiler-plugin</artifactId>
                                            <version>3.1</version>
                                            <configuration>
                                                    <source>1.8</source>
                                                    <target>1.8</target>
                                                    <compilerArgument>-proc:none</compilerArgument>
                                                    <fork>true</fork>
                                            </configuration>
                                            <executions>
                                                    <execution>
                                                            <id>default-testCompile</id>
                                                            <phase>test-compile</phase>
                                                            <goals>
                                                                    <goal>testCompile</goal>
                                                            </goals>
                                                    </execution>
                                            </executions>
                                    </plugin>
                            </plugins>
                    </build>
            </profile>

and here is how my failsafe is configured

                    <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-failsafe-plugin</artifactId>
                            <version>2.18.1</version>
                            <configuration>
                                    <reuseForks>true</reuseForks>
                                    <argLine>-Xmx4096m -XX:MaxPermSize=512M -XX:-UseSplitVerifier ${itCoverageAgent}</argLine>
                                    <skipTests>${skipAllTests}</skipTests>
                            </configuration>
                            <executions>
                                    <execution>
                                            <goals>
                                                    <goal>integration-test</goal>
                                                    <goal>verify</goal>
                                            </goals>
                                    </execution>
                            </executions>
                    </plugin>

Any ideas how to prevent these bizarre “Expecting a stackmap frame at branch target” errors I’m seeing?

Edit:

I'm using these dependnecies (as speculated by the comments that these were problems):

[INFO] +- org.springframework:spring-aop:jar:3.2.11.RELEASE:compile
...
[INFO] +- org.aspectj:aspectjweaver:jar:1.8.6:compile
[INFO] +- org.aspectj:aspectjrt:jar:1.8.6:compile
7
  • 1
    Maven has nothing to do with you problem. There is a bytecode processing tool in your environment which is incompatible with recent bytecode features, whereas “recent” means “several years old”, but before Java 8, the -XX:-UseSplitVerifier option, you are using, helped ignoring these problems. First suspects are the AOP framework and the coverage agent. First attempt should be to update everything. Commented Jul 22, 2015 at 17:01
  • I removed the ${itCoverageAGent} option (didn't change anything) and am using Spring AOP 3.2.11.RELEASE and aspectj-weaver 1.8.6 (latest). It is not an option to update Spring AOP. Are you sayihng taht this version of Spring AOP is incompatible with Java 8? Commented Jul 22, 2015 at 18:37
  • I don’t know these libraries in detail. All I said, was that one of them must be the cause. A quick search revealed stackoverflow.com/a/27556298/2711488; maybe that helps. Commented Jul 22, 2015 at 18:42
  • I'm having trouble believing this is the cause. When I run an individual test file, like "mvn clean test -Dtest=UserServiceIT", everything passes without errors. Only when running "mvn clean install" when all the tests get run together do I see these VerifyErrors pop up. Commented Jul 22, 2015 at 18:54
  • Well, in order to reproduce it, the code must contain methods which AOP tries to instrument, and StackMapFrames which this process can trash. This requires a sufficiently complex code, e.g. code without branches doesn’t have a StackMapTable attribute, thus no frames to trash. But if you have another bytecode manipulating library in your environment, which you suspect, you may check that. I did not claim to know for sure, who’s responsible, I’m only telling, what that error is about… Commented Jul 22, 2015 at 19:07

2 Answers 2

11

I had this same problem when I moved to JDK 8. Code built fine, just got these errors when running the unit tests. I see you are using -XX:-UseSplitVerifier, which didn't work for me either. I had found a short blurb somewhere that instead of using -XX:-UseSplitVerifier with JDK 8, I should use -noverify. I gave it a try and it worked for me.

Hope this helps.

Sign up to request clarification or add additional context in comments.

1 Comment

where did you set -noverify? I set it as MAVEN_OPTS but its not working for me
2

before java8, you can add arg item of -XX:-UseSplitVerifier while starting jvm to solve such issue;

UseSplitVerifier arg item was removed by java8, but you can also use -noverify for replacement

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.