Search code examples
intellij-ideaspring-securitypom.xmlintellij-14spring-authorization-server

Why I get this error NoClassDefFoundError: org/springframework/security/web/context/SecurityContextHolderFilter?


Im using IntelliJ.

Im currently building a project about Spring Authorization Server ver 0.4.0

In my pom.xml, I have these dependencies;

1.SpringBoot 2.6.14

2.SpringBoot starter security 2.6.14

  • spring security config 5.6.9
  • spring security web 5.6.9 Spring Authorization Server ver 0.4.0]

But when I build my project, I got this error:

NoClassDefFoundError: org/springframework/security/web/context/SecurityContextHolderFilter

Does anybody here experience this kind of problem? I already tried deleting the .m2/repository folder and resolve the dependencies again but still when I build, I get the above error.

Please help how to solve.


Solution

  • The SecurityContextHolderFilter class was introduced in Spring Security 5.7, Spring Authorization Server is compatible with Spring Security 5.7, therefore you should use Spring Boot >= 2.7.