我尝试使用spring-boot-admin,但是一个问题让我很困惑。
我构建了两个spring boot应用程序,一个是admin服务器,另一个是admin客户端。 Fllowed Spring Boot Admin Reference Guide,我确认了参考属性,然后管理服务器和客户端应用程序都成功运行。
但过了一会儿,我发现管理员客户端应用程序的状态已经关闭,并且在控制台日志信息中就像是:
2017-03-10 15:07:06.830 WARN 12960 --- [registrationTask1] d.c.b.a.services.ApplicationRegistrator:
Failed to register application as Application [id=null, name=ERP Basic Management Module, managementUrl=http://PC-PC:8081/basicManage,
healthUrl=http://PC-PC:8081/basicManage/health, serviceUrl=http://PC-PC:8081/basicManage] at spring-boot-admin ([http://localhost:8999/api/applications]):
I/O error on POST request for "http://localhost:8999/api/applications": Connection refused: connect;
nested exception is java.net.ConnectException: Connection refused: connect
我不知道为什么。但过了一会儿,客户端应用程序的状态再次出现了!我什么都没做!此后我很困惑。关于春季启动管理员的期刊如下所示:
我的管理服务器应用程序的配置如下:
application.properties
server.port=8999
spring.application.name=Spring Boot Admin Web
spring.boot.admin.url=http://localhost:${server.port}
Maven的pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.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.7</java.version>
<spring.boot.admin.version>1.4.6</spring.boot.admin.version>
</properties>
<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>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server</artifactId>
<version>${spring.boot.admin.version}</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>${spring.boot.admin.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
我的管理客户端应用程序的配置如下:
application.properties
## EMBEDDED SERVER CONFIGURATION
server.context-path=/basicManage
server.port=8081
# spring boot admin
spring.boot.admin.url=http://localhost:8999
spring.application.name=ERP Basic Management Module
Maven的pom.xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.4.RELEASE</version>
</parent>
<properties>
<spring.boot.admin.version>1.4.6</spring.boot.admin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>${spring.boot.admin.version}</version>
</dependency>
<dependency>
<groupId>org.jolokia</groupId>
<artifactId>jolokia-core</artifactId>
</dependency>
</dependencies>
答案 0 :(得分:1)
当您拒绝连接时,服务器无法建立网络连接。这可能是因为您的网络出现故障或达到了最大连接限制,也可能是因为其他地方的问题。
Fallacies of distributed Computing