专栏首页技术进阶之路java.lang.NoSuchMethodError: org.apache.log4j.Logger.isTraceEnabled()Z

java.lang.NoSuchMethodError: org.apache.log4j.Logger.isTraceEnabled()Z

java.lang.NoSuchMethodError: org.apache.log4j.Logger.isTraceEnabled()Z

	at org.apache.ibatis.logging.log4j.Log4jImpl.isTraceEnabled(Log4jImpl.java:42)
	at org.apache.ibatis.logging.jdbc.BaseJdbcLogger.isTraceEnabled(BaseJdbcLogger.java:138)
	at org.apache.ibatis.logging.jdbc.ResultSetLogger.invoke(ResultSetLogger.java:73)
	at com.sun.proxy.$Proxy7.next(Unknown Source)
	at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForSimpleResultMap(DefaultResultSetHandler.java:352)
	at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:328)
	at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:301)
	at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:194)
	at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:65)
	at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
	at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)
	at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
	at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
	at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:147)
	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:80)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
	at com.sun.proxy.$Proxy4.findAll(Unknown Source)
	at top.wsuo.DaoTest.IUserDaoTest(DaoTest.java:31)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

使用 Mybatis 的时候引入了 log4j 报错信息如上。

log4j 文件如下:

# Set root category priority to INFO and its only appender to CONSOLE.
#log4j.rootCategory=INFO, CONSOLE            debug   info   warn error fatal
log4j.rootCategory=debug, CONSOLE, LOGFILE
# Set the enterprise logger category to FATAL and its only appender to CONSOLE.
log4j.logger.org.apache.axis.enterprise=FATAL, CONSOLE
# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} %-6r [%15.15t] %-5p %30.30c %x - %m
# LOGFILE is set to be a File appender using a PatternLayout.
log4j.appender.LOGFILE=org.apache.log4j.FileAppender
log4j.appender.LOGFILE.File=d:axis.log
log4j.appender.LOGFILE.Append=true
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGFILE.layout.ConversionPattern=%d{ISO8601} %-6r [%15.15t] %-5p %30.30c %x - %m

原因是我的 log4j 是最低版本的 1.2.4,解决办法就是升级到 1.2.12+ 的版本。

改成 1.2.14 即可。

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • org.springframework.util.xml.SimpleSaxErrorHandler warning org.xml.sax.SAXParseException; systemId:

    wsuo
  • 网络中子网的划分

    已知 IP 地址是 141.14.72.24,子网掩码是 255.255.192.0。试求网络地址。

    wsuo
  • 线程的基本概念

    有的进程需要同时做很多事,传统的进程只能串行地执行程序,所以引入了线程来增加并发度。

    wsuo
  • mybatis连接oracle

    原因:oracle jdbc并不能向mysql那样直接配置,原因是Oracle授权问题,Maven不提供oracle JDBC driver,需要手动配置下,这...

    微醺
  • 容器打印日志到控制台阻塞的排障

    今日生产环境发现有些容器停止响应了,但是容器没有死,docker exec -it <container-name> /bin/bash也能正常使用。

    颇忒脱
  • BindingException: Parameter 'XXX' not found. Available parameters are [collection, list]

    应业务需求,需要使用到MQ进行数据上传和下发。传递格式为JSON,服务那边下发JSON数组,接收端将JSON数组转换成List集合,调用Mybatis-plus...

    Jacob丶
  • java.lang.OutOfMemoryError: Java heap space

    这个服务本来是rpc提供方,但是消费端经常用着用着就说没有provider,期初没注意同事说重启下就好了,确实管用,但后来能用时间越来越少,重启后只能管几分钟,...

    MickyInvQ
  • hadoop出现ava.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonMappingException

    到你的下载的hadoop所在版本的lib包中引入jackson-core-asl-1.8.8.jar   和   jackson-mapper-asl-1.8...

    用户5166556
  • 聊聊hikari与tomcat jdbc pool的fail fast

    本文主要研究在中途数据库挂的情况下,hikari与tomcat jdbc pool的fail fast情况。

    codecraft
  • 关于禁止使用Executors创建线程池的分析

    线程池不允许使用Executors去创建,而是通过ThreadPoolExecutor的方式,这样的处理方式让写的同学更加明确线程池的运行规则,规避资源耗尽的风...

    冬天里的懒猫

扫码关注云+社区

领取腾讯云代金券