spring3,unitils 与dbunit整合问题记录

落花浮王杯 提交于 2019-12-03 12:47:03

unitils 3.3版本,spring3.2.4

1.Caused by: java.lang.IllegalStateException: org.slf4j.LoggerFactory could not be successfully initialized. See also http://www.slf4j.org/codes.html#unsuccessfulInit

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/E:/user/.m2/repository/org/slf4j/slf4j-nop/1.4.3/slf4j-nop-1.4.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/E:/user/.m2/repository/org/slf4j/slf4j-log4j12/1.7.5/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding.
SLF4J: Your binding is version 1.5.5 or earlier.
SLF4J: Upgrade your binding to version 1.6.x.

和日志有关,日志可以正常打,但使用unitils跑安全失败报如上错,原因是unitils 3.3依赖的dbunit2.2.2加载slf4j版本有兼容问题,升级dbunit版本可解决

注:slf4j-api,slf4j-log4j12使用的1.7.5,log4j使用1.2.17

2.Caused by: org.dbunit.dataset.NoSuchColumnException: t_user.ID -  (Non-uppercase input column: id) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive.

unitils 3.3默认依赖dbunit2.2.2会报如上问题,网上查了说是bug说要改源码或者换dbunit2.4.2,不想改源码,换2.4.2不行,dbunit换当前最新的版本2.4.9也不行,最后试了一下前几个版本2.4.X版本中,只有2.4.3可以,其它都不行,问题搞定

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!