0

I have a Java REST API that uses JDK8 and Spring Boot 2.6.8. I plan to upgrade it to JDK17 and Spring Boot 3.x. I ran jdeprscan against its jar to determine which classes, etc., I need to update:

jdeprscan target\myapplication.jar

But I get a bunch of errors. At first most of them indicated "cannot find class", such as:

error: cannot find class org/slf4j/LoggerFactory

Then I realized the jar I ran jdeprscan against is created using spring-boot-maven-plugin (from my pom.xml) - which I noticed does not contain all the dependency jars or their classes. So I assumed that "incomplete" jar is the reason for all the cannot find class errors. I've changed my pom.xml to instead use maven-assembly-plugin so I now get a jar that contains all my project's dependency libraries and their classes. Now I point my jdeprscan to that jar instead.

The jdeprscan results now contain many messages that will be useful in upgrading my JDK, such as org/apache/logging/log4j/util/LoaderUtil uses deprecated class ..., etc.

However, it still also contains a bunch of "cannot find class" messages such as: error: cannot find class javax/servlet/FilterChain.

My questions are:

  • Does jdeprscan in fact need to be run against a jar that contains all dependency classes - rather than the jar that spring-boot-maven-plugin creates?
  • Why would jdeprscan result in messages indicating error: cannot find class ... when, based on the fact that I can successfully execute the jar itself via the java -jar command, I believe that all the required are in fact in the jar?
Woodchuck
  • 3,869
  • 2
  • 39
  • 70

0 Answers0