【问题标题】:java.lang.NoClassDefFoundError: org/springframework/boot/Banner$Mode when using Hystrixjava.lang.NoClassDefFoundError: org/springframework/boot/Banner$Mode 使用 Hystrix 时
【发布时间】:2020-03-13 04:10:10
【问题描述】:

我正在尝试创建一个简单的 Hystrix 应用程序,我添加了 maven 依赖项,它会引发以下错误,

    Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/Banner$Mode
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:162)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:102)
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:68)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
    at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:100)
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:59)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:285)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
    at com.hp.it.sadb.telepathy.Main.main(Main.java:80)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.Banner$Mode
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 11 more

以下是我的 Maven 依赖项:

<dependency>
   <groupId>org.springframework.cloud</groupId>
   <artifactId>spring-cloud-starter-hystrix</artifactId>
   <version>1.4.6.RELEASE</version>
</dependency>

<dependency>
    <groupId>com.netflix.hystrix</groupId>
    <artifactId>hystrix-javanica</artifactId>
    <version>RELEASE</version>
</dependency>
<dependency>
    <groupId>com.netflix.hystrix</groupId>
    <artifactId>hystrix-core</artifactId>
    <version>RELEASE</version>
</dependency>
<dependency>
    <groupId>com.netflix.hystrix</groupId>
    <artifactId>hystrix-metrics-event-stream</artifactId>
    <version>RELEASE</version>
</dependency>

谁能告诉我,如何解决这个问题并创建一个简单的 hystrix 应用程序?

【问题讨论】:

标签: java maven microservices hystrix


【解决方案1】:
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>

Please follow below link for Sample Hystix Application.

https://howtodoinjava.com/spring-cloud/spring-hystrix-circuit-breaker-tutorial/

【讨论】:

    猜你喜欢
    • 2022-12-03
    • 2013-04-06
    • 2015-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-19
    • 2014-04-15
    相关资源
    最近更新 更多