https://linen.dev logo
#general
Title
# general
v

Vadivel Murugan

11/29/2023, 5:44 PM
Hello, I am using spring boot 3.2 (web not webflux)+ wiremock 3.3.1. when I start my integration which is annotated with , @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment._RANDOM_PORT_) @AutoConfigureWebClient(registerRestTemplate = true) @AutoConfigureMockMvc and in the class I am creating wireMockServer using below code, @RegisterExtension static WireMockExtension wireMockServer = WireMockExtension._newInstance_() .options( _wireMockConfig_() .dynamicPort() .usingFilesUnderClasspath(“wiremock”) ) .build(); But getting below error when I run the integration-test,
Copy code
java.lang.IncompatibleClassChangeError: class org.eclipse.jetty.http2.server.HttpChannelOverHTTP2 has interface org.eclipse.jetty.server.HttpChannel as super class

	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
	at org.eclipse.jetty.http2.server.AbstractHTTP2ServerConnectionFactory.<init>(AbstractHTTP2ServerConnectionFactory.java:82)
	at org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory.<init>(HTTP2ServerConnectionFactory.java:53)
	at org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory.<init>(HTTP2CServerConnectionFactory.java:53)
	at org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory.<init>(HTTP2CServerConnectionFactory.java:48)
	at com.github.tomakehurst.wiremock.jetty11.Jetty11HttpServer.createHttpConnector(Jetty11HttpServer.java:53)
	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.junit5.WireMockExtension.startServerIfRequired(WireMockExtension.java:164)
	at com.github.tomakehurst.wiremock.junit5.WireMockExtension.beforeAll(WireMockExtension.java:230)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	Suppressed: java.lang.NullPointerException: Cannot invoke "com.github.tomakehurst.wiremock.WireMockServer.isRunning()" because "this.wireMockServer" is null
		at com.github.tomakehurst.wiremock.junit5.WireMockExtension.stopServerIfRunning(WireMockExtension.java:218)
		at com.github.tomakehurst.wiremock.junit5.WireMockExtension.afterAll(WireMockExtension.java:256)
		... 1 more
Do we need any other additional dependencies required inorder to run with spring-boot 3.2?
t

Tom

11/29/2023, 5:47 PM
Try switching to the standalone WireMock JAR in your dependencies.
v

Vadivel Murugan

11/29/2023, 5:49 PM
Thank you @Tom for the prompt reply. But the standalone dependency in maven is haing type pom for the latest versions, <!-- https://mvnrepository.com/artifact/com.github.tomakehurst/wiremock-jre8-standalone --> <dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8-standalone</artifactId>
<version>3.0.1</version>
<type>pom</type>
<scope>test</scope>
t

Tom

11/29/2023, 5:49 PM
That’s not the latest one
v

Vadivel Murugan

11/29/2023, 5:49 PM
May be I can use “2.35.1”
t

Tom

11/29/2023, 5:49 PM
You need
wiremock-standalone
as the artifactId and
3.3.1
as the version
v

Vadivel Murugan

11/29/2023, 5:50 PM
ah ok.Thanks. Let me give it a try.
j

Joao Guilherme Pan

12/06/2023, 11:08 AM
I have the same issue and changing the dependency didn't solve :/
Good news! After I did this, I managed to fix the issue. Thanks!
158 Views