这个bug困扰我已经三四天了,百度了很多答案,下面5条是我已经尝试过的解决方案,但是依然没有解决问题,希望各位大佬帮我看看。
1.在application.yml配置文件中,设置
register-with-eureka: false
fetch-registry: false
2.将
serviceUrl:
defaultZone: http://127.0.0.1:${server.port}/eureka
修改为
service-url:
defaultZone: http://127.0.0.1:${server.port}/eureka
3.删除项目目录中的target目录,并执行maven命令 compile
4.执行Reimport All Maven Projects 重新导入maven项目
5.执行File-Invalidate Caches/Restart… 清除项目缓存
在我调试过程中遇到的问题
1.虽然我修改了注册的端口号为10086,但是没有执行
2.错误信息依旧是这几条
2020-01-25 16:45:42.407 ERROR 15948 --- [ main] c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error
com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect
Caused by: java.net.ConnectException: Connection refused: connect
2020-01-25 16:45:42.407 WARN 15948 --- [ main] c.n.d.s.t.d.RetryableEurekaHttpClient : Request execution failed with message: java.net.ConnectException: Connection refused: connect
2020-01-25 16:45:42.407 ERROR 15948 --- [ main] com.netflix.discovery.DiscoveryClient : DiscoveryClient_UNKNOWN/LAPTOP-LGNJSD1H - was unable to refresh its cache! status = Cannot execute request on any known server
com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
2020-01-25 16:45:42.407 WARN 15948 --- [ main] com.netflix.discovery.DiscoveryClient : Using default backup registry implementation which does not do anything.
这是我启动类的代码
package com.leyou;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class LeyouRegistryApplication {
public static void main(String[] args) {
SpringApplication.run(LeyouRegistryApplication.class, args);
}
}
pom文件代码
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>leyou</artifactId>
<groupId>com.leyou.parent</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.leyou.registry</groupId>
<artifactId>leyou-registry</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
</dependencies>
</project>
application.yml代码
server:
port: 10086
spring:
application:
name: leyou-registry
eureka:
client:
serviceUrl:
defaultZone: http://127.0.0.1:${server.port}/eureka
register-with-eureka: false # 把自己注册到eureka服务列表
fetch-registry: false # 拉取eureka服务信息
server:
enable-self-preservation: false # 关闭自我保护
eviction-interval-timer-in-ms: 5000 # 每隔5秒钟,进行一次服务列表的清理
这是运行结果
D:\JDK\bin\java.exe -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:D:\IDEA\IntelliJ IDEA 2019.3.1\lib\idea_rt.jar=52838:D:\IDEA\IntelliJ IDEA 2019.3.1\bin" -Dfile.encoding=UTF-8 -classpath "D:\JDK\jre\lib\charsets.jar;D:\JDK\jre\lib\deploy.jar;D:\JDK\jre\lib\ext\access-bridge-64.jar;D:\JDK\jre\lib\ext\cldrdata.jar;D:\JDK\jre\lib\ext\dnsns.jar;D:\JDK\jre\lib\ext\jaccess.jar;D:\JDK\jre\lib\ext\jfxrt.jar;D:\JDK\jre\lib\ext\localedata.jar;D:\JDK\jre\lib\ext\nashorn.jar;D:\JDK\jre\lib\ext\sunec.jar;D:\JDK\jre\lib\ext\sunjce_provider.jar;D:\JDK\jre\lib\ext\sunmscapi.jar;D:\JDK\jre\lib\ext\sunpkcs11.jar;D:\JDK\jre\lib\ext\zipfs.jar;D:\JDK\jre\lib\javaws.jar;D:\JDK\jre\lib\jce.jar;D:\JDK\jre\lib\jfr.jar;D:\JDK\jre\lib\jfxswt.jar;D:\JDK\jre\lib\jsse.jar;D:\JDK\jre\lib\management-agent.jar;D:\JDK\jre\lib\plugin.jar;D:\JDK\jre\lib\resources.jar;D:\JDK\jre\lib\rt.jar;D:\IDEA Project\leyou\target\classes;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\cloud\spring-cloud-starter-netflix-eureka-server\2.0.2.RELEASE\spring-cloud-starter-netflix-eureka-server-2.0.2.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\cloud\spring-cloud-starter\2.0.2.RELEASE\spring-cloud-starter-2.0.2.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\boot\spring-boot-starter\2.0.7.RELEASE\spring-boot-starter-2.0.7.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\boot\spring-boot\2.0.7.RELEASE\spring-boot-2.0.7.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\spring-context\5.0.11.RELEASE\spring-context-5.0.11.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\boot\spring-boot-autoconfigure\2.0.7.RELEASE\spring-boot-autoconfigure-2.0.7.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\boot\spring-boot-starter-logging\2.0.7.RELEASE\spring-boot-starter-logging-2.0.7.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\apache\logging\log4j\log4j-to-slf4j\2.10.0\log4j-to-slf4j-2.10.0.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\apache\logging\log4j\log4j-api\2.10.0\log4j-api-2.10.0.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\spring-core\5.0.11.RELEASE\spring-core-5.0.11.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\spring-jcl\5.0.11.RELEASE\spring-jcl-5.0.11.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\yaml\snakeyaml\1.19\snakeyaml-1.19.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\cloud\spring-cloud-context\2.0.2.RELEASE\spring-cloud-context-2.0.2.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\security\spring-security-crypto\5.0.10.RELEASE\spring-security-crypto-5.0.10.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\cloud\spring-cloud-commons\2.0.2.RELEASE\spring-cloud-commons-2.0.2.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\security\spring-security-rsa\1.0.7.RELEASE\spring-security-rsa-1.0.7.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\bouncycastle\bcpkix-jdk15on\1.60\bcpkix-jdk15on-1.60.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\bouncycastle\bcprov-jdk15on\1.60\bcprov-jdk15on-1.60.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\cloud\spring-cloud-netflix-eureka-server\2.0.2.RELEASE\spring-cloud-netflix-eureka-server-2.0.2.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\boot\spring-boot-starter-web\2.0.7.RELEASE\spring-boot-starter-web-2.0.7.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\boot\spring-boot-starter-json\2.0.7.RELEASE\spring-boot-starter-json-2.0.7.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.7\jackson-datatype-jdk8-2.9.7.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.7\jackson-datatype-jsr310-2.9.7.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.7\jackson-module-parameter-names-2.9.7.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\boot\spring-boot-starter-tomcat\2.0.7.RELEASE\spring-boot-starter-tomcat-2.0.7.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.35\tomcat-embed-core-8.5.35.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.35\tomcat-embed-el-8.5.35.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.35\tomcat-embed-websocket-8.5.35.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\hibernate\validator\hibernate-validator\6.0.13.Final\hibernate-validator-6.0.13.Final.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\spring-web\5.0.11.RELEASE\spring-web-5.0.11.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\spring-beans\5.0.11.RELEASE\spring-beans-5.0.11.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\spring-webmvc\5.0.11.RELEASE\spring-webmvc-5.0.11.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\spring-aop\5.0.11.RELEASE\spring-aop-5.0.11.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\spring-expression\5.0.11.RELEASE\spring-expression-5.0.11.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\boot\spring-boot-starter-actuator\2.0.7.RELEASE\spring-boot-starter-actuator-2.0.7.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\boot\spring-boot-actuator-autoconfigure\2.0.7.RELEASE\spring-boot-actuator-autoconfigure-2.0.7.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\boot\spring-boot-actuator\2.0.7.RELEASE\spring-boot-actuator-2.0.7.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\io\micrometer\micrometer-core\1.0.8\micrometer-core-1.0.8.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\hdrhistogram\HdrHistogram\2.1.10\HdrHistogram-2.1.10.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\latencyutils\LatencyUtils\2.0.3\LatencyUtils-2.0.3.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\boot\spring-boot-starter-freemarker\2.0.7.RELEASE\spring-boot-starter-freemarker-2.0.7.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\freemarker\freemarker\2.3.28\freemarker-2.3.28.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\spring-context-support\5.0.11.RELEASE\spring-context-support-5.0.11.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\cloud\spring-cloud-netflix-core\2.0.2.RELEASE\spring-cloud-netflix-core-2.0.2.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\boot\spring-boot-starter-aop\2.0.7.RELEASE\spring-boot-starter-aop-2.0.7.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\aspectj\aspectjweaver\1.8.13\aspectjweaver-1.8.13.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\springframework\cloud\spring-cloud-netflix-eureka-client\2.0.2.RELEASE\spring-cloud-netflix-eureka-client-2.0.2.RELEASE.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\netflix\eureka\eureka-client\1.9.3\eureka-client-1.9.3.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\codehaus\jettison\jettison\1.3.7\jettison-1.3.7.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\stax\stax-api\1.0.1\stax-api-1.0.1.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\netflix\netflix-commons\netflix-eventbus\0.3.0\netflix-eventbus-0.3.0.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\netflix\netflix-commons\netflix-infix\0.3.0\netflix-infix-0.3.0.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\commons-jxpath\commons-jxpath\1.3\commons-jxpath-1.3.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\joda-time\joda-time\2.9.9\joda-time-2.9.9.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\antlr\antlr-runtime\3.4\antlr-runtime-3.4.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\antlr\stringtemplate\3.2.1\stringtemplate-3.2.1.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\google\code\gson\gson\2.8.5\gson-2.8.5.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\apache\commons\commons-math\2.2\commons-math-2.2.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\javax\ws\rs\jsr311-api\1.1.1\jsr311-api-1.1.1.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\netflix\servo\servo-core\0.12.21\servo-core-0.12.21.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\sun\jersey\jersey-core\1.19.1\jersey-core-1.19.1.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\sun\jersey\jersey-client\1.19.1\jersey-client-1.19.1.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\sun\jersey\contribs\jersey-apache-client4\1.19.1\jersey-apache-client4-1.19.1.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\apache\httpcomponents\httpclient\4.5.6\httpclient-4.5.6.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\apache\httpcomponents\httpcore\4.4.10\httpcore-4.4.10.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\commons-codec\commons-codec\1.11\commons-codec-1.11.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\google\inject\guice\4.1.0\guice-4.1.0.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\github\vlsi\compactmap\compactmap\1.2.1\compactmap-1.2.1.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\github\andrewoma\dexx\dexx-collections\0.2\dexx-collections-0.2.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\fasterxml\jackson\core\jackson-core\2.9.7\jackson-core-2.9.7.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\fasterxml\jackson\core\jackson-databind\2.9.7\jackson-databind-2.9.7.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\sun\jersey\jersey-servlet\1.19.1\jersey-servlet-1.19.1.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\sun\jersey\jersey-server\1.19.1\jersey-server-1.19.1.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\netflix\eureka\eureka-core\1.9.3\eureka-core-1.9.3.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\codehaus\woodstox\woodstox-core-asl\4.4.1\woodstox-core-asl-4.4.1.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\netflix\archaius\archaius-core\0.7.6\archaius-core-0.7.6.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\google\code\findbugs\jsr305\3.0.1\jsr305-3.0.1.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\google\guava\guava\16.0\guava-16.0.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\javax\inject\javax.inject\1\javax.inject-1.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\fasterxml\jackson\dataformat\jackson-dataformat-xml\2.9.7\jackson-dataformat-xml-2.9.7.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\fasterxml\jackson\module\jackson-module-jaxb-annotations\2.9.7\jackson-module-jaxb-annotations-2.9.7.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\org\codehaus\woodstox\stax2-api\3.1.4\stax2-api-3.1.4.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\fasterxml\woodstox\woodstox-core\5.0.3\woodstox-core-5.0.3.jar;D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\repository\com\thoughtworks\xstream\xstream\1.4.10\xstream-1.4.10.jar;D:\ap