- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的应用程序将部署在 tcServer 和 WebSphere 6.1 上。该应用程序使用 ehCache,因此需要 slf4j 作为依赖项。因此,我将 slf4j-api.jar (1.6) jar 添加到我的 war 文件包中。
应用程序在 tcServer 中工作正常,但出现以下错误:
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.
但是,当我在 WebSphere 中部署时,我收到 java.lang.NoClassDefFoundError: org.slf4j.impl.StaticLoggerBinder
。
还伴有无法加载类“org.slf4j.impl.StaticMDCBinder”
我检查了两个应用程序服务器的类路径,没有其他 slf4j jar。
有人知道这里可能发生什么吗?
最佳答案
我在使用 WebSphere 6.1 时也遇到了同样的问题。正如 Ceki 指出的那样,WebSphere 正在使用大量的 jar,其中一个指向旧版本的 slf4j。
无操作回退仅发生在 slf4j -1.6+ 上,因此任何早于该值的内容都会引发异常并停止您的部署。
SLf4J site中有文档这解决了这个问题。我遵循这一点,并将 slf4j-simple-1.6.1.jar
添加到我的应用程序中,以及我已经拥有的 slf4j-api-1.6.1.jar
。
如果您使用Maven,请添加以下依赖项,其中${slf4j.version}
为the latest version of slf4j
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
</dependency>
这解决了我的问题。
关于java - SLF4J:无法加载类 "org.slf4j.impl.StaticLoggerBinder",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58149670/
我是一名优秀的程序员,十分优秀!