我使用jdk 1.7,jekins,maven,当我构建项目时,单元测试失败,错误是:
java.lang.VerifyError:期望分支目标73处的堆栈图帧 例外细节:位置: COM / DataDictDao.save(LCOM / DataDict;)Ljava /郎/龙; @ 25:ldc原因: 此位置的预期堆栈图帧。字节码: 0000000:033d 11ff ff3e 1212 1100 25b8 0018 2ab4 0000010:0022 122d b900 3302 0012 1211 0027 b800 0000020:182a b400 352b b900 3a02 0012 1211 0028 0000030:b800 182a b400 2212 3cb9 0033 0200 1212 0000040:1100 2cb8 0018 a700 2d12 1211 0029 b800 0000050:183a 0412 1211 002a b800 182a b400 2212 0000060:3e19 04b9 0042 0300 1212 1100 2bb8 0018 0000070:1904 bf12 1211 002d b800 182b b600 48b8 0000080:004e b0异常处理程序表: bci [25,62] =>处理程序:73 Stackmap表: same_locals_1_stack_item_extended(@ 81,对象[#43]) same_frame(@ 123)
at java.lang.Class.getDeclaredConstructors0(Native Method)at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)at at java.lang.Class.getDeclaredConstructors(Class.java:1901)at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:231) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1002) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:975) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487) 在 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) 在 org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:296) 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) 在 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293) 在 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628) 在 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) 在 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) 在 org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:120) 在 org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60) 在 org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:100) 在 org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:248) 在 org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContextInternal(CacheAwareContextLoaderDelegate.java:64) 在 org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:91) 在 org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:122) 在 org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:105) 在 org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:74) 在 org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:312) 在 org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)at org.springframework.test.context.junit4.SpringJUnit4ClassRunner $ 1.runReflectiveCall(SpringJUnit4ClassRunner.java:288) 在 org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) 在 org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:284) 在 org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) 在 org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88) 在org.junit.runners.ParentRunner $ 3.run(ParentRunner.java:238)at org.junit.runners.ParentRunner $ 1.schedule(ParentRunner.java:63)at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)at at org.junit.runners.ParentRunner.access $ 000(ParentRunner.java:53)at at org.junit.runners.ParentRunner $ 2.evaluate(ParentRunner.java:229)at at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) 在 org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71) 在org.junit.runners.ParentRunner.run(ParentRunner.java:309)at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174) 在 org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252) 在 org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141) 在 org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:606)at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) 在 org.apache.maven.surefire.booter.ProviderFactory $ ProviderProxy.invoke(ProviderFactory.java:165) 在 org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) 在 org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) 在 org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
我尝试-noverify和-XX:-UseSplitVerifier在maven MAVEN_OPTS中,既没有工作,有人可以告诉我为什么会出现这个错误,如何解决?
答案 0 :(得分:9)
我有同样的问题。解决方案是将-XX:-UseSplitVerifier
添加到surefire插件配置中:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine> -XX:-UseSplitVerifier</argLine>
</configuration>
</plugin>
(省略了我的插件配置的无关详细信息。)
我使用的是JDK 1.7和maven 3.2.3。
对于JDK 1.8,请使用:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine> -noverify </argLine>
</configuration>
</plugin>
答案 1 :(得分:1)
如果您正在使用java 1.8,请执行以下操作 1. Windows - &gt;偏好 - &gt;已安装JRE。 2.选择jdk / jre并选择编辑。 3.在默认的VM参数中,给出&#34; -noverify&#34; 。