spring-boot-admin客户端无法启动。我需要做些什么才能使其正常工作?

时间:2019-04-26 07:31:38

标签: spring-boot-admin

我正在基于Spring-boot-admin文档构建一组Spring-boot-admin。管理员服务器可以启动,但管理员客户端不能启动,并且在默认日志级别,它不会显示任何日志。要使其正常工作,我需要怎么做

java版本:11 我试图更改日志级别并解决问题,但是每次发生以下情况

2019-04-26 15:01:13.956 DEBUG 19300 --- [)-192.168.31.39] sun.rmi.server.call                      : RMI TCP Connection(1)-192.168.31.39: [192.168.31.39] exception: 
javax.management.InstanceNotFoundException: org.springframework.boot:type=Admin,name=SpringApplication

在IDEA编辑配置中,我未选中选项中“启用启动优化”和“启用JMX代理”的状态

然后有新问题

2019-04-26 15:14:34.032 TRACE 15844 --- [           main] o.s.boot.diagnostics.FailureAnalyzers    : Failed to load org.springframework.boot.diagnostics.analyzer.ValidationExceptionFailureAnalyzer

java.lang.NoClassDefFoundError: javax/validation/ValidationException
    at java.base/java.lang.Class.getDeclaredConstructors0(Native Method) ~[na:na]
    at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3138) ~[na:na]
    at java.base/java.lang.Class.getConstructor0(Class.java:3343) ~[na:na]
    at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2554) ~[na:na]
    at org.springframework.boot.diagnostics.FailureAnalyzers.loadFailureAnalyzers(FailureAnalyzers.java:76) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
    at org.springframework.boot.diagnostics.FailureAnalyzers.<init>(FailureAnalyzers.java:65) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
    at org.springframework.boot.diagnostics.FailureAnalyzers.<init>(FailureAnalyzers.java:59) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[na:na]
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:172) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:446) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
    at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:429) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:311) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
    at com.mgbronya.adminclient.AdminClientApplication.main(AdminClientApplication.java:10) ~[classes/:na]
Caused by: java.lang.ClassNotFoundException: javax.validation.ValidationException
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) ~[na:na]
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
    ... 18 common frames omitted
2019-04-26 15:14:34.035 TRACE 15844 --- [           main] o.s.boot.diagnostics.FailureAnalyzers    : Failed to load org.springframework.boot.autoconfigure.jdbc.HikariDriverConfigurationFailureAnalyzer

java.lang.NoClassDefFoundError: org/springframework/jdbc/CannotGetJdbcConnectionException
    at java.base/java.lang.Class.getDeclaredConstructors0(Native Method) ~[na:na]
    at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3138) ~[na:na]
    at java.base/java.lang.Class.getConstructor0(Class.java:3343) ~[na:na]
    at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2554) ~[na:na]
    at org.springframework.boot.diagnostics.FailureAnalyzers.loadFailureAnalyzers(FailureAnalyzers.java:76) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
    at org.springframework.boot.diagnostics.FailureAnalyzers.<init>(FailureAnalyzers.java:65) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
    at org.springframework.boot.diagnostics.FailureAnalyzers.<init>(FailureAnalyzers.java:59) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[na:na]
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:172) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:446) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
    at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:429) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:311) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
    at com.mgbronya.adminclient.AdminClientApplication.main(AdminClientApplication.java:10) ~[classes/:na]
Caused by: java.lang.ClassNotFoundException: org.springframework.jdbc.CannotGetJdbcConnectionException
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) ~[na:na]
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
    ... 18 common frames omitted

我添加了“ validation-api”和“ spring-jdbc”,已解决异常 但是admin-client仍然无法启动。

我尝试了前面的代码 管理服务器 pom.xml

    <properties>
        <java.version>11</java.version>
        <spring-boot-admin.version>2.1.4</spring-boot-admin.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-server</artifactId>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>de.codecentric</groupId>
                <artifactId>spring-boot-admin-dependencies</artifactId>
                <version>${spring-boot-admin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

和springboot启动类“ AdminServerApplication.java”添加@EnableAdminServer

addmin-client pom.xml

    <properties>
        <java.version>11</java.version>
        <spring-boot-admin.version>2.1.4</spring-boot-admin.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>de.codecentric</groupId>
                <artifactId>spring-boot-admin-dependencies</artifactId>
                <version>${spring-boot-admin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

application.yml

spring:
  application:
    name: admin-client
  boot:
    admin:
      client:
        url: http://localhost:8080
management:
  endpoints:
    web:
      exposure:
        include: "*"

我希望管理客户端成功启动并绑定到管理服务器,但是管理客户端无法启动

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.4.RELEASE)

2019-04-26 15:27:24.706  INFO 18284 --- [           main] c.m.adminclient.AdminClientApplication   : Starting AdminClientApplication on DESKTOP-N5U2B87 with PID 18284 (F:\SpringCloud\springcloud-10\admin-client\target\classes started by MgBronya in F:\SpringCloud\springcloud-10)
2019-04-26 15:27:24.708  INFO 18284 --- [           main] c.m.adminclient.AdminClientApplication   : No active profile set, falling back to default profiles: default
2019-04-26 15:27:26.103  INFO 18284 --- [           main] c.m.adminclient.AdminClientApplication   : Started AdminClientApplication in 1.757 seconds (JVM running for 2.1)

Process finished with exit code 0

管理员客户端运行完毕。

0 个答案:

没有答案