码迷,mamicode.com
首页 > 编程语言 > 详细

启动spring boot 异常

时间:2017-09-28 14:12:15      阅读:258      评论:0      收藏:0      [点我收藏+]

标签:factory   repos   hang   thread   log   rom   cep   object   depend   

  再我搭建spring boot工程后,run application的时候抛出下面异常

 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 loaded from file:/Users/zhangxs/.m2/repository/org/slf4j/slf4j-log4j12/1.7.13/slf4j-log4j12-1.7.13.jar). If you are using WebLogic you will need to add org.slf4j to prefer-application-packages in WEB-INF/weblogic.xml Object of class [org.slf4j.impl.Log4jLoggerFactory] must be an instance of class ch.qos.logback.classic.LoggerContext

 

我在repostory 里删除slf4j-log4j12-1.7.13.jar 这个jar包后,确实是可以运行的,
slf4j是公司的jar里依赖的jar.所以就只能对自己的工程做配置。
解决方法:
在spring -boot- starter和spring -boot-starter- web上添加排斥来解决冲突。
<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <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</artifactId>
              <exclusions>
                <exclusion>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-logging</artifactId>
               </exclusion>
         </exclusions>
</dependency>

 

启动spring boot 异常

标签:factory   repos   hang   thread   log   rom   cep   object   depend   

原文地址:http://www.cnblogs.com/zhangXingSheng/p/7606260.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!