Show org.springframework.context.ApplicationContextException: Failed to start bean 'org.springframework.cloud.netflix.eureka.EurekaDiscoveryClientConfiguration'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.eurekaClient' defined in class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.netflix.discovery.EurekaClient]: Factory method 'eurekaClient' threw exception; nested exception is java.lang.RuntimeException: Failed to initialize DiscoveryClient! springcloud启动的时候报这个错误。 解决增加jersey jar <dependency> <groupId>org.glassfish.jersey.core</groupId> <artifactId>jersey-server</artifactId> <version>2.25.1</version> </dependency>spring boot是1.3.0或者是1.5.13这两个版本 Disconnected from the target VM, address: '127.0.0.1:51233', transport: 'socket' Eureka Client Use Use IDEA Create a Spring Initializr project , When checking the module, you need to select Eureka Discovery, as follows : project-generated pom.xml The contents of the document are as follows :
After all the project dependencies are loaded , Add... To the startup class @EnableDiscoveryClient, Declare that this is a eureka client, Otherwise, there will be no service registration :
And then there was application.yml In profile , The configuration registry is eureka server The address of , And the name and boot port number of the project . as follows :
After completing the above configuration , Start the project . But I failed when I started the project here , The console outputs the following warning message :
This is because client It doesn't contain Tomcat Dependence , therefore Spring The container was unable to create some instances , As a result, the project cannot be started , Just in pom.xml In file , add web Rely on it :
After the project starts successfully , Can be in eureka server View the registered instance information in the information panel of , as follows : EurekaClient Project start error Invocation of destroy method failed on bean with name 'scopedTarget.eurekaClient': org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'e More articles about
Random recommendation
|