Hibernate 5 测试的时候日志错误

运行 Hibernate 测试的时候错误提示:

log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.

java.lang.NoSuchFieldError: TRACE

  at org.jboss.logging.Log4jLogger.translate(Log4jLogger.java:55)
  at org.jboss.logging.Log4jLogger.isEnabled(Log4jLogger.java:35)
  at org.jboss.logging.Logger.isTraceEnabled(Logger.java:98)
  at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.registerStrategyImplementor(StrategySelectorImpl.java:69)
  at org.hibernate.boot.registry.selector.internal.StrategySelectorBuilder.addDialect(StrategySelectorBuilder.java:251)
  at org.hibernate.boot.registry.selector.internal.StrategySelectorBuilder.addDialects(StrategySelectorBuilder.java:198)
  at org.hibernate.boot.registry.selector.internal.StrategySelectorBuilder.buildSelector(StrategySelectorBuilder.java:163)
  at org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:232)
  at org.hibernate.cfg.Configuration.<init>(Configuration.java:118)
  at com.ossez.covid19.common.Factory.initSession(Factory.java:96)
  at com.ossez.covid19.common.Factory.getFactory(Factory.java:85)
  at com.ossez.covid19.common.Factory.getSession(Factory.java:75)
  at com.ossez.covid19.common.Factory.beginTransaction(Factory.java:111)
  at com.ossez.covid19.tests.Covid19Test.setUp(Covid19Test.java:42)
  at junit.framework.TestCase.runBare(TestCase.java:132)
  at junit.framework.TestResult$1.protect(TestResult.java:110)
  at junit.framework.TestResult.runProtected(TestResult.java:128)
  at junit.framework.TestResult.run(TestResult.java:113)
  at junit.framework.TestCase.run(TestCase.java:124)
  at junit.framework.TestSuite.runTest(TestSuite.java:243)
  at junit.framework.TestSuite.run(TestSuite.java:238)
  at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
  at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
  at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
  at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
  at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
  at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)


Process finished with exit code -1

 


 

这个情况应该是你的依赖中没有 log4j

如果你使用的是 Gradle 的话请添加:

Add org.apache.logging.log4j:log4j-core:2.13.1 到 依赖中。

请参考: OSSEZ-44 - Covid19Test 运行出现日志错误 In Progress

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

HoneyMoose

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值