org.slf4j.helpers.NOPLoggerFactory无法转换为ch.qos.logback.classic.LoggerContext [英] org.slf4j.helpers.NOPLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext

查看:765
本文介绍了org.slf4j.helpers.NOPLoggerFactory无法转换为ch.qos.logback.classic.LoggerContext的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在maven(m2e)中使用logback时,出现以下错误.环境:JBOSS 7.1.1,maven,eclipse.但是,如果我只是作为主类单独运行,它会很好地工作.我不知道为什么会收到此错误,任何人都可以帮助我解决此问题并找到解决方案.

I get the following error when i use logback in maven (m2e).Environment: JBOSS 7.1.1,maven,eclipse. But it work fine if i just run individually as main class. I couldn't figure out why i am getting this error, can anyone help me troubleshooting this issue and find a solution for it.

17:24:23,675 ERROR [stderr] java.lang.ClassCastException: org.slf4j.helpers.NOPLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext 

17:24:23,681 ERROR [stderr] at com.zreflect.emyed.whiteboard.pubsub.EventLoggerAsync.logStart(EventLoggerAsync.java:116) 

17:24:23,683 ERROR [stderr] at com.zreflect.emyed.whiteboard.pubsub.EventLoggerAsync.onDisconnect(EventLoggerAsync.java:62) 

17:24:23,684 ERROR [stderr] at org.atmosphere.cpr.AtmosphereResourceImpl.onDisconnect(AtmosphereResourceImpl.java:817) 

17:24:23,686 ERROR [stderr] at org.atmosphere.cpr.AtmosphereResourceImpl.notifyListeners(AtmosphereResourceImpl.java:761) 

17:24:23,688 ERROR [stderr] at org.atmosphere.cpr.AtmosphereResourceImpl.notifyListeners(AtmosphereResourceImpl.java:742) 

17:24:23,690 ERROR [stderr] at org.atmosphere.cpr.AsynchronousProcessor.cancelled(AsynchronousProcessor.java:601) 

17:24:23,691 ERROR [stderr] at org.atmosphere.container.BlockingIOCometSupport.cancelled(BlockingIOCometSupport.java:172) 

17:24:23,693 ERROR [stderr] at org.atmosphere.cpr.AsynchronousProcessor$1.run(AsynchronousProcessor.java:119) 

17:24:23,694 ERROR [stderr] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) 

17:24:23,696 ERROR [stderr] at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) 

17:24:23,698 ERROR [stderr] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) 

17:24:23,699 ERROR [stderr] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) 

17:24:23,703 ERROR [stderr] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180) 

17:24:23,707 ERROR [stderr] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204) 

17:24:23,715 ERROR [stderr] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 

17:24:23,716 ERROR [stderr] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 

17:24:23,718 ERROR [stderr] at java.lang.Thread.run(Thread.java:662)

推荐答案

该错误表明com.zreflect.emyed.whiteboard.pubsub.EventLoggerAsync类期望使用ch.qos.logback.classic.LoggerContext,而获得了org.slf4j.helpers.NOPLoggerFactory.当某些代码试图转换org.slf4j.LoggerFactory.getILoggerFactory的返回值并且slf4j绑定到NOP实现时,通常会发生这种情况,因为在类路径上没有slf4j绑定.这通常伴随错误消息.

The error indicates that com.zreflect.emyed.whiteboard.pubsub.EventLoggerAsync class is expecting a ch.qos.logback.classic.LoggerContext, instead it obtains a org.slf4j.helpers.NOPLoggerFactory. This usually occurs when some code tries to cast the return value of org.slf4j.LoggerFactory.getILoggerFactory and slf4j is bound to the NOP implementation because no slf4j binding was available on the class path. This is usually accompanied by an error message.

这篇关于org.slf4j.helpers.NOPLoggerFactory无法转换为ch.qos.logback.classic.LoggerContext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆