springcloud启动异常: Application failed to start with classpath: [file:/C:/JavaJdk/jdk1.8.0_18........

报错信息:

10:43:50.466 [main] DEBUG org.springframework.boot.context.logging.ClasspathLoggingApplicationListener - Application failed to start with classpath: [file:/C:/JavaJdk/jdk1.8.0_181/jre/lib/charsets.jar, file:/C:/JavaJdk/jdk1.8.0_181/jre/lib/deploy.jar, file:/C:/JavaJdk/jdk1.8.0_181/jre/lib/ext/access-bridge-64.jar, file:/C:/JavaJdk/jdk1.8.0_181/jre/lib/ext/cldrdata.jar, file:/C:/JavaJdk/jdk1.8.0_181/jre/lib/ext/dnsns.jar, file:/C:/JavaJdk/jdk1.8.0_181/jre/lib/ext/jaccess.jar, file:/C:/JavaJdk/jdk1.8.0_181/jre/lib/ext/jfxrt.jar, file:/C:/JavaJdk/jdk1.8.0_181/jre/lib/ext/localedata.jar, file:/C:/JavaJdk/jdk1.8.0_181/jre/lib/ext/nashorn.jar, file:/C:/JavaJdk/jdk1.8.0_181/jre/lib/ext/sunec.jar......................

java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.([Ljava/lang/Object;)V
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:157)..............................

原因:springcloud和springboot 的依赖版本不配套导致

解决办法:在引入springcloud基础包后将对应的apringboot的包改成相对应匹配的包

问题依赖代码:

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

    
        UTF-8
        UTF-8
        1.8
        Dalston.SR4
    

    
        
            org.springframework.boot
            spring-boot-starter
        

        
            org.springframework.boot
            spring-boot-starter-test
            test
        
        
            org.springframework.cloud
            spring-cloud-starter-oauth2
        


    

    
    
        
            org.springframework.cloud
            spring-cloud-dependencies
            ${spring-cloud.version}
            pom
            import
        

    

改正:

将springboot基础代码改为


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

其他不变

 

 

你可能感兴趣的:(springcloud启动异常: Application failed to start with classpath: [file:/C:/JavaJdk/jdk1.8.0_18........)