I am updating a maven project to Spring Boot 3 and Java 21. In doing so, I am getting this exception at runtime:
java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest
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:526) ~[?:?]
at java.base/java.lang.Class.forName0(Native Method) ~[?:?]
at java.base/java.lang.Class.forName(Class.java:534) ~[?:?]
at java.base/java.lang.Class.forName(Class.java:513) ~[?:?]
at java.base/sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114) ~[?:?]
... 32 more
Wrapped by: java.lang.TypeNotPresentException: Type javax.servlet.http.HttpServletRequest not present
I am not using javax.servlet.http.HttpServletRequest
in my project, so I assume this is in a stale JAR. I thought there was a way to run mvn dependency:tree or a plugin for Eclipse/IJ that shows all of the imports used by each dependent JAR, such that I could see JAR xyz doing an import of this problem type and exclude or update it.
For a general case, how do I accomplish this - Finding the classes referenced by each JAR my project has as a dependency, recursively?
I was able to accomplish this as follows.