无法加载类“org.slf4j.impl.StaticLoggerBinder”错误(Failed

2019-06-26 10:33发布

我越来越“ 无法加载类‘org.slf4j.impl.StaticLoggerBinder’的错误,尽管我folowed规则:

将一个(并且仅一个)SLF4J-nop.jar,SLF4J-simple.jar,SLF4J-log4j12.jar,SLF4J-jdk14.jar或的logback-classic.jar的

我会很高兴,如果有人能帮助我,在此先感谢..


这里是我的依赖关系:

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${slf4j.version}</version>
    </dependency>

    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.15</version>
        <exclusions>
            <exclusion>
                <groupId>com.sun.jmx</groupId>
                <artifactId>jmxri</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.jdmk</groupId>
                <artifactId>jmxtools</artifactId>
            </exclusion>
            <exclusion>
                <groupId>javax.jms</groupId>
                <artifactId>jms</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

下面是行家依赖关系树的输出:

[INFO] com.tk.sample:ext4:jar:1.0
[INFO] +- org.slf4j:slf4j-api:jar:1.6.1:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.1:compile
[INFO] +- log4j:log4j:jar:1.2.15:compile
[INFO] |  \- javax.mail:mail:jar:1.4:compile
[INFO] |     \- javax.activation:activation:jar:1.1:compile
[INFO] +- commons-lang:commons-lang:jar:2.5:compile
[INFO] +- junit:junit:jar:4.8.2:test (scope not updated to compile)
[INFO] +- org.easymock:easymock:jar:3.0:test
[INFO] |  \- org.objenesis:objenesis:jar:1.2:test
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- taglibs:standard:jar:1.1.2:compile
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- org.springframework:spring-core:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-expression:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-beans:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-asm:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-aop:jar:3.1.1.RELEASE:compile
[INFO] |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-web:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-tx:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.1.1.RELEASE:compile
[INFO] |  \- org.springframework:spring-context-support:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-orm:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-oxm:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-jms:jar:3.1.1.RELEASE:compile
[INFO] +- org.springframework:spring-test:jar:3.1.1.RELEASE:compile
[INFO] +- cglib:cglib-nodep:jar:2.2.2:runtime
[INFO] +- org.aspectj:aspectjrt:jar:1.6.11:compile
[INFO] +- org.aspectj:aspectjweaver:jar:1.6.11:compile
[INFO] +- org.hibernate:hibernate-core:jar:4.1.1.Final:compile
[INFO] |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  +- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
[INFO] |  +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.0.Final:compile
[INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  +- org.javassist:javassist:jar:3.15.0-GA:compile
[INFO] |  \- org.hibernate.common:hibernate-commons-annotations:jar:4.0.1.Final:compile
[INFO] +- org.hibernate:hibernate-c3p0:jar:4.1.1.Final:compile
[INFO] |  \- c3p0:c3p0:jar:0.9.1:compile
[INFO] +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:4.1.1.Final:compile
[INFO] +- net.sf.json-lib:json-lib:jar:jdk15:2.4:compile
[INFO] |  +- commons-beanutils:commons-beanutils:jar:1.8.0:compile
[INFO] |  +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] |  \- net.sf.ezmorph:ezmorph:jar:1.0.6:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.20:compile
[INFO] +- commons-io:commons-io:jar:1.3.2:compile
[INFO] +- commons-fileupload:commons-fileupload:jar:1.2.1:compile
[INFO] +- commons-dbcp:commons-dbcp:jar:1.4:compile
[INFO] |  \- commons-pool:commons-pool:jar:1.5.4:compile
[INFO] +- javax.xml:jaxrpc-api:jar:1.1:compile
[INFO] +- commons-discovery:commons-discovery:jar:0.4:compile
[INFO] +- javax.transaction:jta:jar:1.1:compile
[INFO] +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- com.itextpdf:itextpdf:jar:5.3.0:compile
[INFO] +- net.sf.jasperreports:jasperreports:jar:4.6.0:compile
[INFO] |  +- commons-digester:commons-digester:jar:2.1:compile
[INFO] |  +- com.lowagie:itext:jar:2.1.7:compile
[INFO] |  |  +- bouncycastle:bcmail-jdk14:jar:138:compile
[INFO] |  |  +- bouncycastle:bcprov-jdk14:jar:138:compile
[INFO] |  |  \- org.bouncycastle:bctsp-jdk14:jar:1.38:compile
[INFO] |  |     +- org.bouncycastle:bcprov-jdk14:jar:1.38:compile
[INFO] |  |     \- org.bouncycastle:bcmail-jdk14:jar:1.38:compile
[INFO] |  +- jfree:jcommon:jar:1.0.15:compile
[INFO] |  +- jfree:jfreechart:jar:1.0.12:compile
[INFO] |  +- xml-apis:xml-apis:jar:1.3.02:compile
[INFO] |  +- eclipse:jdtcore:jar:3.1.0:compile
[INFO] |  +- org.codehaus.castor:castor:jar:1.2:compile
[INFO] |  +- org.apache.poi:poi-ooxml:jar:3.7:compile
[INFO] |  |  +- org.apache.poi:poi:jar:3.7:compile
[INFO] |  |  \- org.apache.poi:poi-ooxml-schemas:jar:3.7:compile
[INFO] |  |     +- org.apache.xmlbeans:xmlbeans:jar:2.3.0:compile
[INFO] |  |     |  \- stax:stax-api:jar:1.0.1:compile
[INFO] |  |     \- org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0:compile
[INFO] |  +- org.codehaus.jackson:jackson-core-asl:jar:1.9.4:compile
[INFO] |  \- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.4:compile
[INFO] +- org.twitter4j:twitter4j-core:jar:2.2.5:compile
[INFO] \- org.codehaus.mojo:emma-maven-plugin:jar:1.0-alpha-3:compile
[INFO]    +- emma:emma:jar:2.1.5320:compile
[INFO]    +- org.apache.maven:maven-artifact:jar:2.0.8:compile
[INFO]    +- org.apache.maven:maven-plugin-api:jar:2.0:compile
[INFO]    +- org.apache.maven:maven-model:jar:2.0.8:compile
[INFO]    +- org.apache.maven:maven-project:jar:2.0.8:compile
[INFO]    |  +- org.apache.maven:maven-settings:jar:2.0.8:compile
[INFO]    |  +- org.apache.maven:maven-profile:jar:2.0.8:compile
[INFO]    |  +- org.apache.maven:maven-artifact-manager:jar:2.0.8:compile
[INFO]    |  |  +- org.apache.maven:maven-repository-metadata:jar:2.0.8:compile
[INFO]    |  |  \- org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:compile
[INFO]    |  +- org.apache.maven:maven-plugin-registry:jar:2.0.8:compile
[INFO]    |  \- org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
[INFO]    |     \- classworlds:classworlds:jar:1.1-alpha-2:compile
[INFO]    +- org.apache.maven.doxia:doxia-site-renderer:jar:1.0:compile
[INFO]    |  +- org.apache.maven.doxia:doxia-core:jar:1.0:compile
[INFO]    |  +- org.apache.maven.doxia:doxia-sink-api:jar:1.0:compile
[INFO]    |  +- org.codehaus.plexus:plexus-i18n:jar:1.0-beta-7:compile
[INFO]    |  +- org.codehaus.plexus:plexus-velocity:jar:1.1.7:compile
[INFO]    |  +- org.apache.velocity:velocity:jar:1.5:compile
[INFO]    |  |  \- oro:oro:jar:2.0.8:compile
[INFO]    |  +- org.apache.maven.doxia:doxia-decoration-model:jar:1.0:compile
[INFO]    |  +- org.apache.maven.doxia:doxia-module-apt:jar:1.0:compile
[INFO]    |  +- org.apache.maven.doxia:doxia-module-fml:jar:1.0:compile
[INFO]    |  +- org.apache.maven.doxia:doxia-module-xdoc:jar:1.0:compile
[INFO]    |  \- org.apache.maven.doxia:doxia-module-xhtml:jar:1.0:compile
[INFO]    +- org.apache.maven.reporting:maven-reporting-api:jar:2.0.8:compile
[INFO]    +- org.apache.maven.reporting:maven-reporting-impl:jar:2.0.4.2:compile
[INFO]    |  \- commons-validator:commons-validator:jar:1.2.0:compile
[INFO]    +- org.codehaus.plexus:plexus-utils:jar:1.4.5:compile
[INFO]    \- xom:xom:jar:1.1:compile
[INFO]       +- xerces:xmlParserAPIs:jar:2.6.2:compile
[INFO]       +- xerces:xercesImpl:jar:2.6.2:compile
[INFO]       \- jaxen:jaxen:jar:1.1-beta-8:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

完整的错误堆栈跟踪:

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.

Answer 1:

终于发现了问题; IntelliJ IDEA的 - - ,我使用的IDE需要显示SLF4J依赖性明确建立文物 。 非常感谢你的关心Ceki ..



文章来源: Failed to load class “org.slf4j.impl.StaticLoggerBinder” error