1. Problem description
As mentioned above, it is normal to start the Eureka server alone. When you start the micro service module and register the service with Eureka, an error is reported.
My microservice module POM depends on the following:
<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-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.1</version>
</dependency>
</dependencies>
Microservice module configuration file:
eureka.client.service-url.defaultZone=http://localhost:8000/eureka
The total POM of the project is as follows:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</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>Greenwich.SR5</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
2. Solution
See a similar problem on stack overflow:
It is speculated that there may also be a problem with the dependent package under D: \ D1 \ Java \ maven \ repo \ ORG \ Apache \ httpcomponents
According to the time of the file modification date, the following package should be called for the use of Eureka
Delete these folders and reintroduce the POM dependency of microservice module and Eureka server
Start the microservice here and the problem is solved
16:31:17.183- INFO 38700 --- [ main]com.netflix.discovery.DiscoveryClient :Getting all instance registry info from the eureka server
16:31:17.460- INFO 38700 --- [ main]com.netflix.discovery.DiscoveryClient :The response status is 200
16:31:17.462- INFO 38700 --- [ main]com.netflix.discovery.DiscoveryClient :Starting heartbeat executor: renew interval is: 30
16:31:17.465- INFO 38700 --- [ main]c.n.discovery.InstanceInfoReplicator :InstanceInfoReplicator onDemand update allowed rate per min is 4
16:31:17.470- INFO 38700 --- [ main]com.netflix.discovery.DiscoveryClient :Discovery Client initialized at timestamp 1628843477468 with initial instances count: 0
16:31:17.472- INFO 38700 --- [ main]o.s.c.n.e.s.EurekaServiceRegistry :Registering application COURSE-LIST with eureka with status UP
16:31:17.472- INFO 38700 --- [ main]com.netflix.discovery.DiscoveryClient :Saw local status change event StatusChangeEvent [timestamp=1628843477472, current=UP, previous=STARTING]
16:31:17.475- INFO 38700 --- [nfoReplicator-0]com.netflix.discovery.DiscoveryClient :DiscoveryClient_COURSE-LIST/LAPTOP-LMMPH4VI:course-list:8080: registering service...
16:31:17.523- INFO 38700 --- [ main]o.s.b.w.embedded.tomcat.TomcatWebServer :Tomcat started on port(s): 8080 (http) with context path ''
16:31:17.524- INFO 38700 --- [ main].s.c.n.e.s.EurekaAutoServiceRegistration :Updating port to 8080
16:31:17.567- INFO 38700 --- [nfoReplicator-0]com.netflix.discovery.DiscoveryClient :DiscoveryClient_COURSE-LIST/LAPTOP-LMMPH4VI:course-list:8080 - registration status: 204
16:31:19.133- INFO 38700 --- [ main]com.fanyu.course.CourseListApplication :Started CourseListApplication in 13.313 seconds (JVM running for 14.906)
Read More:
- An error is reported in the spring cloud setup. Autowired appears and Eureka cannot be registered
- Common errors reported by Eureka in spring cloud
- Unable to read Scheme Document ‘ http://www.springframework.org/schema/beans/spring-beans-4.1.xsd ‘ [How to Fix]
- ‘dependencies.dependency.version‘ for org.springframework.cloud:spring-cloud-starter-openfeign:jar
- Unable to read scheme document‘ http://www.springframework.org/schema/spring-context.xsd The solution to the problem
- After introducing security, the service cannot be registered with Eureka
- Spring Cloud:org.springframework.web.client.HttpClientErrorException: 404 null
- Eureka failed to register error: saw local status change event statuschangeevent
- Spring cloud is a big hole. Failed to start bean ‘eurekaAutoServiceRegistration’
- The import Maven project appears http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException Solutions
- [Solved] IE Browser Upload Files Error: org.apache.tomcat.util.http.fileupload.FileUploadException: Stream ended unexpectedly
- Solution in idea java.lang.ClassNotFoundException : org.springframework.web . context.ContextLoaderListener
- Spring cloud Alibaba 2020.0.rc1 does not integrate ribbon error reporting unknownhostexception
- The introduction of third-party jar package in mavn project results in classnotfoundexception
- JWT and token + redis scheme of spring security
- SpringCloud GateWay Failed to instantiate [org.springframework.cloud.gateway.discovery.DiscoveryL…
- Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibat
- Apache service can’t be started under xampp, reporting port occupancy class error [error] Apache will not start without the configured ports free!
- [Solved] Import org.apache.hadoop.hbase.hbaseconfiguration package cannot be imported
- Apache2 cannot be started and an error is reported for apache2.service failed because the control process exited with error code.