ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

java-Spring-Boot-Admin服务器无法从Eureka注册表中注册客户端

2019-11-09 02:20:12  阅读:13  来源: 互联网

标签:spring-boot-admin spring-boot spring java



我刚刚从Initializr创建了一个新的Spring-Boot-Admin项目,并按照此处的指示进行操作:http://codecentric.github.io/spring-boot-admin/2.0.0/

这是我的课:

@Configuration
@EnableAutoConfiguration
@EnableDiscoveryClient
@EnableAdminServer
public class ServiceAdminApplication {

    public static void main(String[] args) {
        SpringApplication.run(ServiceAdminApplication.class, args);
    }
}

这是我的属性文件:

eureka.instance.leaseRenewalIntervalInSeconds=10
eureka.instance.health-check-url-path=/actuator/health
eureka.client.registryFetchIntervalSeconds=5
eureka.client.serviceUrl.defaultZone=http://my.eureka.url:8580/eureka/

management.endpoints.web.exposure.include=*  
management.endpoint.health.show-details=ALWAYS

我有一个有效的Eureka注册表,其中注册了许多Spring-Boot应用程序.我知道这是有效的,因为他们能够找到彼此并通过Eureka注册表进行通信.

当我启动新的SBA应用程序时,我可以看到它在Eureka注册表中进行了注册,因此可以找到Eureka.但是,当我打开SBA UI时,它是空的,只是说“没有注册应用程序”.在控制台上,我可以一遍又一遍地看到以下堆栈跟踪.

java.io.IOException: An established connection was aborted by the
software in your host machine at
sun.nio.ch.SocketDispatcher.write0(Native Method) ~[na:1.8.0_151] at
sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51)
~[na:1.8.0_151] at
sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
~[na:1.8.0_151] at sun.nio.ch.IOUtil.write(IOUtil.java:65)
~[na:1.8.0_151] at
sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
~[na:1.8.0_151] at
org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:134)
~[tomcat-embed-core-8.5.31.jar:8.5.31] at
org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:101)
~[tomcat-embed-core-8.5.31.jar:8.5.31] at
org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:157)
~[tomcat-embed-core-8.5.31.jar:8.5.31] at
org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1276)
~[tomcat-embed-core-8.5.31.jar:8.5.31] at
org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:670)
~[tomcat-embed-core-8.5.31.jar:8.5.31] at
org.apache.tomcat.util.net.SocketWrapperBase.flushBlocking(SocketWrapperBase.java:607)
~[tomcat-embed-core-8.5.31.jar:8.5.31] at
org.apache.tomcat.util.net.SocketWrapperBase.flush(SocketWrapperBase.java:597)
~[tomcat-embed-core-8.5.31.jar:8.5.31] at
org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.flush(Http11OutputBuffer.java:646)
~[tomcat-embed-core-8.5.31.jar:8.5.31] at
org.apache.coyote.http11.filters.ChunkedOutputFilter.flush(ChunkedOutputFilter.java:169)
~[tomcat-embed-core-8.5.31.jar:8.5.31] at
org.apache.coyote.http11.Http11OutputBuffer.flush(Http11OutputBuffer.java:252)
~[tomcat-embed-core-8.5.31.jar:8.5.31] at
org.apache.coyote.http11.Http11Processor.flush(Http11Processor.java:1564)
~[tomcat-embed-core-8.5.31.jar:8.5.31] at
org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:352)
~[tomcat-embed-core-8.5.31.jar:8.5.31] at
org.apache.coyote.Response.action(Response.java:173)
~[tomcat-embed-core-8.5.31.jar:8.5.31] at
org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:317)
~[tomcat-embed-core-8.5.31.jar:8.5.31] at
org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:284)
~[tomcat-embed-core-8.5.31.jar:8.5.31] at
org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:118)
~[tomcat-embed-core-8.5.31.jar:8.5.31] at
sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:297)
~[na:1.8.0_151] at
sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141) ~[na:1.8.0_151]
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
~[na:1.8.0_151] at
org.springframework.util.StreamUtils.copy(StreamUtils.java:121)
~[spring-core-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter.java:103)
~[spring-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.http.converter.StringHttpMessageConverter.writeInternal(StringHttpMessageConverter.java:43)
~[spring-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:224)
~[spring-web-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitterReturnValueHandler$HttpMessageConvertingHandler.sendInternal(ResponseBodyEmitterReturnValueHandler.java:199)
~[spring-webmvc-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitterReturnValueHandler$HttpMessageConvertingHandler.send(ResponseBodyEmitterReturnValueHandler.java:189)
~[spring-webmvc-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.sendInternal(ResponseBodyEmitter.java:189)
~[spring-webmvc-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter.send(ResponseBodyEmitter.java:183)
~[spring-webmvc-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.web.servlet.mvc.method.annotation.SseEmitter.send(SseEmitter.java:133)
~[spring-webmvc-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.web.servlet.mvc.method.annotation.ReactiveTypeHandler$SseEmitterSubscriber.send(ReactiveTypeHandler.java:341)
~[spring-webmvc-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
org.springframework.web.servlet.mvc.method.annotation.ReactiveTypeHandler$AbstractEmitterSubscriber.run(ReactiveTypeHandler.java:283)
~[spring-webmvc-5.0.6.RELEASE.jar:5.0.6.RELEASE] at
java.lang.Thread.run(Thread.java:748) [na:1.8.0_151]

解决方法:

有关joshiste答案的更多详细信息.

将依赖项版本更改为2.0.1-SNAPSHOT:

<dependency>
    <groupId>de.codecentric</groupId>
    <artifactId>spring-boot-admin-starter-server</artifactId>
    <version>2.0.1-SNAPSHOT</version>
</dependency>

添加存储库元素:

<repositories>
    <repository>
        <id>sonatype-nexus-snapshots</id>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>                        
        <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    </repository>
</repositories>


标签:spring-boot-admin,spring-boot,spring,java

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有