Hi all, I'm doing a migration from com.github.toma...
# help
m
Hi all, I'm doing a migration from com.github.tomakehurstwiremock jre8jar2.26.3test to org.wiremock: wiremock: 3.0.0 but I'm having an issue, I'm not able to find any blog related to this issue
Copy code
java.lang.IllegalStateException: Failed to load ApplicationContext for [WebMergedContextConfiguration@47ae6c18 testClass = 

Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletOutputStream
	at java.base/java.lang.Class.getDeclaredFields0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3297)
	at java.base/java.lang.Class.getDeclaredFields(Class.java:2371)
	at org.springframework.util.ReflectionUtils.getDeclaredFields(ReflectionUtils.java:727)
	... 50 more
Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletOutputStream
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
If I understand well now we are using jakarta instead of javax.
l
Hi. Are you using spring? If so what version of spring are you using ?
m
Hi yes, I'm using 3.1.4
after the migration my tests no longer work I was using
wiremock-jre8:2.35.2
but after I migrated spring to 3.1.4 my tests are not longer work I'm getting this issue with mi initial version 2.35.2
Copy code
java.lang.NoClassDefFoundError: javax/servlet/DispatcherType
according to this github issue, I have to use
com.github.tomakehurst:wiremock-jre8-standalone:2.35.0"
I tested with that version and others but always is getting this issue
Copy code
java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache

Exception java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7 [in thread "main"]
seems adding the next library solve that issue
Copy code
org.codehaus.groovygroovy3.0.20
but after that I'm getting
Copy code
Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletOutputStream
the same issue ay the start of this thread 😞
@Tom Any solution or advice for me is welcome. thanks
l
I am driving at the moment but will try to take a look when I arrive.
t
I suggest switching to the standalone JAR in the first instance. I think you’ve probably got as javax vs. jakarta servlet clash, and using standalone will avoid this.
l
@Martin Edgar Albarracin Chinome sorry for the late reply. Been traveling for ages 😥 Tom summed it up with regard to switching to the standalone version of wiremock. This is the standalone version https://mvnrepository.com/artifact/org.wiremock/wiremock-standalone
m
Thanks all, I'm using
org.wiremock:wiremock-standalone:3.0.0
but I'm getting the same issue
Copy code
Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletOutputStream
t
Any reason you can't use 3.4.2?
m
Same issue 😞 using 3.4.2
Copy code
<dependency>
  <groupId>org.wiremock</groupId>
  <artifactId>wiremock-standalone</artifactId>
  <version>3.4.2</version>
  <scope>test</scope>
</dependency>
Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletOutputStream
t
Either this is something outside of WireMock or somehow you’re still getting the thin JAR on the classpath.
m
Hi all, thanks for your replies. yes you're right I discovered that one of my libraries was using javax instead of jakarta, after fixed this one I was able to run my project thanks a lot all.
👍 2
332 Views