Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
运行SpringBoot管理应用程序时出错_Spring_Maven_Spring Boot_Spring Boot Admin - Fatal编程技术网

运行SpringBoot管理应用程序时出错

运行SpringBoot管理应用程序时出错,spring,maven,spring-boot,spring-boot-admin,Spring,Maven,Spring Boot,Spring Boot Admin,我正在尝试使用Springboot管理应用程序,但无法使基本功能正常工作 我从最简单的springboot web应用程序开始(使用starter web和starter test),并将springboot管理服务器和springboot管理服务器ui添加到依赖项列表中 <dependencies> <dependency> <groupId>org.springframework.boot</groupId>

我正在尝试使用Springboot管理应用程序,但无法使基本功能正常工作

我从最简单的springboot web应用程序开始(使用starter web和starter test),并将springboot管理服务器和springboot管理服务器ui添加到依赖项列表中

<dependencies>
    <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>


    <!-- Added Dependency for Admin Server and its UI --> 
    <dependency>
        <groupId>de.codecentric</groupId>
        <artifactId>spring-boot-admin-server</artifactId>
        <version>1.4.5</version> 
    </dependency>
    <dependency>
        <groupId>de.codecentric</groupId>
        <artifactId>spring-boot-admin-server-ui</artifactId>
        <version>1.4.5</version> 
    </dependency>


</dependencies>
springboot应用程序完全采用了基本实现(添加了如下所示的EnableAdminServer注释)

我猜发生这个错误是因为这个类(org.springframework.boot.context.embedded.ServletRegistrationBean)已经被org.springframework.boot.web.servlet.ServletRegistrationBean(在1.5.x中)替换,spring boot管理服务器组件可能使用了这个类


我通过切换到Springboot的早期版本(比如1.4.4)来解决这个问题。这样做对吗?或者我在配置中有任何错误吗?

使用1.4.6版的spring boot admin server和spring boot admin server ui而不是1.4.5修复了该问题

Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.embedded.ServletRegistrationBean
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_112]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_112]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_112]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_112]
    ... 51 common frames omitted
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import de.codecentric.boot.admin.config.EnableAdminServer;

    @SpringBootApplication
    @EnableAdminServer
    public class WorkingExampleSpringBootAdminApplication {

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