您当前的位置: 首页 >  spring boot

暂无认证

  • 0浏览

    0关注

    92582博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Spring Boot项目升级:1.5.22升级至2.x的运行阶段问题总结

发布时间:2020-09-05 07:03:47 ,浏览量:0

这篇文章继续介绍Spring Boot 1.5.22升级至2.x在运行阶段一部分可能会出先的问题。

目录
    • 日志模块冲突
      • 现象
      • 原因
      • 对应方法
    • 缺少joda
      • 现象
      • 原因
      • 对应方法
    • 新旧依赖混杂导致的问题
      • 现象
      • 原因
      • 对应
      • 现象
      • 原因
      • 对应方法
    • Redis问题
      • 现象
      • 原因
      • 对应
    • CookieHttpSessionStrategy和HttpSessionStrategy
      • 现象
      • 原因
      • 对应方法
日志模块冲突 现象
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/liumiao/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.13.3/log4j-slf4j-impl-2.13.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/liumiao/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Exception in thread "main" java.lang.ExceptionInInitializerError
	at com.XXXXXXXXX.main(YYYYYYYY.java:33)
Caused by: org.apache.logging.log4j.LoggingException: log4j-slf4j-impl cannot be present with log4j-to-slf4j
	at org.apache.logging.slf4j.Log4jLoggerFactory.validateContext(Log4jLoggerFactory.java:49)
	at org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:39)
	at org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:30)
	at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:54)
	at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:30)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:363)
	at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:155)
	at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:273)
	at org.springframework.boot.SpringApplication.(SpringApplication.java:196)
	... 1 more
原因

写的已经很清楚了,log4j-slf4j-impl cannot be present with log4j-to-slf4j,Spring自带的项目使用的冲突了。

对应方法

将Spring自带的冲突了,可在depencency中进行排除,在pom中如下设定即可

<dependency> <groupId>org.springframework.boot            
关注
打赏
1653961664
查看更多评论
立即登录/注册

微信扫码登录

0.7198s