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

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

问题描述

  • 关于 Eclipse IDE(IndigoJunoKepler(32 位和 64 位版本))
  • 平台:WindowsUbuntuMac
  • m2e 版本:1.1.0.20120530-00091.2.0.20120903-10501.3.0.20130129-0926>,
    1.4.0.20130601-0317
<小时>

一般信息

将 m2e 更新到 1.1 版后出现上述错误.通过删除 m2e 1.1 并回滚到 m2e 1.0,一切正常. 我试图在 Windows 和 Ubuntu 中重复这个问题,但它给了我完全相同的错误.测试了 slf4j-api 和 logback 的许多配置,但似乎都不起作用.

该错误出现在任何 maven 项目中即使没有声明 slf4j 依赖项.

  • 新的Maven项目--> maven-archetype-quickstart

  • 新建Maven项目-->没有原型选择的简单项目

    结果

SLF4J:无法加载类org.slf4j.impl.StaticLoggerBinder".

<小时>

测试环境和配置

在 Mac 上使用 Eclipse Indigo 和 Eclipse Juno(32 位和 64 位)进行测试,在 Ubuntu 上使用 32 位,在 Windows 上使用 64 位和 32 位.测试了 Juno ClassicJuno 建模工具Kepler StandardKepler 建模工具 的全新安装并产生了相同的错误.

错误出现在clean安装测试部署generate-sources验证编译打包集成测试验证以及清洁目标与其余目标的组合.它也与参数 -e-X 一起出现.曾尝试删除 m2e 存储库并从头开始下载,但再次没有成功.我应该提到它在 3 台不同的机器和所有上述系统的虚拟机中进行了测试,但它产生了相同的错误.

尝试了解决 slf4j-apilogback-core 依赖项的所有不同的 logback 配置(从 1.0.4 到 1.0.13),但都产生相同的错误:

<groupId>ch.qos.logback</groupId><artifactId>logback-classic</artifactId><版本></版本></依赖>

尝试了所有不同的(从 1.6.1 到 1.7.5)slf4j-simple 配置.

<groupId>org.slf4j</groupId><artifactId>slf4j-simple</artifactId><版本></版本><scope>编译</scope></依赖>

尝试了所有不同的(从 1.6.1 到 1.7.5)log4j-over-slf4j 配置.

<groupId>org.slf4j</groupId><artifactId>log4j-over-slf4j</artifactId><版本></版本><scope>编译</scope></依赖>

尝试了所有不同的(从 1.6.1 到 1.7.5)slf4j-jdk14 配置.

<groupId>org.slf4j</groupId><artifactId>slf4j-jdk14</artifactId><版本></版本><scope>编译</scope></依赖>

尝试了所有不同的(从 1.6.1 到 1.7.5)slf4j-log4j12 配置.

<groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId><版本></版本><scope>编译</scope></依赖>

尝试了 slf4j-nop 1.7.5 配置.

<groupId>org.slf4j</groupId><artifactId>slf4j-nop</artifactId><version>1.7.5</version><scope>编译</scope></依赖>

最后但并非最不重要的一点是,尽管出现错误,日志仍会保存和打印.

<小时>

重现错误的方法

  • 下载 Eclipse Juno、Indigo 或 Kepler 32 或 64 位(所有安装都将导致同样的错误).

  • 右键单击项目->运行方式->全新安装(或上述任何其他目标)

控制台的第一行是

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

P.S.现有项目将m2e版本更新为1.1.0.20120530-00091.2.0.20120903-10501.3.0.20130129-0926后,会出现同样的错误强>, 1.4.0.20130601-0317


更新

编辑

m2e 支持网站:

  • 上述问题已作为 m2e 支持站点的错误发布,Igor Fedorenko 的回答是

    <块引用>

    没有立即取消此消息的计划.

    要查看上述错误,请参阅 m2e 官方支持网站

<小时>编辑 2

  • 上述错误指示存在也适用于m2e版本1.2.0.20120903-1050

<小时>编辑 3

  • 上述错误指示存在也适用于m2e版本1.3.0.20130129-0926

<小时>编辑 4

  • 上述错误指示存在也适用于m2e版本1.4.0.20130601-0317

<小时>编辑 5

 ***报告已修复***

解决方案

我也可以确认这个错误.

解决方法:是在m2eclipse中使用external maven,而不是内嵌的maven.

这分三个步骤完成:

1 在本地机器上安装maven(测试机器是Ubuntu 10.10)

<块引用>

mvn --version

Apache Maven 2.2.1 (rdebian-4) Java 版本:1.6.0_20 Java 主页:/usr/lib/jvm/java-6-openjdk/jre 默认语言环境:de_DE,平台编码:UTF-8 操作系统名称:linux"版本:2.6.35-32-generic"拱:amd64"家庭:unix"

2 在外部运行 maven 链接如何从控制台

<块引用>

>cd path-to-pom.xml>测试

 [INFO] 正在扫描项目...[信息] ------------------------------------------------------------------------[信息] 构建简单[信息] 任务段:[测试][信息] ------------------------------------------------------------------------[...][信息] Surefire 报告目录:[...]/workspace/Simple/target/surefire-reports-------------------------------------------------------测试-------------------------------------------------------运行 net.tverrbjelke.experiment.MainAppTest你好,世界测试运行:1,失败:0,错误:0,跳过:0,经过的时间:0.042 秒结果 :测试运行:1,失败:0,错误:0,跳过:0[信息] ------------------------------------------------------------------------[信息] 构建成功[信息] ------------------------------------------------------------------------[...]

3 inside m2eclipse:嵌入式maven切换到本地maven

  • 找出本地 maven home 安装目录的位置(mvn --version,或者谷歌搜索你的 MAVEN_HOME,对我来说 这对我有帮助/usr/share/maven2 )
  • 在eclipse菜单->窗口->首选项->Maven->安装->输入那个字符串.那么您应该已经切换到新的外部 Maven 了.
  • 然后运行您的项目,例如Maven 测试".

错误信息应该消失了.

  • Regarding Eclipse IDE (Indigo, Juno and Kepler (32 and 64 bit versions))
  • Platforms: Windows, Ubuntu, Mac
  • m2e version: 1.1.0.20120530-0009, 1.2.0.20120903-1050, 1.3.0.20130129-0926,
    1.4.0.20130601-0317

General info

The above error came after updating the m2e to version 1.1. By removing m2e 1.1 and rolling back to m2e 1.0 everything worked fine. I tried to repeat the problem in Windows and Ubuntu and it gave me the exact same error. Numerous configurations of the slf4j-api and logback were tested but none seem to work.

The error appears in any maven project even without declaring slf4j dependency.

  • New Maven Project--> maven-archetype-quickstart

    and

  • New Maven Project--> Simple project without archetype selection

    result to

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".


Testing enviroments and configurations

Tested with Eclipse Indigo and Eclipse Juno (32 and 64 bit both) on Mac, 32 bit on Ubuntu and 64 and 32 bit on Windows. Tested fresh installs of Juno Classic, Juno Modelling tools, Kepler Standard, Kepler Modelling Tools and produced the same error.

The error appears with clean, install, test, deploy, generate-sources, validate , compile , package, integration-test, verify and combinations of the goal clean with the rest goals. It appears also with parameters -e and -X. There was an attempt to delete the m2e repository and download it from scratch but again without success. It should me mentioned that it was tested in 3 different machines and virtual box all the above systems but it produced the same error.

Tried all different logback configurations (from 1.0.4 to 1.0.13) that resolve the slf4j-api and logback-core dependencies, but all produce the same error:

<dependency>
   <groupId>ch.qos.logback</groupId>
   <artifactId>logback-classic</artifactId>
   <version></version>
</dependency>

Tried all different (from 1.6.1 to 1.7.5 ) slf4j-simple configurations.

<dependency>
   <groupId>org.slf4j</groupId>
   <artifactId>slf4j-simple</artifactId>
   <version></version>
   <scope>compile</scope>
</dependency>

Tried all different (from 1.6.1 to 1.7.5 ) log4j-over-slf4j configurations.

<dependency>
   <groupId>org.slf4j</groupId>
   <artifactId>log4j-over-slf4j</artifactId>
   <version></version>
   <scope>compile</scope>
</dependency>

Tried all different (from 1.6.1 to 1.7.5 ) slf4j-jdk14 configurations.

<dependency>
   <groupId>org.slf4j</groupId>
   <artifactId>slf4j-jdk14</artifactId>
   <version></version>
   <scope>compile</scope>
</dependency>

Tried all different (from 1.6.1 to 1.7.5 ) slf4j-log4j12 configurations.

<dependency>
     <groupId>org.slf4j</groupId>
     <artifactId>slf4j-log4j12</artifactId>
     <version></version>
     <scope>compile</scope>
</dependency>

Tried slf4j-nop 1.7.5 configuration.

<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-nop</artifactId>
  <version>1.7.5</version>
  <scope>compile</scope>
</dependency>

Last but not least the logs are saved and printed despite the error.


Ways to reproduce the error

  • Download Eclipse Juno, Indigo or Kepler 32 or 64 bit (All installations will cause the same error).

  • Right Click on the project->Runs As->clean install (or any other goal mentioned above)

The first line on the console will be

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.

P.S. Existing projects will produce the same error after updating the m2e version to 1.1.0.20120530-0009, 1.2.0.20120903-1050, 1.3.0.20130129-0926, 1.4.0.20130601-0317


Updates

EDIT

m2e support site:

  • The above question was posted as a bug in m2e support site and the answer from Igor Fedorenko was that

    There are no immediate plans to suppress this message.

    For viewing the above bug please refer to m2e official support site


EDIT 2

  • The above error indication is present also to m2e version 1.2.0.20120903-1050


EDIT 3

  • The above error indication is present also to m2e version 1.3.0.20130129-0926


EDIT 4

  • The above error indication is present also to m2e version 1.4.0.20130601-0317


EDIT 5

                              ***Reported FIXED***

  • The above error is reported as fixed for m2e version 1.5.0/Luna M3(Target Milestone). The version is not yet available for download.
  • Luna M3 is scheduled for Nov. 15th.
  • Latest dev build are available here
  • More information about the m2e milestones you can find at the m2e main repository.

解决方案

I can also confirm this error.

Workaround: is to use external maven inside m2eclipse, instead of it's embedded maven.

That is done in three steps:

1 Install maven on local machine (the test-machine was Ubuntu 10.10)

mvn --version

Apache Maven 2.2.1 (rdebian-4) Java version: 1.6.0_20 Java home: /usr/lib/jvm/java-6-openjdk/jre Default locale: de_DE, platform encoding: UTF-8 OS name: "linux" version: "2.6.35-32-generic" arch: "amd64" Family: "unix"

2 Run maven externally link how to run maven from console

> cd path-to-pom.xml
> mvn test

    [INFO] Scanning for projects...
    [INFO] ------------------------------------------------------------------------
    [INFO] Building Simple
    [INFO]    task-segment: [test]
    [INFO] ------------------------------------------------------------------------
    [...]
    [INFO] Surefire report directory: [...]/workspace/Simple/target/surefire-reports
    
    -------------------------------------------------------
     T E S T S
    -------------------------------------------------------
    Running net.tverrbjelke.experiment.MainAppTest
    Hello World
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.042 sec
    
    Results :
    
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
    
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESSFUL
    [INFO] ------------------------------------------------------------------------
    [...]

3 inside m2eclipse: switch from embedded maven to local maven

  • find out where local maven home installation dir is (mvn --version, or google for your MAVEN_HOME, for me this helped me that is /usr/share/maven2 )
  • in eclipse Menu->Window->Preferences->Maven->Installation-> enter that string. Then you should have switched to your new external maven.
  • then run your Project as e.g. "maven test".

The error-message should be gone.

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

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