Hi, when I am using wiremock 3.2.0 as maven depen...
# help
b
Hi, when I am using wiremock 3.2.0 as maven dependency in my spring boot app with jdk 11, I am seeing below errors. can you help. I tried excluding some dependencies but unable to get through. pasting jetty tree also below
Copy code
Caused by: java.lang.NoSuchMethodError: 'void org.eclipse.jetty.server.NetworkTrafficServerConnector.setNetworkTrafficListener(org.eclipse.jetty.io.NetworkTrafficListener)'
	at com.github.tomakehurst.wiremock.jetty11.Jetty11Utils.createServerConnector(Jetty11Utils.java:44)
	at com.github.tomakehurst.wiremock.jetty11.Jetty11HttpServer.createHttpConnector(Jetty11HttpServer.java:55)
	at com.github.tomakehurst.wiremock.jetty.JettyHttpServer.<init>(JettyHttpServer.java:89)
	at com.github.tomakehurst.wiremock.jetty11.Jetty11HttpServer.<init>(Jetty11HttpServer.java:44)
	at com.github.tomakehurst.wiremock.jetty.JettyHttpServerFactory.buildHttpServer(JettyHttpServerFactory.java:31)
	at com.github.tomakehurst.wiremock.WireMockServer.<init>(WireMockServer.java:81)
	at com.github.tomakehurst.wiremock.WireMockServer.<init>(WireMockServer.java:123)
jetty dependency tree
Copy code
mvn dependency:tree | grep -i jetty
[INFO] |  +- org.eclipse.jetty:jetty-server:jar:9.4.43.v20210629:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-http:jar:9.4.43.v20210629:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-io:jar:9.4.43.v20210629:compile
[INFO] |  +- org.eclipse.jetty:jetty-servlet:jar:9.4.43.v20210629:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-security:jar:9.4.43.v20210629:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-util-ajax:jar:9.4.43.v20210629:compile
[INFO] |  +- org.eclipse.jetty:jetty-servlets:jar:9.4.43.v20210629:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-continuation:jar:9.4.43.v20210629:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-util:jar:9.4.43.v20210629:compile
[INFO] |  +- org.eclipse.jetty:jetty-webapp:jar:9.4.43.v20210629:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-xml:jar:9.4.43.v20210629:compile
[INFO] |  +- org.eclipse.jetty:jetty-proxy:jar:9.4.43.v20210629:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-client:jar:9.4.43.v20210629:compile
[INFO] |  +- org.eclipse.jetty.http2:http2-server:jar:9.4.43.v20210629:compile
[INFO] |  |  \- org.eclipse.jetty.http2:http2-common:jar:9.4.43.v20210629:compile
[INFO] |  |     \- org.eclipse.jetty.http2:http2-hpack:jar:9.4.43.v20210629:compile
[INFO] |  +- org.eclipse.jetty:jetty-alpn-server:jar:9.4.43.v20210629:compile
[INFO] |  +- org.eclipse.jetty:jetty-alpn-java-server:jar:9.4.43.v20210629:compile
[INFO] |  +- org.eclipse.jetty:jetty-alpn-java-client:jar:9.4.43.v20210629:compile
[INFO] |  +- org.eclipse.jetty:jetty-alpn-client:jar:9.4.43.v20210629:compile
o
Hi. Do you use Witemock-standalone?
b
I plan to run a wiremock in my spring boot app as standalone server. I am thinking of adding stubs so that test cases when they call actual api behind the scene would point to wiremock server end point. This is my approach. using below dependency. my bean has these 2 lines of code
Copy code
WireMockServer wireMockServer = new WireMockServer(8089);
wireMockServer.start();
Copy code
<groupId>org.wiremock</groupId>
            <artifactId>wiremock</artifactId>
            <version>3.2.0</version>
let me know anything wrong with this approach.
o
org.wiremock:wiremock is not shaded and has a lot of dependencies you are responsible to manage on your own, so most likely you get into a kind of binary conflict if you have no upper bounds check for Maven
I recommend org.wiremock:wiremock-standalone in general
b
I see. let me read about wiremock-standalone on how to use it
o
It is basically the same JAR with the same API but that bundles and shades dependencies
So you might be able to just replace the dependency definition
Also, as always, you might consider using WireMock Spring Boot that resolves some alignment issues with spring boot
b
Thanks. Let me try standalone. It says i need to execute provided jar. Instead can it work as dependency?
never mind, just tried with standalone dependency, server started. some slf4j warnings are there as below, let me know if you have any suggestions
Copy code
SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.
SLF4J: Ignoring binding found at [jar:file:/Users/bmulik/.m2/repository/org/wiremock/wiremock-standalone/3.2.0/wiremock-standalone-3.2.0.jar!/wiremock/org/slf4j/impl/StaticLoggerBinder.class]
o
There is a pending patch in https://github.com/wiremock/wiremock/pull/2449. I would not worry,
b
Thanks Oleg, this helps.
o
Yw