Home > Enterprise >  Just upgraded from Spring Boot 2.7.4 to Spring Boot 3.0.0, caused error Caused by: java.lang.NoClass
Just upgraded from Spring Boot 2.7.4 to Spring Boot 3.0.0, caused error Caused by: java.lang.NoClass

Time:12-10

Upgraded the application from Spring 2.7.4 to 3.0.0 Got the following exception while trying to run

java.lang.IllegalStateException: Failed to introspect Class [org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration] from ClassLoader [jdk.internal.loader.ClassLoaders$AppClassLoader@eaa1a4da]
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:483)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:360)
    at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:417)


Caused by: java.lang.NoClassDefFoundError: javax.servlet.Filter
    at java.base/java.lang.Class.getDeclaredMethodsImpl(Native Method)
    at java.base/java.lang.Class.getDeclaredMethods(Class.java:1180)
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:465)

Can anyone help me to fix this?

CodePudding user response:

The release notes for Spring-Boot 3.0 state that:

...

Spring Boot 3.0 has migrated from Java EE to Jakarta EE APIs for all dependencies. Wherever possible, Jakarta EE 10 compatible dependencies have been chosen, including:

...

  • Jakarta Servlet 6.0

...

As such, the import changed from javax.servlet to jakarta.servlet.

CodePudding user response:

You should change javax.* to jakarta.* wherever applicable in your project to migrate to Spring boot 3.0.0

  • Related