Java.lang.VerifyError的JUnit错误: Jenkins上的局部变量类型不正确

Java.lang.VerifyError的JUnit错误: Jenkins上的局部变量类型不正确

我正在用Junit和maven项目测试这个功能。

下面是我正在测试的函数

public boolean isJSONValid3(String jsonInString) { final Gson gson = new Gson(); try { gson.fromJson(jsonInString, Object.class); return true; } catch(JsonSyntaxException ex) { return false; } }

以及Jenkins上的错误追踪

junit.framework.AssertionFailedError: Exception in constructor: testIsJSONValid3 (java.lang.VerifyError: Bad local variable typeException Details: Location: com/egroup/util/AttributeCheck.objectNotNull([Ljava/lang/Object;)Z @29: iload Reason: Type top (current frame, locals[5]) is not assignable to integer Current Frame: bci: @29 flags: { } locals: { ‘com/egroup/util/AttributeCheck’, ‘[Ljava/lang/Object;’, integer, integer } stack: { } Bytecode: 0x0000000: 033d 11ff ff3e 120b 1100 26b8 0011 2bbe 0x0000010: 3604 120b 1100 27b8 0011 0336 0515 0515 0x0000020: 0411 0027 3d11 0000 3ea2 0076 1c11 0027 0x0000030: a000 161d 1100 00a0 000f 120b 1c1d 04b8 0x0000040: 0031 11ff ff3e 120b 1100 28b8 0011 2b15 0x0000050: 0532 1100 283d 1100 003e c700 271c 1100 0x0000060: 28a0 0016 1d11 0000 a000 0f12 0b1c 1d04 0x0000070: b800 3111 ffff 3e12 0b11 0029 b800 1103 0x0000080: ac1d 9b00 0f12 0b1c 1d03 b800 3111 ffff 0x0000090: 3e12 0b11 0027 b800 1184 0501 a7ff 811d 0x00000a0: 9b00 0f12 0b1c 1d03 b800 3111 ffff 3e12 0x00000b0: 0b11 002c b800 1104 ac Stackmap Table: append_frame(@29,Integer,Integer) same_frame_extended(@153) chop_frame(@183,1) at com.egroup.util.AttributeCheckTest.(AttributeCheckTest.java:13) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at junit.framework.TestSuite.createTest(TestSuite.java:65) at junit.framework.TestSuite.addTestMethod(TestSuite.java:307) at junit.framework.TestSuite.addTestsFromTestCase(TestSuite.java:150) at junit.framework.TestSuite.(TestSuite.java:129) at com.egroup.util.AttributeCheckTest.suite(AttributeCheckTest.java:27) 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:498) at org.junit.internal.runners.SuiteMethod.testFromSuiteMethod(SuiteMethod.java:35) at org.junit.internal.runners.SuiteMethod.(SuiteMethod.java:24) at org.junit.internal.builders.SuiteMethodBuilder.runnerForClass(SuiteMethodBuilder.java:11) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:250) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112) 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:498) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)) at junit.framework.Assert.fail(Assert.java:57) at junit.framework.TestCase.fail(TestCase.java:227) at junit.framework.TestSuite$1.runTest(TestSuite.java:97) at junit.framework.TestCase.runBare(TestCase.java:141) at junit.framework.TestResult$1.protect(TestResult.java:122) at junit.framework.TestResult.runProtected(TestResult.java:142) at junit.framework.TestResult.run(TestResult.java:125) at junit.framework.TestCase.run(TestCase.java:129) at junit.framework.TestSuite.runTest(TestSuite.java:252) at junit.framework.TestSuite.run(TestSuite.java:247) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112) 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:498) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

在eclipse ide上运行junit时可以正常工作,但是

出现以下情况时出错:

在Jenkins上运行,并发布JUnit报告和maven安装

jdk:java-1.8.0-openjdk-1.8.0.222-4

如何解决此问题!?!?

这让我恼火了好几天!


比丘资源网 » Java.lang.VerifyError的JUnit错误: Jenkins上的局部变量类型不正确

发表回复

提供最优质的资源集合

立即查看 了解详情