Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get unit test to run in java 7: java.lang.VerifyError: Expecting a stackmap frame at branch target

Hi I am running a maven test using maven 3.0.3 with hibernate 4.0.0 Final release and spring 3.1 on jdk7 update 2.

I get the following error.

Caused by: java.lang.VerifyError: Expecting a stackmap frame at branch target 63 in method ${myDomainClass}.equals(Ljava/lang/Object;)Z at offset 24
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
    at java.lang.Class.getDeclaredMethods(Class.java:1808)
    at org.hibernate.property.BasicPropertyAccessor.getterMethod(BasicPropertyAccessor.java:352)
    at org.hibernate.property.BasicPropertyAccessor.getGetterOrNull(BasicPropertyAccessor.java:331)
    at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:314)
    at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:310)
    at org.hibernate.internal.util.ReflectHelper.getter(ReflectHelper.java:250)
    at org.hibernate.internal.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:229)
    at org.hibernate.mapping.SimpleValue.setTypeUsingReflection(SimpleValue.java:314)
    at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:447)
    at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:380)
    at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:320)
    at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:171)
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:3377)
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXmlQueue(Configuration.java:3369)
    at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3357)
    at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1334)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1724)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1775)
    at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:184)
    at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:314)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)

My Equals method is using EqualsBuilder from commons-lang 2.6. I set the following maven opts

SET MAVEN_OPTS=%MAVEN_OPTS% -XX:-UseSplitVerifier

after reading this Java 7 JVM verifyError

Note: My test works under jdk 1.6 update 29.

How do I fix this? It seems setting -XX:-UseSplitVerifier still causes the error.

like image 886
Chun ping Wang Avatar asked Dec 26 '11 18:12

Chun ping Wang


1 Answers

According to surefire plugin documentation MAVEN_OPTS are not inherited by a spawned JVM, so you need to specify argLine config parameter with -XX:-UseSplitVerifier in maven-surefire-plugin configuration element.

like image 137
Eugene Kuleshov Avatar answered Oct 11 '22 12:10

Eugene Kuleshov