无法启动Spring Boot服务器 [英] Unable to start spring boot server

查看:188
本文介绍了无法启动Spring Boot服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Spring Boot的新手,当我尝试启动服务器时,出现以下异常.我知道这与依赖项冲突有关,但仍然无法解决.我正在使用maven管理我的依赖项.请帮助

I am new to spring boot and when I try to start my server , I get the following Exception. I understand that this has something to do with dependency conflict, but still unable to figure it out.I am using maven to manage my dependencies.Please help

 Exception in thread "main" java.lang.IllegalArgumentException:
 LoggerFactory is not a Logback LoggerContext but Logback is on the
 classpath. Either remove Logback or the competing implementation
 (class org.slf4j.impl.Log4jLoggerFactory) Object of class
 [org.slf4j.impl.Log4jLoggerFactory] must be an instance of class
 ch.qos.logback.classic.LoggerContext   at
 org.springframework.util.Assert.isInstanceOf(Assert.java:339)  at
 org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:93)
        at
org.springframework.boot.logging.AbstractLoggingSystem.initializeWithSensibleDefaults(AbstractLoggingSystem.java:62)
        at

 org.springframework.boot.logging.AbstractLoggingSystem.beforeInitialize(AbstractLoggingSystem.java:45)
    at

org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:69)
    at

 org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:135)
    at

 org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98)
    at

 org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:100)
    at

 org.springframework.boot.context.event.EventPublishingRunListener.started(EventPublishingRunListener.java:54)
    at

 org.springframework.boot.SpringApplication.run(SpringApplication.java:276)
    at

 org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
    at

 org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
    at org.magnum.mobilecloud.video.Application.main(Application.java:30)

已解决:将以下内容添加到POM.xml

Resolved:Add the following to the POM.xml

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>
            <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
    </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-log4j</artifactId>
    </dependency>

推荐答案

spring-boot-starter-web 中排除 logback-classic spring-boot-starter-actuator 为我工作

compile("org.springframework.boot:spring-boot-starter-web:1.1.10.RELEASE") {
    exclude module: "spring-boot-starter-tomcat"
    exclude module: "spring-boot-starter-logging"
    exclude module: "logback-classic"
}
compile("org.springframework.boot:spring-boot-starter-actuator:1.1.10.RELEASE") {
    exclude module: "logback-classic"
}

这篇关于无法启动Spring Boot服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆