请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

Eureka client启动不成功

2018-09-26 10:44:11.385 INFO 34768 — [ main] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1537929851383 with initial instances count: 1
2018-09-26 10:44:11.394 INFO 34768 — [ main] o.s.c.n.e.s.EurekaServiceRegistry : Registering application unknown with eureka with status UP
2018-09-26 10:44:11.396 INFO 34768 — [ main] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1537929851396, current=UP, previous=STARTING]
2018-09-26 10:44:11.397 INFO 34768 — [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_UNKNOWN/192.168.2.114: registering service…
2018-09-26 10:44:11.421 INFO 34768 — [ main] com.xuanyiai.ClientApplication : Started ClientApplication in 3.989 seconds (JVM running for 4.642)
2018-09-26 10:44:11.424 INFO 34768 — [ Thread-5] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@1130520d: startup date [Wed Sep 26 10:44:09 CST 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@158da8e
2018-09-26 10:44:11.426 INFO 34768 — [ Thread-5] o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application unknown with eureka with status DOWN
2018-09-26 10:44:11.426 WARN 34768 — [ Thread-5] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1537929851426, current=DOWN, previous=UP]
2018-09-26 10:44:11.429 INFO 34768 — [ Thread-5] o.s.c.support.DefaultLifecycleProcessor : Stopping beans in phase 0
2018-09-26 10:44:11.432 INFO 34768 — [ Thread-5] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2018-09-26 10:44:11.435 INFO 34768 — [ Thread-5] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans
2018-09-26 10:44:11.439 INFO 34768 — [ Thread-5] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient …
2018-09-26 10:44:11.440 WARN 34768 — [ Thread-5] .s.c.a.CommonAnnotationBeanPostProcessor : Invocation of destroy method failed on bean with name ‘scopedTarget.eurekaClient’: org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name ‘eurekaInstanceConfigBean’: Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)

Process finished with exit code 0

正在回答 回答被采纳积分+3

5回答

廖师兄 2018-09-26 20:10:48

可以把你的代码push一下我看看,别用2.0.4.RELEASE,该版本会和视频中的演示差别较大,课程的最后升级到了最新版,你先不急升级。

1 回复 有任何疑惑可以回复我~
  • 提问者 mtfelix #1
    廖师兄,如下,请帮忙看下:
    [server]
    https://gitlab-demo.com/7095512/myeureka
    [client]
    https://gitlab-demo.com/mtfelix/eurekaclient
    回复 有任何疑惑可以回复我~ 2018-09-27 11:52:52
  • 廖师兄 回复 提问者 mtfelix #2
    你代码里还是2.0.4.RELEASE啊,用我视频中的版本。你的问题不是在
    sprint boot 2.0.0.M3,spring-cloud版本Finchley.M2
    情况下报错的吗
    回复 有任何疑惑可以回复我~ 2018-09-28 23:35:50
  • cloverxixi 回复 廖师兄 #3
    可是现在视频里的版本现在maven仓库里面没有好像,这个问题该怎么解决呢
    回复 有任何疑惑可以回复我~ 2018-11-23 15:10:44
天新道人 2020-08-16 12:06:40

参见:https://blog.csdn.net/zhongzunfa/article/details/79482147

我在使用2.0.0.M3的时候出现Exception,最后改成2.0.0.RELEASE才解决。

自动关闭的情况,加入了

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-web</artifactId>
</dependency>

之后解决。


供参考

0 回复 有任何疑惑可以回复我~
咿呦 2020-03-16 18:31:55

当前最新稳定版本:

Spring Boot 2.2.5.RELEASE
Spring Cloud Hoxton.SR3

POM文件加上如下依赖,依然启动不成,

<dependency>
 <groupId>org.springframework.boot</groupId>
 <artifactId>spring-boot-starter-web</artifactId>
</dependency>


原因:

全新项目,启动后,Tomcat容器检测不到任何应用内容,启动后会自动退出。导致Eureka client启动失败的现象。


解决办法:

Application启动类主方法中,添加类似如下内容,可解决启动失败问题。服务中有了实际功能后,去掉即可。

while (true){
 Thread.sleep(Integer.MAX_VALUE);
}

0 回复 有任何疑惑可以回复我~
qq_小猪笨笨_1 2018-09-27 18:30:11

我的也是一样的错误,eureka的client启动不起来,client版本跟server一致,都是2.0.5release

看文档添加了web依赖,一切ok

0 回复 有任何疑惑可以回复我~
提问者 mtfelix 2018-09-26 10:55:50

再补充下问题:

我的版本严格按照:

sprint boot 2.0.0.M3,spring-cloud版本Finchley.M2

下面是执行的控制台消息:

-------------------------------------

instances count: 1

2018-09-26 10:54:13.493  INFO 34800 --- [           main] o.s.c.n.e.s.EurekaServiceRegistry        : Registering application unknown with eureka with status UP

2018-09-26 10:54:13.497  INFO 34800 --- [           main] com.netflix.discovery.DiscoveryClient    : Saw local status change event StatusChangeEvent [timestamp=1537930453497, current=UP, previous=STARTING]

2018-09-26 10:54:13.502  INFO 34800 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_UNKNOWN/192.168.2.114: registering service...

2018-09-26 10:54:13.535  INFO 34800 --- [           main] com.xuanyiai.ClientApplication           : Started ClientApplication in 3.489 seconds (JVM running for 4.014)

2018-09-26 10:54:13.542  INFO 34800 --- [       Thread-5] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@3688eb5b: startup date [Wed Sep 26 10:54:10 CST 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@4f6ee6e4

2018-09-26 10:54:13.543  INFO 34800 --- [       Thread-5] o.s.c.n.e.s.EurekaServiceRegistry        : Unregistering application unknown with eureka with status DOWN

2018-09-26 10:54:13.543  WARN 34800 --- [       Thread-5] com.netflix.discovery.DiscoveryClient    : Saw local status change event StatusChangeEvent [timestamp=1537930453543, current=DOWN, previous=UP]

2018-09-26 10:54:13.545  INFO 34800 --- [       Thread-5] o.s.c.support.DefaultLifecycleProcessor  : Stopping beans in phase 0

2018-09-26 10:54:13.547  INFO 34800 --- [       Thread-5] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown

2018-09-26 10:54:13.548  INFO 34800 --- [       Thread-5] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans

2018-09-26 10:54:13.550  INFO 34800 --- [       Thread-5] com.netflix.discovery.DiscoveryClient    : Shutting down DiscoveryClient ...

2018-09-26 10:54:13.551  WARN 34800 --- [       Thread-5] .s.c.a.CommonAnnotationBeanPostProcessor : Invocation of destroy method failed on bean with name 'scopedTarget.eurekaClient': org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'eurekaInstanceConfigBean': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)


0 回复 有任何疑惑可以回复我~
  • 提问者 mtfelix #1
    回复下自己最后的解决办法:
    
    spring-boot 2.0.4.RELEASE
    spring-cloud Finchley.SR1
    
    然后在client的pom.xml中增加依赖(实测加不加都ok):
    
    <dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter-web</artifactId>
    		</dependency>
    
    之前在server的pom.xml中按照doc/QA.md问题1添加了代码(实测加不加都ok)
    回复 有任何疑惑可以回复我~ 2018-09-26 11:17:30
  • 提问者 mtfelix #2
    在client的pom.xml中增加依赖(还是要加的): <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
    回复 有任何疑惑可以回复我~ 2018-09-26 11:21:56
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信