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 :

  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3.  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  4.  <modelVersion>4.0.0</modelVersion>
  5.   
  6.  <groupId>org.zero.eureka</groupId>
  7.  <artifactId>client</artifactId>
  8.  <version>0.0.1-SNAPSHOT</version>
  9.  <packaging>jar</packaging>
  10.  
  11.  <name>client</name>
  12.  <description>Demo project for Spring Boot</description>
  13.  
  14.  <parent>
  15.  <groupId>org.springframework.boot</groupId>
  16.  <artifactId>spring-boot-starter-parent</artifactId>
  17.  <version>2.0.4.RELEASE</version>
  18.  <relativePath/> <!-- lookup parent from repository -->
  19.  </parent>
  20.   
  21.  <properties>
  22.  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  23.  <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  24.  <java.version>1.8</java.version>
  25.  <spring-cloud.version>Finchley.SR1</spring-cloud.version>
  26.  </properties>
  27.  
  28.  <dependencies>
  29.  <dependency>
  30.  <groupId>org.springframework.cloud</groupId>
  31.  <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
  32.  </dependency>
  33.   
  34.  <dependency>
  35.  <groupId>org.springframework.boot</groupId>
  36.  <artifactId>spring-boot-starter-test</artifactId>
  37.  <scope>test</scope>
  38.  </dependency>
  39.  </dependencies>
  40.   
  41.  <dependencyManagement>
  42.  <dependencies>
  43.  <dependency>
  44.  <groupId>org.springframework.cloud</groupId>
  45.  <artifactId>spring-cloud-dependencies</artifactId>
  46.  <version>${spring-cloud.version}</version> 
  47. <type>pom</type>
  48.  <scope>import</scope>
  49.  </dependency>
  50.  </dependencies>
  51.  </dependencyManagement>
  52.   
  53.  <build>
  54.  <plugins>
  55.  <plugin>
  56.  <groupId>org.springframework.boot</groupId>
  57.  <artifactId>spring-boot-maven-plugin</artifactId>
  58.  </plugin>
  59.  </plugins>
  60.  </build> 
  61. </project>

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 :

  1. package org.zero.eureka.client;
  2.  
  3.  import org.springframework.boot.SpringApplication;
  4.  import org.springframework.boot.autoconfigure.SpringBootApplication;
  5.  import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
  6.   
  7. @SpringBootApplication
  8. @EnableDiscoveryClient
  9.  public class ClientApplication {
  10.  
  11.  public static void main(String[] args) {
  12.  SpringApplication.run(ClientApplication.class, args);
  13.  }
  14. }

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 :

  1.  eureka: 
  2.       client:
  3.   service-url:
  4.            defaultZone: http://localhost:8761/eureka/
  5.  spring:
  6.    application:
  7.      name: eureka-client
  8.  server:
  9.    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 :

  1.  <dependency>
  2.  <groupId>org.springframework.boot</groupId>
  3.  <artifactId>spring-boot-starter-web</artifactId>
  4.  </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

  1. 【spring boot】 Using annotations @ConfigurationProperties When reading the configuration file Report errors org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name &#39;rocketmqAutoConfiguration&#39;: Unsatisfied dependenc

    As the title , The configuration file is as follows : # Registry configuration eureka: instance: instanceId: ${spring.application.name}:${random.int} hostname: ...

  2. Report errors org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;sessionFactory&#39; 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 ...

  3. 【 Report errors 】org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;webSocketHandlerMapping&#39; 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 ...

  4. Spring AOP Report errors org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;XXXXXX&#39; defined in class path resource..........

    The complete error report is as follows : org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'befo ...

  5. ssh Integration error is serious : Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;xxx&#39;

    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 ...

  6. org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;sessionFactory&#39; 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 ...

  7. aused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;sessionFactory&#39; defined in class path resource [applicationContext.xml]: Invocation of init method fai

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roleDaoImpl' ...

  8. Report errors !!!!!!!!!!!org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named &#39;springSessionRepositoryFilter&#39; 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 ...

  9. 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

  1. 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 ...

  2. 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 ...

  3. 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 . ...

  4. 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 ...

  5. 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 ...

  6. Lunch War with the Donkey CSU - 2084

    Jingze is a big figure in California State University for his stubbornness. Because of his new failu ...

  7. Applet canvas Realize picture preview , pictures saving

    wxml Code : <view class="result-page"> <canvas bindtap="previewImage" canv ...

  8. 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 . ...

  9. 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 ...

  10. 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 ...