首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >org/springframework/security/converter/RsaKeyConverters :java.lang.NoClassDefFoundError

org/springframework/security/converter/RsaKeyConverters :java.lang.NoClassDefFoundError
EN

Stack Overflow用户
提问于 2020-04-26 17:42:44
回答 1查看 4.5K关注 0票数 2

我开始学习spring和spring安全性,我有以下错误。我一直在遵循几个指南,所有这些我都遇到了同样的问题。错误发生在我试图提升应用程序时

代码语言:javascript
运行
复制
java.lang.NoClassDefFoundError: org/springframework/security/converter/RsaKeyConverters
        at org.springframework.security.config.crypto.RsaKeyConversionServicePostProcessor.pkcs8(RsaKeyConversionServicePostProcessor.java:89) ~[spring-security-config-5.2.2.RELEASE.jar!/:5.2.2.RELEASE]
        at org.springframework.security.config.crypto.RsaKeyConversionServicePostProcessor.postProcessBeanFactory(RsaKeyConversionServicePostProcessor.java:66) ~[spring-security-config-5.2.2.RELEASE.jar!/:5.2.2.RELEASE]
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:286) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:181) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[spring-context-5.2.5.RELEASE.jar!/:5.2.5.RELEASE]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.6.RELEASE.jar!/:2.2.6.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.6.RELEASE.jar!/:2.2.6.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.6.RELEASE.jar!/:2.2.6.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.6.RELEASE.jar!/:2.2.6.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.6.RELEASE.jar!/:2.2.6.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.6.RELEASE.jar!/:2.2.6.RELEASE]
        at com.myApplication.myApplication.main(myApplicationApplication.java:13) ~[classes!/:0.0.1-SNAPSHOT]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
        at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) ~[myApplication-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) ~[myApplication-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) ~[myApplication-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) ~[myApplication-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
Caused by: java.lang.ClassNotFoundException: org.springframework.security.converter.RsaKeyConverters
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471) ~[na:na]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588) ~[na:na]
        at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:92) ~[myApplication-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
        ... 21 common frames omitted

这是我的pom.xml:

代码语言:javascript
运行
复制
org.springframework.boot
        spring-boot-starter-parent
        1.5.9.RELEASE
         
    

        11
    

        
        
            org.springframework.boot
            spring-boot-starter-web
            1.5.9.RELEASE
        
        
            org.springframework.security
            spring-security-web
            4.0.1.RELEASE
        
        
            org.springframework.boot
            spring-boot-starter-data-jpa
        
        
            org.springframework.boot
            spring-boot-starter-security
            1.5.9.RELEASE
        
        
            org.springframework.security
            spring-security-jwt
            1.0.8.RELEASE
        
        
        org.springframework.security.oauth
        spring-security-oauth2
        2.0.14.RELEASE
    

        
            org.springframework.boot
            spring-boot-starter-test
            test
            
                
                    org.junit.vintage
                    junit-vintage-engine
                
            
        
        
            org.springframework.security
            spring-security-test
            test

我的application.class

代码语言:javascript
运行
复制
@EnableResourceServer
@SpringBootApplication
public class myApplicationApplication {

    public static void main(String[] args) {
        SpringApplication.run(myApplicationApplication.class, args);
    }

}

我是spring和spring security的新手,所以任何帮助都将不胜感激。

EN

Stack Overflow用户

发布于 2021-02-25 12:24:54

我建议你通过从当前版本低于5.2的spring-security-core版本中删除来解决这个问题。看起来它依赖于这个依赖关系:

代码语言:javascript
运行
复制
org.springframework.security
    spring-security-web
    4.0.1.RELEASE

我从我的项目POM中删除了旧版本的spring-security-core来达到这个目的:

代码语言:javascript
运行
复制
org.springframework.security
            spring-security-core

我已经意识到:在effective-pom如此不同的spring-security-core版本中:

代码语言:javascript
运行
复制
org.springframework.security
      spring-security-core
      5.4.2
      compile
    
    
  

  
    
      org.springframework.security
      spring-security-core
      5.1.6.RELEASE
      compile

但org.springframework.security.converter.RsaKeyConverters类是从5.2版本开始出现的。你可以在这里看到:

https://github.com/spring-projects/spring-security/commit/1c25fe26c9d0241f14f28705ec585aa5c9791ae1#diff-4412eaef26b0242873cc8a9dc5533fee75014866b296e2a3e791c98936607b26

票数 1
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61438668

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档