SLF4J:无法加载类“org.slf4j.impl.StaticLoggerBinder” [英] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"

查看:233
本文介绍了SLF4J:无法加载类“org.slf4j.impl.StaticLoggerBinder”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序将部署在tcServer和WebSphere 6.1上。此应用程序使用ehCache,因此需要slf4j作为依赖项。
结果我将slf4j-api.jar(1.6)jar添加到我的war文件包中。



应用程序在tcServer中工作正常除外以下错误:

  SLF4J:无法加载类org.slf4j.impl.StaticLoggerBinder。 
SLF4J:默认为无操作(NOP)记录器实现
SLF4J:有关详细信息,请参阅http://www.slf4j.org/codes.html#StaticLoggerBinder。

然而,当我在WebSphere中部署时,我得到一个 java.lang.NoClassDefFoundError :org.slf4j.impl.StaticLoggerBinder



我检查了两个应用程序服务器的类路径,没有其他的slf4j jar。 / p>

有没有人有任何想法可能会发生在这里?

解决方案

我在WebSphere 6.1中遇到了同样的问题。正如Ceki指出的那样,WebSphere正在使用大量的jar,其中一个指向旧版本的slf4j。



No-Op回滚只发生在slf4j -1.6+上,所以任何比这更旧的东西都会抛出异常并停止部署。



SLf4J网站中有一个解决此问题的文档。我跟着它并将 slf4j-simple-1.6.1.jar 添加到我的应用程序以及 slf4j-api-1.6.1.jar 我已经拥有了。



这解决了我的问题。希望它可以帮助那些有这个问题的人。


My application is to be deployed on both tcServer and WebSphere 6.1. This application uses ehCache and so requires slf4j as a dependency. As a result I've added the slf4j-api.jar (1.6) jar to my war file bundle.

The application works fine in tcServer except for the following error:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

However, when I deploy in WebSphere I get a java.lang.NoClassDefFoundError: org.slf4j.impl.StaticLoggerBinder.

I've checked the classpaths of both application servers and there is no other slf4j jar.

Does anyone have any ideas what may be happening here?

解决方案

I had the same issue with WebSphere 6.1. As Ceki pointed out, there were tons of jars that WebSphere was using and one of them was pointing to an older version of slf4j.

The No-Op rollback happens only with slf4j -1.6+ so anything older than that will throw an exception and halts your deployment.

There is a documentation in SLf4J site which resolves this. I followed that and added slf4j-simple-1.6.1.jar to my application along with slf4j-api-1.6.1.jar which I already had.

This solved my issue. Hope it helps others who have this issue.

这篇关于SLF4J:无法加载类“org.slf4j.impl.StaticLoggerBinder”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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