zoukankan      html  css  js  c++  java
  • 启动spring boot 异常

      再我搭建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>
  • 相关阅读:
    Ubuntu 中软件的安装、卸载以及查看的方法总结
    无锁队列的环形数组实现
    Geodatabase模型
    地图投影与ArcGIS坐标系转换
    ARCGIS动态画点
    ArcEngine数据删除几种方法和性能比较
    AE开发技术文档--8种数据访问方法
    Hibernate 的HQL和sql有什么区别
    ActionContextCleanUp作用
    Hibernate延迟加载与opensessioninviewFilter
  • 原文地址:https://www.cnblogs.com/zhangXingSheng/p/7606260.html
Copyright © 2011-2022 走看看