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这两个版本
---------------------
转载原文://blog.csdn.net/badyting/article/details/72822660
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 :
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="//maven.apache.org/POM/4.0.0" xmlns:xsi="//www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="//maven.apache.org/POM/4.0.0 //maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.zero.eureka</groupId>
<artifactId>client</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>client</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Finchley.SR1</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
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 :
package org.zero.eureka.client;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
public class ClientApplication {
public static void main(String[] args) {
SpringApplication.run(ClientApplication.class, args);
}
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 :
eureka:
service-url:
defaultZone: //localhost:8761/eureka/
spring:
application:
name: eureka-client
server:
port: 9088
After completing the above configuration , Start the project . But I failed when I started the project here , The console outputs the following warning message :
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!)
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 :
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
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
- 【spring boot】 Using annotations @ConfigurationProperties When reading the configuration file Report errors org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'rocketmqAutoConfiguration':
Unsatisfied dependenc
As the title , The configuration file is as follows : # Registry configuration eureka: instance: instanceId: ${spring.application.name}:${random.int} hostname: ...
- Report errors org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [bean.xml]
The reason for this kind of mistake is basically applicationContext.xml In file bean Configuration error , Error is as follows : org.springframework.beans.factory.BeanCreationExc ...
- 【 Report errors 】org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webSocketHandlerMapping' defined in class path resource
Environmental Science :maven+eclipse+jdk1.8 [tomcat It uses maven Built-in plug-ins , The real reason is that tomcat Version of the problem ] background : It's going on SSM Integrate WebSocket When , Project initiation report org.s ...
- Spring AOP Report errors org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'XXXXXX' defined in class path resource..........
The complete error report is as follows : org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'befo ...
- ssh Integration error is serious : Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxx'
Error description :eclipse Integrate ssh When Newspaper cannot be created with the name xxx The object of Information : Destroying singletons in org.springframework.beans.factory.s ...
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [bean.xml]: Invocation of init method failed; nested exception is
Copying xml When the file is modified , I often change the original file by accident , And lead to the creation of bean error . The error is reported as follows : Exception sending context initialized event to l ...
- aused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method fai
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roleDaoImpl' ...
- Report errors
!!!!!!!!!!!org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSessionRepositoryFilter' is defined
Report errors !!!!!!!!!!! For use maven The project is not very skilled , Often in Maven turn Web project ( Why do you want to turn web project ? Because in tomcat Run up .maven It seems that the project can be deployed directly to tomcat Of , Or integration to ...
- Invocation of destroy method failed on bean with name ‘XXXX’
The problem of project startup error reporting :Invocation of destroy method failed on bean with name 'scopedTarget.eurekaClient': org.spri ...
Random recommendation
- unity It's a homemade glass beer bottle shader
The customer's requirements are as follows step : 1. Analyze the effect of glass bottle The effect is as follows : highlights , Like subsurface scattering ( The inner layer is transparent and the outer layer is dull ), The outer white outlines . highlights :unity Internal smoothness parameters are provided , The smoother, the more obvious the highlight effect is , The material of beer bottle belongs to ...
- POJ 2991–Crane【 Line segment tree + The geometric 】
The question : Think of each arm as a vector , Then the position of the manipulator is exactly the sum of the arm vectors . Rotate a joint , It's actually rotating all the arm vectors from the joint to the manipulator . Because there are so many arms , It takes time for each vector to do the same rotation . Now you can think of using line segments ...
- DNS Domain name resolution
It used to be DNSPOD.CN Parsing , No problem . Because I want to do server analysis according to different countries ( The European , Asia , The United States ) And then go to DNSPOD.com It's divided by country . But the reaction from Europe , I can't visit the website on and off every day . ...
- ASP.NET There is no magic ——ASP.NET MVC filter (Filter)
The last article introduced the use of Authorize Feature implementation ASP.NET MVC Targeted at Controller perhaps Action Authorization function of , In fact, this feature is MVC Part of the function , It's called a filter (Filter), It's a kind of face ...
- Target file removal header At the beginning of a line # Number
Please follow the steps below to configure : --> open session Of Config Object tab , And edit Custom Properties Options --> edit Custom Properties project ...
- Lunch War with the Donkey CSU - 2084
Jingze is a big figure in California State University for his stubbornness. Because of his new failu ...
- Applet canvas Realize picture preview , pictures saving
wxml Code : <view class="result-page"> <canvas bindtap="previewImage" canv ...
- kaggle Summary of the Titanic problem
Learning machine learning for so long , It's the first time to really solve a practical problem with the method of machine learning , Explore step by step , Although the final result is not very accurate , Only to achieve 0.78647, But it's a lot to gain , In order to prevent my memory bug from going to the brain in the future , I decided to take notes . ...
- laravel Some function meanings of database query ( unfinished )
->all() Query all the information in the database , An object form returns $rows=UserModel::all(); ->get() The execution function of the query ,->toArray() What you want to query is to convert the data set into a number ...
- JNI A simple example of
The operating system used in this example MacOS, 64 position JVM. JNI The steps are as follows : To write Java Code , And let us know native Method : public class HelloJni { public native v ...