[英]Just upgraded from Spring Boot 2.7.4 to Spring Boot 3.0.0, caused error Caused by: java.lang.NoClassDefFoundError: javax.servlet.Filter
Upgraded the application from Spring 2.7.4 to 3.0.0 Got the following exception while trying to run将应用程序从 Spring 2.7.4 升级到 3.0.0 尝试运行时出现以下异常
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?谁能帮我解决这个问题?
The release notes for Spring-Boot 3.0 state that: Spring-Boot 3.0 的发行说明指出:
...
...
Spring Boot 3.0 has migrated from Java EE to Jakarta EE APIs for all dependencies.
Spring Boot 3.0 已将所有依赖项从 Java EE 迁移到 Jakarta EE API。 Wherever possible, Jakarta EE 10 compatible dependencies have been chosen, including:
尽可能选择 Jakarta EE 10 兼容依赖项,包括:
...
...
- Jakarta Servlet 6.0
雅加达 Servlet 6.0
...
...
As such, the import changed from javax.servlet
to jakarta.servlet
.因此,导入从
javax.servlet
更改为jakarta.servlet
。
You should change javax.*
to jakarta.*
wherever applicable in your project to migrate to Spring boot 3.0.0您应该将
javax.*
更改为jakarta.*
在项目中适用的任何地方迁移到 Spring boot 3.0.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.