spring cloud contract - 从分支内部调用Wiremock Bad <init>方法异常详细信息

时间:2018-04-30 13:17:21

标签: spring-cloud-contract

我有一个制作人: springboot - 1.5.1.RELEASE springcloudVersion =&#39; Camden.SR5&#39; 有classpath(&#34; org.springframework.cloud:spring-cloud-contract-gradle-plugin:1.0.3.RELEASE&#34;) testCompile(&#39; org.springframework.cloud:弹簧云起动合同验证人&#39)

我可以在生产者上成功运行构建,并可以看到生成的合同。

现在,

我有一个消费者 springBootVersion =&#39; 2.0.1.RELEASE&#39; springCloudVersion =&#39; Finchley.RC1&#39; 具有 testCompile(&#34; org.springframework.cloud:弹簧云起动合同存根浇道&#34) testCompile(&#34; org.springframework.cloud:弹簧云合同验证人&#34)

我有一个简单的合同测试:

@Rule
public StubRunnerRule rule = new StubRunnerRule()
        .downloadStub("groupid", "artifact")
        .stubsMode(StubRunnerProperties.StubsMode.LOCAL);

@Test
public void testValidALPEndpoint() {
    String output = runEndpointCheck("ac01");
    assertEquals("test", output);    }

@Test
public void testInvalidALPEndpoint() {
    String output = runEndpointCheck("invalid");
    assertNotEquals("invalid", output);
}

private String runEndpointCheck(String urlPath) {
    URL url = this.rule.findStubUrl("groupid", "artifact"");
    try (CloseableHttpClient httpclient = HttpClients.createDefault()) {
        HttpGet httpGet = new HttpGet(url + "/" + urlPath);
        CloseableHttpResponse response = httpclient.execute(httpGet);
        return EntityUtils.toString(response.getEntity());
    } catch (IOException e) {
        throw new RuntimeException("HTTP client failed to open", e);
    }
}

能够从本地m2 repo找到存根罐。

然后它出错了

    org/springframework/cloud/contract/verifier/dsl/wiremock/DefaultResponseTransformer.<init>(ZLjava/lang/String;Lwiremock/com/github/jknack/handlebars/Helper;)V @108: invokespecial
  Reason:
    Error exists in the bytecode
  Bytecode:
    0x0000000: b800 133a 0406 bd00 4059 031b b800 4653
    0x0000010: 5904 2c53 5905 2d53 5910 ff12 04b8 004a
    0x0000020: 2a5f ab00 0000 00a4 0000 0004 9db7 bd78
    0x0000030: 0000 002a 0013 85ff 0000 0050 15b4 0b91
    0x0000040: 0000 0060 286f b7a6 0000 0088 5f5a 5903
    0x0000050: 32b8 0050 5f59 0432 b800 56c0 0058 5f59
    0x0000060: 0532 125a b800 28c0 005a 5f57 b700 5ca7
    0x0000070: 0061 5f5a 5903 32b8 0050 5f57 b700 3ca7
    0x0000080: 0051 5f5a 5903 32b8 0050 5f59 0432 125e
    0x0000090: b800 28c0 005e 5f59 0532 1222 b800 28c0
    0x00000a0: 0022 5f57 b700 61a7 0029 5f5a 5903 32b8
    0x00000b0: 0050 5f59 0432 1222 b800 28c0 0022 5f57
    0x00000c0: b700 2ba7 000d bb00 6359 1265 b700 68bf
    0x00000d0: 572a b600 333a 0519 052a 5fb5 0035 1905
    0x00000e0: 57b1                                   
  Stackmap Table:
    full_frame(@76,{UninitializedThis,Integer,Object[#88],Object[#90],Object[#57]},{Object[#110],UninitializedThis})
    full_frame(@114,{UninitializedThis,Integer,Object[#88],Object[#90],Object[#57]},{Object[#110],UninitializedThis})
    full_frame(@130,{UninitializedThis,Integer,Object[#88],Object[#90],Object[#57]},{Object[#110],UninitializedThis})
    full_frame(@170,{UninitializedThis,Integer,Object[#88],Object[#90],Object[#57]},{Object[#110],UninitializedThis})
    full_frame(@198,{UninitializedThis,Integer,Object[#88],Object[#90],Object[#57]},{Object[#110],UninitializedThis})
    full_frame(@208,{Object[#2],Integer,Object[#88],Object[#90],Object[#57]},{Object[#110]})


    at org.springframework.cloud.contract.stubrunner.provider.wiremock.WireMockHttpServerStub.responseTransformers(WireMockHttpServerStub.java:65)
    at org.springframework.cloud.contract.stubrunner.provider.wiremock.WireMockHttpServerStub.config(WireMockHttpServerStub.java:51)
    at org.springframework.cloud.contract.stubrunner.provider.wiremock.WireMockHttpServerStub.start(WireMockHttpServerStub.java:107)
    at org.springframework.cloud.contract.stubrunner.StubServer.start(StubServer.java:51)
    at org.springframework.cloud.contract.stubrunner.StubRunnerExecutor$1.call(StubRunnerExecutor.java:260)
    at org.springframework.cloud.contract.stubrunner.StubRunnerExecutor$1.call(StubRunnerExecutor.java:256)
    at org.springframework.cloud.contract.stubrunner.AvailablePortScanner.executeLogicForAvailablePort(AvailablePortScanner.java:79)
    at org.springframework.cloud.contract.stubrunner.AvailablePortScanner.tryToExecuteWithFreePort(AvailablePortScanner.java:63)
    at org.springframework.cloud.contract.stubrunner.StubRunnerExecutor.startStubServers(StubRunnerExecutor.java:256)
    at org.springframework.cloud.contract.stubrunner.StubRunnerExecutor.runStubs(StubRunnerExecutor.java:76)
    at org.springframework.cloud.contract.stubrunner.StubRunner.runStubs(StubRunner.java:72)
    at org.springframework.cloud.contract.stubrunner.BatchStubRunner.runStubs(BatchStubRunner.java:46)
    at org.springframework.cloud.contract.stubrunner.junit.StubRunnerRule$1.before(StubRunnerRule.java:69)
    at org.springframework.cloud.contract.stubrunner.junit.StubRunnerRule$1.evaluate(StubRunnerRule.java:62)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

2 个答案:

答案 0 :(得分:0)

你正在使用一种古老的释放列车。也很可能你的依赖项不匹配。很可能是WireMock版本存在问题。最好是升级版本系列版本并再次检查。

答案 1 :(得分:0)

我认为这是一个JAVA版本问题。不得不将jvmargs -noverify添加到bootrun并测试压缩它。 现在工作正常。 将继续寻找兼容的JDK版本来解决这个问题,而不涉及-noverify