5

当我在 maven (m2e) 中使用 logback 时出现以下错误。Environment: JBOSS 7.1.1,maven,eclipse。但如果我只是作为主类单独运行,它就可以正常工作。我无法弄清楚为什么会出现此错误,任何人都可以帮助我解决此问题并找到解决方案。

错误

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)
4

1 回答 1

2

该错误表明com.zreflect.emyed.whiteboard.pubsub.EventLoggerAsync该类期望 a ch.qos.logback.classic.LoggerContext,而不是它获得 a org.slf4j.helpers.NOPLoggerFactory。这通常发生在某些代码尝试强制转换的返回值org.slf4j.LoggerFactory.getILoggerFactory并且 slf4j 绑定到 NOP 实现时,因为类路径上没有可用的 slf4j 绑定。这通常伴随着一条错误消息

于 2013-03-19T13:12:42.737 回答