SpringBoot项目引入Shiro时,出现错误 : java.lang.NoClassDefFoundError: org/springframework/core/lo

原因:

版本兼容问题。

 Application run failed

java.lang.NoClassDefFoundError: org/springframework/core/log/LogMessage
    at org.springframework.boot.StartupInfoLogger.logStarting(StartupInfoLogger.java:55) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    at org.springframework.boot.SpringApplication.logStartupInfo(SpringApplication.java:637) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:373) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    at com.AliasBlue.springbootjsf.application.JsfPrimefacesHello3Application.main(JsfPrimefacesHello3Application.java:10) ~[classes/:na]
Caused by: java.lang.ClassNotFoundException: org.springframework.core.log.LogMessage
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) ~[na:na]
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
    ... 7 common frames omitted

配置文件:



    4.0.0
    
        org.springframework.boot
        spring-boot-starter-parent
        2.2.26.RELEASE
         
    
    com.sxt.shiro
    shiro-springboot-demo2
    0.0.1-SNAPSHOT
    shiro-springboot-demo2
    Demo project for Spring Boot

    
        1.8
    


    
        
            
                org.springframework.boot
                spring-boot-dependencies
                2.1.9.RELEASE
                pom
                import
            
        
    

    
        
        
        
        
            
            
            
        
        
        
            
            
            
        
        
        
            org.springframework.boot
            spring-boot-starter-thymeleaf
        
        
        
            org.apache.shiro
            shiro-spring-boot-web-starter
            1.4.2
        
        
        
            com.github.theborakompanioni
            thymeleaf-extras-shiro
            2.0.0
        
        
        
            org.apache.shiro
            shiro-ehcache
            1.4.2
        
        
            commons-io
            commons-io
            2.6
        
        
            org.projectlombok
            lombok
        
        
            junit
            junit
            test
        
        
            org.springframework.boot
            spring-boot-test
            test
        
    

    
        
            
                org.springframework.boot
                spring-boot-maven-plugin
            
        
    


上面使用的是

    
        org.springframework.boot
        spring-boot-starter-parent
        2.2.26.RELEASE
         
    

版本太高,不兼容

使用低版本,注意版本是2.1.10!!!!

    
        org.springframework.boot
        spring-boot-starter-parent
        2.1.10.RELEASE
         
    

 

你可能感兴趣的:(SpringBoot项目引入Shiro时,出现错误 : java.lang.NoClassDefFoundError: org/springframework/core/lo)