log4j2 出现 Could not load [org.apache.logging.log4j.core.impl.Log4jLogEvent$Builder]

最近看日志忽然发现,log4j报如下错误。

31-Aug-2017 11:00:00.012 INFO [Log4j2-Log4j2Scheduled-1] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading Illegal access: this web application instance has been stopped already. 
Could not load [org.apache.logging.log4j.core.impl.Log4jLogEvent$Builder]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
 java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. 
Could not load [org.apache.logging.log4j.core.impl.Log4jLogEvent$Builder]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
Log4j2-Log4j2Scheduled-1 ERROR Error running command java.lang.NoClassDefFoundError: org/apache/logging/log4j/core/impl/Log4jLogEvent$Builder
    at org.apache.logging.log4j.core.appender.rolling.PatternProcessor.formatFileName(PatternProcessor.java:208)
    at org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy.purgeAscending(DefaultRolloverStrategy.java:296)
    at org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy.purge(DefaultRolloverStrategy.java:279)
    at org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy.rollover(DefaultRolloverStrategy.java:506)
    at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.rollover(RollingFileManager.java:196)
    at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.rollover(RollingFileManager.java:124)
    at org.apache.logging.log4j.core.appender.rolling.CronTriggeringPolicy$CronTrigger.run(CronTriggeringPolicy.java:127)
    at org.apache.logging.log4j.core.config.ConfigurationScheduler$CronRunnable.run(ConfigurationScheduler.java:173)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

后来查了一下资料,原来是因为项目重新启动时,tomcat进程没有完全关闭引起的。

所以用ps -ef | grep [tomcat名字]
将相关tomcat 的进程kill 掉。
重新启动就可以了。

如果觉得文章真心好, 请打赏下我吧http://blog.csdn.net/assassinsshadow/article/details/76086401

你可能感兴趣的:(java,log4j,JAVA)