spring-guides / gs-contract-rest

Consumer Driven Contracts :: Learn how to with contract stubs and consuming that contract from another Spring application
https://spring.io/guides/gs/contract-rest
Apache License 2.0
13 stars 29 forks source link

java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter #3

Closed altfatterz closed 5 years ago

altfatterz commented 6 years ago

when running the get_person_from_service_contract test in IntelliJ I get the below exception, however the test works ok when running mvn clean install in the complete directory. Any clue why?

2018-01-28 21:16:18.743  INFO 41817 --- [           main] o.s.c.c.s.StubDownloaderBuilderProvider  : Will download stubs using Aether
2018-01-28 21:16:18.749  INFO 41817 --- [           main] o.s.c.c.stubrunner.AetherStubDownloader  : Remote repos not passed but the switch to work offline was set. Stubs will be used from your local Maven repository.
2018-01-28 21:16:19.345  INFO 41817 --- [           main] o.s.c.c.stubrunner.AetherStubDownloader  : Resolved version is [0.0.1-SNAPSHOT]
2018-01-28 21:16:19.430  INFO 41817 --- [           main] o.s.c.c.stubrunner.AetherStubDownloader  : Resolved artifact [com.example:contract-rest-service:jar:stubs:0.0.1-SNAPSHOT] to /Users/Zoltan/.m2/repository/com/example/contract-rest-service/0.0.1-SNAPSHOT/contract-rest-service-0.0.1-SNAPSHOT-stubs.jar
2018-01-28 21:16:19.446  INFO 41817 --- [           main] o.s.c.c.stubrunner.AetherStubDownloader  : Unpacking stub from JAR [URI: file:/Users/Zoltan/.m2/repository/com/example/contract-rest-service/0.0.1-SNAPSHOT/contract-rest-service-0.0.1-SNAPSHOT-stubs.jar]
2018-01-28 21:16:19.466  INFO 41817 --- [           main] o.s.c.c.stubrunner.AetherStubDownloader  : Unpacked file to [/var/folders/2l/x8rsp3m509gdtnbyt7dj_2y80000gn/T/contracts11160653675647829019]
2018-01-28 21:16:23.161  INFO 41817 --- [           main] wiremock.org.eclipse.jetty.util.log      : Logging initialized @19860ms
2018-01-28 21:16:23.604  INFO 41817 --- [           main] w.org.eclipse.jetty.server.Server        : jetty-9.2.z-SNAPSHOT
2018-01-28 21:16:23.718  INFO 41817 --- [           main] w.o.e.j.server.handler.ContextHandler    : Started w.o.e.j.s.ServletContextHandler@22846a1d{/__admin,null,AVAILABLE}
2018-01-28 21:16:23.729  INFO 41817 --- [           main] w.o.e.j.server.handler.ContextHandler    : Started w.o.e.j.s.ServletContextHandler@220cda54{/,null,AVAILABLE}
2018-01-28 21:16:23.849  INFO 41817 --- [           main] w.o.e.j.s.NetworkTrafficServerConnector  : Started NetworkTrafficServerConnector@240291d9{HTTP/1.1}{0.0.0.0:8100}
2018-01-28 21:16:23.854  INFO 41817 --- [           main] w.org.eclipse.jetty.server.Server        : Started @20560ms
2018-01-28 21:16:23.855  INFO 41817 --- [           main] o.s.c.contract.stubrunner.StubServer     : Started stub server for project [com.example:contract-rest-service:0.0.1-SNAPSHOT:stubs] on port 8100
2018-01-28 21:16:25.278  INFO 41817 --- [qtp507538622-24] /__admin                                 : RequestHandlerClass from context returned com.github.tomakehurst.wiremock.http.AdminRequestHandler. Normalized mapped under returned 'null'
2018-01-28 21:16:25.362  INFO 41817 --- [qtp507538622-24] WireMock                                 : Received request to /mappings with body {
  "id" : "a91c5a8b-f285-456a-8ed1-2062ba5a03bc",
  "request" : {
    "url" : "/ping",
    "method" : "GET"
  },
  "response" : {
    "status" : 200,
    "body" : "OK"
  },
  "uuid" : "a91c5a8b-f285-456a-8ed1-2062ba5a03bc"
}
2018-01-28 21:16:25.397  WARN 41817 --- [qtp507538622-24] w.o.e.jetty.servlet.ServletHandler       : Error for /__admin/mappings

java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
    at com.github.tomakehurst.wiremock.common.Encoding.encodeBase64(Encoding.java:29) ~[wiremock-standalone-2.11.0.jar:na]
    at com.github.tomakehurst.wiremock.servlet.WireMockHttpServletRequestAdapter.getBodyAsBase64(WireMockHttpServletRequestAdapter.java:134) ~[wiremock-standalone-2.11.0.jar:na]
    at com.github.tomakehurst.wiremock.verification.LoggedRequest.createFrom(LoggedRequest.java:58) ~[wiremock-standalone-2.11.0.jar:na]
    at com.github.tomakehurst.wiremock.http.AdminRequestHandler.handleRequest(AdminRequestHandler.java:75) ~[wiremock-standalone-2.11.0.jar:na]
    at com.github.tomakehurst.wiremock.http.AbstractRequestHandler.handle(AbstractRequestHandler.java:44) ~[wiremock-standalone-2.11.0.jar:na]
    at com.github.tomakehurst.wiremock.servlet.WireMockHandlerDispatchingServlet.service(WireMockHandlerDispatchingServlet.java:102) ~[wiremock-standalone-2.11.0.jar:na]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[tomcat-embed-core-8.5.23.jar:8.5.23]
    at wiremock.org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) ~[wiremock-standalone-2.11.0.jar:na]
    at wiremock.org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) ~[wiremock-standalone-2.11.0.jar:na]
    at wiremock.org.eclipse.jetty.servlets.CrossOriginFilter.handle(CrossOriginFilter.java:257) ~[wiremock-standalone-2.11.0.jar:na]
    at wiremock.org.eclipse.jetty.servlets.CrossOriginFilter.doFilter(CrossOriginFilter.java:220) ~[wiremock-standalone-2.11.0.jar:na]
    at wiremock.org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) ~[wiremock-standalone-2.11.0.jar:na]
    at wiremock.org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) [wiremock-standalone-2.11.0.jar:na]
    at wiremock.org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) [wiremock-standalone-2.11.0.jar:na]
    at wiremock.org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) [wiremock-standalone-2.11.0.jar:na]
    at wiremock.org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) [wiremock-standalone-2.11.0.jar:na]
    at wiremock.org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [wiremock-standalone-2.11.0.jar:na]
    at wiremock.org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110) [wiremock-standalone-2.11.0.jar:na]
    at wiremock.org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [wiremock-standalone-2.11.0.jar:na]
    at wiremock.org.eclipse.jetty.server.Server.handle(Server.java:499) [wiremock-standalone-2.11.0.jar:na]
    at wiremock.org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) [wiremock-standalone-2.11.0.jar:na]
    at wiremock.org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:258) [wiremock-standalone-2.11.0.jar:na]
    at wiremock.org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) [wiremock-standalone-2.11.0.jar:na]
    at wiremock.org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) [wiremock-standalone-2.11.0.jar:na]
    at wiremock.org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) [wiremock-standalone-2.11.0.jar:na]
    at java.base/java.lang.Thread.run(Thread.java:844) [na:na]
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582) ~[na:na]
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185) ~[na:na]
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496) ~[na:na]
    ... 26 common frames omitted

com.github.tomakehurst.wiremock.client.VerificationException: Expected status 2xx for http://localhost:8100/__admin/mappings but was 500

    at com.github.tomakehurst.wiremock.client.HttpAdminClient.safelyExecuteRequest(HttpAdminClient.java:421)
    at com.github.tomakehurst.wiremock.client.HttpAdminClient.executeRequest(HttpAdminClient.java:399)
    at com.github.tomakehurst.wiremock.client.HttpAdminClient.addStubMapping(HttpAdminClient.java:133)
    at com.github.tomakehurst.wiremock.client.WireMock.register(WireMock.java:292)
    at com.github.tomakehurst.wiremock.client.WireMock.register(WireMock.java:287)
    at org.springframework.cloud.contract.stubrunner.provider.wiremock.WireMockHttpServerStub.registerHealthCheck(WireMockHttpServerStub.java:193)
    at org.springframework.cloud.contract.stubrunner.provider.wiremock.WireMockHttpServerStub.registerHealthCheck(WireMockHttpServerStub.java:189)
    at org.springframework.cloud.contract.stubrunner.provider.wiremock.WireMockHttpServerStub.registerDefaultHealthChecks(WireMockHttpServerStub.java:168)
    at org.springframework.cloud.contract.stubrunner.provider.wiremock.WireMockHttpServerStub.registerStubMappings(WireMockHttpServerStub.java:163)
    at org.springframework.cloud.contract.stubrunner.provider.wiremock.WireMockHttpServerStub.registerMappings(WireMockHttpServerStub.java:130)
    at org.springframework.cloud.contract.stubrunner.StubServer.stubServer(StubServer.java:58)
    at org.springframework.cloud.contract.stubrunner.StubServer.start(StubServer.java:52)
    at org.springframework.cloud.contract.stubrunner.StubRunnerExecutor.startStubServers(StubRunnerExecutor.java:253)
    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:68)
    at org.springframework.cloud.contract.stubrunner.junit.StubRunnerRule$1.evaluate(StubRunnerRule.java:61)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94)
    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.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191)
    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)
dsyer commented 6 years ago

Java 9?