https://linen.dev logo
#help
Title
# help
e

Ekta Bansal

07/12/2023, 8:36 AM
hello folks WireMockServer wireMockServer = new WireMockServer(_wireMockConfig_().port(8089)); //No-args constructor will start on port 8080, no HTTPS wireMockServer.start();
added this dependency
<dependency>
<groupId>com.github.tomakehurst</groupId> <artifactId>wiremock-jre8</artifactId> <version>2.35.0</version> </dependency> giving the below error Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/DispatcherType at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:375) at com.github.tomakehurst.wiremock.jetty9.JettyHttpServerFactory.getServerConstructor(JettyHttpServerFactory.java:37) at com.github.tomakehurst.wiremock.jetty9.JettyHttpServerFactory.<clinit>(JettyHttpServerFactory.java:30) at com.github.tomakehurst.wiremock.core.WireMockConfiguration.<init>(WireMockConfiguration.java:94) at com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig(WireMockConfiguration.java:135) at com.example.wiremock.WiremockApplication.main(WiremockApplication.java:16) Caused by: java.lang.ClassNotFoundException: javax.servlet.DispatcherType at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
t

Tom

07/12/2023, 9:37 AM
Hi @Ekta Bansal it looks like you’ve got a clashing version of the servlet API on your classpath. 2 options to resolve this: 1. Upgrade to WireMock 3.0.0-beta-11, which has a newer servlet version. 2. Use the standalone JAR instead, which shades the servlet API out.
12 Views