【异常】Zipkin server启动 Caused by: java.lang.ClassNotFoundException: com.linecorp.armeria.server.cors.CorsServiceBuilder

一、异常信息

ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
                                    ********
                                  **        **
                                 *            *
                                **            **
                                **            **
                                 **          **
                                  **        **
                                    ********
                                      ****
                                      ****
        ****                          ****
     ******                           ****                                 ***
  ****************************************************************************
    *******                           ****                                 ***
        ****                          ****
                                       **
                                       **


             *****      **     *****     ** **       **     **   **
               **       **     **  *     ***         **     **** **
              **        **     *****     ****        **     **  ***
             ******     **     **        **  **      **     **   **

:: Powered by Spring Boot ::         (v2.0.3.RELEASE)

ERROR SpringApplication Application run failed
 org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [zipkin2.server.internal.InternalZipkinConfiguration]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class zipkin2.server.internal.ZipkinServerConfiguration
    at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:648)
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:303)
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245)
    at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:638)
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:303)
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245)
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:202)
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:170)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:316)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)
    at com.zbq.zbqzipkinserver.ZbqZipkinServerApplication.main(ZbqZipkinServerApplication.java:13)
Caused by: java.lang.IllegalStateException: Failed to introspect annotated methods on class zipkin2.server.internal.ZipkinServerConfiguration
    at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:169)
    at org.springframework.context.annotation.ConfigurationClassParser.retrieveBeanMethodMetadata(ConfigurationClassParser.java:393)
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:318)
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245)
    at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:638)
    ... 20 more
Caused by: java.lang.NoClassDefFoundError: com/linecorp/armeria/server/cors/CorsServiceBuilder
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.getDeclaredMethods(Class.java:1975)
    at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:158)
    ... 24 more
Caused by: java.lang.ClassNotFoundException: com.linecorp.armeria.server.cors.CorsServiceBuilder
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 28 more

Process finished with exit code 1

二、异常发生原因分析

zipkin-server的maven版本与spring-boot-starter-parent的maven版本不一致导致

 

三、解决办法

将两者的maven版本设置成一致。那如何指定谁和谁一致的呢?

以zipkin-server为2.10.3的版本为例,

1)打开maven的中心仓库地址

https://mvnrepository.com/

2)搜索zipkin-server,找到并定位到2.10.3的版本,如下:

 

2)进入到上面页面后,翻到最下面,会看到相关的依赖及对应的版本,为2.0.3.RELEASE

 

posted @ 2019-09-14 21:09  N!CE波  阅读(2865)  评论(0编辑  收藏  举报