java.lang.NoClassDefFoundError:com / netflix / discovery / converters / EurekaJacksonCodec $ DataCenterInfoDeserializer

时间:2019-04-19 12:49:30

标签: spring-boot netflix-eureka

我正在尝试在Spring Boot 1.5.20.RELEASE和netflix Spring Cloud Starter Netflix eureka Server 1.4.6.RELEASE版本上运行netflix eureka服务发现服务器。我正在使用Edgware.SR5春季云版本。当我运行spring boot应用程序时,我遇到了异常。

我尝试过同时运行spring-cloud-starter-netflix-eureka-server和spring-cloud-starter-eureka-server,但是没有运气。

以下是我运行该服务时得到的堆栈跟踪:

2019-04-19 18:05:25 ERROR --- [main] o.s.boot.SpringApplication - Application startup failed
java.lang.IllegalStateException: Cannot load configuration class: org.springframework.cloud.netflix.eureka.server.EurekaServerAutoConfiguration
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:404)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:249)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:283)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:127)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:124)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
    at com.kpit.esp.dicovery.EurekaServerApp.main(EurekaServerApp.java:12)
Caused by: java.lang.IllegalStateException: Unable to load cache item
    at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:79)
    at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34)
    at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:116)
    at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:291)
    at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:480)
    at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:337)
    at org.springframework.context.annotation.ConfigurationClassEnhancer.createClass(ConfigurationClassEnhancer.java:138)
    at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:110)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:394)
    ... 12 common frames omitted
Caused by: java.lang.NoClassDefFoundError: com/netflix/discovery/converters/EurekaJacksonCodec$DataCenterInfoDeserializer
    at org.springframework.cloud.netflix.eureka.server.CloudJacksonJson$CloudJacksonCodec.<init>(CloudJacksonJson.java:87)
    at org.springframework.cloud.netflix.eureka.server.CloudJacksonJson.<init>(CloudJacksonJson.java:39)
    at org.springframework.cloud.netflix.eureka.server.EurekaServerAutoConfiguration.<clinit>(EurekaServerAutoConfiguration.java:99)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:467)
    at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:336)
    at org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:492)
    at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93)
    at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:91)
    at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61)
    ... 20 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.netflix.discovery.converters.EurekaJacksonCodec$DataCenterInfoDeserializer
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 33 common frames omitted

1 个答案:

答案 0 :(得分:0)

找不到spring boot的类是spring-cloud-starter-netflix-eureka-client依赖项的一部分,请尝试将其放入。

好吧,它确实属于maven依赖

<dependency>
   <groupId>com.netflix.eureka</groupId>
   <artifactId>eureka-client</artifactId>
</dependency>

但这是客户端发现集的一部分。