Eureka client启动不成功

来源:3-3 Eureka Client的使用

mtfelix

2018-09-26

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

写回答

5回答

廖师兄

2018-09-26

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

1
4
廖师兄
回复
cloverxixi
看课程源码doc/QA.md
2018-11-27
共4条回复

天新道人

2020-08-16

参见: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
0

咿呦

2020-03-16

当前最新稳定版本:

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
0

qq_小猪笨笨_1

2018-09-27

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

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

0
0

mtfelix

提问者

2018-09-26

再补充下问题:

我的版本严格按照:

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
2
mtfelix
在client的pom.xml中增加依赖(还是要加的): org.springframework.boot spring-boot-starter-web
2018-09-26
共2条回复

SpringCloud Finchley(M2+RELEASE+SR2)微服务实战

SpringCloud组件实现微服务,【已升级Finchley.Release】

5668 学习 · 2489 问题

查看课程