java.lang.illegalaccesserror:尝试从springboot中的org.slf4j.loggerfactory类访问字段org.slf4j.impl.staticloggerbinder.singleton

iyzzxitl  于 2021-07-06  发布在  Java
关注(0)|答案(1)|浏览(428)

我正在将springmvc应用程序转换为springboot应用程序。一切进展顺利,我能够通过main方法运行springboot应用程序,该方法使用@springbootapplication注解类。
即使是SpringBoot,我们仍然希望将其部署到tomcat服务器,而不是使用EmbedderOne。我和你一起建房子 mvn install 指挥和发动战争。
在启动tomcat服务器时,我遇到以下错误: java.lang.IllegalAccessError: tried to access field org.slf4j.impl.StaticLoggerBinder.SINGLETON from class org.slf4j.LoggerFactory 这就是为什么会出现这种错误的答案http://www.slf4j.org/faq.html#illegalaccesserror

If you get the exception shown above, then you are using an older version of slf4j-api, e.g. 1.4.3, with a new version of a slf4j binding, e.g. 1.5.6. Typically, this occurs when your Maven pom.ml file incorporates hibernate 3.3.0 which declares a dependency on slf4j-api version 1.4.2. If your pom.xml declares a dependency on an slf4j binding, say slf4j-log4j12 version 1.5.6, then you will get illegal access errors.

我试过很多东西,但运气不好。我真的很感激任何帮助。谢谢您。这是maven依赖插件树:

[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.2.8.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.2.8.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:2.2.8.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.2.8.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.2.8.RELEASE:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] |  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.12.1:compile
[INFO] |  |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.12.1:compile
[INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.30:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.25:runtime
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:2.2.8.RELEASE:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.10.4:compile
[INFO] |  |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.10.4:compile
[INFO] |  |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.10.4:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.10.4:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.10.4:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.10.4:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-validation:jar:2.2.8.RELEASE:compile
[INFO] |  |  +- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
[INFO] |  |  \- org.hibernate.validator:hibernate-validator:jar:6.0.20.Final:compile
[INFO] |  +- org.springframework:spring-web:jar:5.2.7.RELEASE:compile
[INFO] |  \- org.springframework:spring-webmvc:jar:5.2.7.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:2.2.8.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:2.2.8.RELEASE:compile
[INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.9.5:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-jdbc:jar:2.2.8.RELEASE:compile
[INFO] |  |  +- com.zaxxer:HikariCP:jar:3.4.5:compile
[INFO] |  |  \- org.springframework:spring-jdbc:jar:5.2.7.RELEASE:compile
[INFO] |  +- jakarta.persistence:jakarta.persistence-api:jar:2.2.3:compile
[INFO] |  +- jakarta.transaction:jakarta.transaction-api:jar:1.3.3:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:5.4.17.Final:compile
[INFO] |  |  +- org.javassist:javassist:jar:3.24.0-GA:compile
[INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.10.11:compile
[INFO] |  |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |  +- org.jboss:jandex:jar:2.1.3.Final:compile
[INFO] |  |  +- org.dom4j:dom4j:jar:2.1.3:compile
[INFO] |  |  +- org.hibernate.common:hibernate-commons-annotations:jar:5.1.0.Final:compile
[INFO] |  |  \- org.glassfish.jaxb:jaxb-runtime:jar:2.3.3:compile
[INFO] |  |     +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:compile
[INFO] |  |     +- org.glassfish.jaxb:txw2:jar:2.3.3:compile
[INFO] |  |     +- com.sun.istack:istack-commons-runtime:jar:3.0.11:compile
[INFO] |  |     \- com.sun.activation:jakarta.activation:jar:1.2.2:runtime
[INFO] |  +- org.springframework.data:spring-data-jpa:jar:2.2.8.RELEASE:compile
[INFO] |  |  +- org.springframework.data:spring-data-commons:jar:2.2.8.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-orm:jar:5.2.7.RELEASE:compile
[INFO] |  \- org.springframework:spring-aspects:jar:5.2.7.RELEASE:compile
[INFO] +- org.apache.tomcat.embed:tomcat-embed-jasper:jar:9.0.36:provided
[INFO] |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.36:provided
[INFO] |  |  \- org.apache.tomcat:tomcat-annotations-api:jar:9.0.36:provided
[INFO] |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.36:provided
[INFO] |  \- org.eclipse.jdt:ecj:jar:3.18.0:provided
[INFO] +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.2.8.RELEASE:provided
[INFO] |  +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.36:provided
[INFO] +- log4j:log4j:jar:1.2.17:compile
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- org.apache.commons:com.springsource.org.apache.commons.collections:jar:3.2.0:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.2.1:compile
[INFO] +- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- commons-beanutils:commons-beanutils:jar:1.9.2:compile
[INFO] |  +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] |  \- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] +- commons-io:commons-io:jar:1.3.2:compile
[INFO] +- org.apache.poi:poi-ooxml:jar:3.17:compile
[INFO] |  +- org.apache.poi:poi:jar:3.17:compile
[INFO] |  |  +- commons-codec:commons-codec:jar:1.13:compile
[INFO] |  |  \- org.apache.commons:commons-collections4:jar:4.1:compile
[INFO] |  +- org.apache.poi:poi-ooxml-schemas:jar:3.17:compile
[INFO] |  |  \- org.apache.xmlbeans:xmlbeans:jar:2.6.0:compile
[INFO] |  \- com.github.virtuald:curvesapi:jar:1.04:compile
[INFO] +- commons-fileupload:commons-fileupload:jar:1.2.2:compile
[INFO] +- org.apache.tiles:tiles-core:jar:3.0.3:compile
[INFO] |  +- commons-digester:commons-digester:jar:2.0:compile
[INFO] |  \- org.slf4j:jcl-over-slf4j:jar:1.7.30:compile
[INFO] +- org.apache.tiles:tiles-api:jar:3.0.3:compile
[INFO] +- org.apache.tiles:tiles-jsp:jar:3.0.3:compile
[INFO] |  +- org.apache.tiles:tiles-servlet:jar:3.0.3:compile
[INFO] |  \- org.apache.tiles:tiles-template:jar:3.0.3:compile
[INFO] |     \- org.apache.tiles:tiles-autotag-core-runtime:jar:1.1.0:compile
[INFO] +- org.apache.tiles:tiles-request-api:jar:1.0.3:compile
[INFO] +- org.apache.tiles:tiles-request-jsp:jar:1.0.3:compile
[INFO] |  \- org.apache.tiles:tiles-request-servlet:jar:1.0.3:compile
[INFO] +- javax.servlet:jstl:jar:1.2:system
[INFO] +- org.hibernate:hibernate-validator:jar:5.0.1.Final:compile
[INFO] |  +- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] |  +- org.jboss.logging:jboss-logging:jar:3.4.1.Final:compile
[INFO] |  \- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] +- IntexWrap:IntexWrap:jar:3.3E:system
[INFO] +- org.springframework.security:spring-security-web:jar:4.1.0.RELEASE:compile
[INFO] |  +- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  +- org.springframework.security:spring-security-core:jar:5.2.5.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:5.2.7.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:5.2.7.RELEASE:compile
[INFO] |  +- org.springframework:spring-core:jar:5.2.7.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-jcl:jar:5.2.7.RELEASE:compile
[INFO] |  \- org.springframework:spring-expression:jar:5.2.7.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-config:jar:4.1.0.RELEASE:compile
[INFO] |  \- org.springframework:spring-aop:jar:5.2.7.RELEASE:compile
[INFO] +- com.oracle:ojdbc6:jar:11.2.0.4:compile
[INFO] +- com.jscape:sinetfactory:jar:7.0:compile
[INFO] +- com.jcraft:jsch:jar:0.1.55:compile
[INFO] +- snappy-java:snappy-java:jar:1.0.4.1:system
[INFO] +- jackson-core:jackson-core:jar:2.5.0:system
[INFO] +- jackson-databind:jackson-databind:jar:2.5.0:system
[INFO] +- jackson-annotations:jackson-annotations:jar:2.5.0:system
[INFO] +- JavaSoamApi:JavaSoamApi:jar:1.0:system
[INFO] +- JavaSymexecApi:JavaSymexecApi:jar:1.0:system
[INFO] +- paranamer:paranamer:jar:2.3:system
[INFO] +- avro:avro:jar:1.0:system
[INFO] +- commons-cli:commons-cli:jar:1.2:system
[INFO] +- com.sun.mail:javax.mail:jar:1.4.4:compile
[INFO] |  \- javax.activation:activation:jar:1.1:compile
[INFO] +- CPA2JavaClient:CPA2JavaClient:jar:1.0:system
[INFO] +- com.fanniemae.faas.tcserver:tcsFedletIdentityAsserterProvider:jar:1.5.0:compile
[INFO] +- org.springframework:spring-context-support:jar:5.0.0.M5:compile
[INFO] +- org.quartz-scheduler:quartz:jar:2.2.3:compile
[INFO] |  +- c3p0:c3p0:jar:0.9.1.1:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.30:compile
[INFO] +- org.springframework.batch:spring-batch-core:jar:4.0.0.M1:compile
[INFO] |  +- com.ibm.jbatch:com.ibm.jbatch-tck-spi:jar:1.0:compile
[INFO] |  |  \- javax.batch:javax.batch-api:jar:1.0:compile
[INFO] |  +- com.thoughtworks.xstream:xstream:jar:1.4.9:compile
[INFO] |  |  +- xmlpull:xmlpull:jar:1.1.3.1:compile
[INFO] |  |  \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] |  +- org.codehaus.jettison:jettison:jar:1.2:compile
[INFO] |  \- org.springframework:spring-tx:jar:5.2.7.RELEASE:compile
[INFO] +- org.springframework.batch:spring-batch-infrastructure:jar:4.0.0.M1:compile
[INFO] |  \- org.springframework.retry:spring-retry:jar:1.2.5.RELEASE:compile
[INFO] +- junit:junit:jar:4.11:test
[INFO] +- org.springframework:spring-test:jar:3.2.3.RELEASE:compile
[INFO] +- org.mockito:mockito-all:jar:1.9.5:test
[INFO] +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] +- hsqldb:hsqldb:jar:2.2.8:system
[INFO] +- prismtools:prismtools:jar:2.2.8:system
[INFO] +- esb-client:esb-client:jar:4.1.3:system
[INFO] +- com.fanniemae.sharedservices.evas:evas-sdk:jar:1.3:compile
[INFO] +- com.google.guava:guava:jar:18.0:compile
[INFO] +- org.apache.httpcomponents:httpmime:jar:4.5.2:compile
[INFO] |  \- org.apache.httpcomponents:httpclient:jar:4.5.12:compile
[INFO] |     \- org.apache.httpcomponents:httpcore:jar:4.4.13:compile
[INFO] +- com.cenqua.clover:clover:jar:3.1.12:compile
[INFO] +- com.fanniemae.hpvltg:hp_voltage_lib:jar:1.0:compile
[INFO] \- com.netezza:nzjdbc:jar:7.2.1:compile

这是pom.xml中的依赖项

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.8.RELEASE</version>
        <relativePath/>
    </parent>
<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>

        <!--        <dependency>-->
<!--            <groupId>org.springframework</groupId>-->
<!--            <artifactId>spring-beans</artifactId>-->
<!--            <version>5.0.0.M5</version>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>org.springframework</groupId>-->
<!--            <artifactId>spring-core</artifactId>-->
<!--            <version>5.0.0.M5</version>-->
<!--            <classifier>sources</classifier>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>org.springframework</groupId>-->
<!--            <artifactId>spring-expression</artifactId>-->
<!--            <version>5.0.0.M5</version>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>org.springframework</groupId>-->
<!--            <artifactId>spring-web</artifactId>-->
<!--            <version>5.0.0.M5</version>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>org.springframework</groupId>-->
<!--            <artifactId>spring-context</artifactId>-->
<!--            <version>5.0.0.M5</version>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>org.springframework</groupId>-->
<!--            <artifactId>spring-webmvc</artifactId>-->
<!--            <version>5.0.0.M5</version>-->
<!--        </dependency>-->
        <!-- log4j dependencies -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
        </dependency>

        <!-- Servlet dependencies -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>

        <!-- Apache common dependencies -->

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>com.springsource.org.apache.commons.collections</artifactId>
            <version>3.2.0</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.2.1</version>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils -->
        <dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils</artifactId>
            <version>1.9.2</version>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>

        <!-- Apache Poi dependencies -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.17</version>
        </dependency>

        <!-- Apache file upload dependencies -->
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.2.2</version>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>1.3.2</version>
        </dependency>

<!--        <dependency>-->
<!--            <groupId>org.slf4j</groupId>-->
<!--            <artifactId>slf4j-api</artifactId>-->
<!--            <version>1.5.5</version>-->
<!--        </dependency>-->

<!--        <dependency>-->
<!--            <groupId>org.slf4j</groupId>-->
<!--            <artifactId>slf4j-log4j12</artifactId>-->
<!--            <version>1.5.5</version>-->
<!--        </dependency>-->

        <!-- Apache tiles dependencies -->
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-core</artifactId>
            <version>3.0.3</version>
        </dependency>

        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-api</artifactId>
            <version>3.0.3</version>
        </dependency>

        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-jsp</artifactId>
            <version>3.0.3</version>
        </dependency>

        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-request-api</artifactId>
            <version>1.0.3</version>
        </dependency>

        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-request-jsp</artifactId>
            <version>1.0.3</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/jstl-1.2.jar</systemPath>
        </dependency>

        <!-- Hibernate dependencies -->
<!--        <dependency>-->
<!--            <groupId>org.hibernate</groupId>-->
<!--            <artifactId>hibernate-core</artifactId>-->
<!--            <version>5.1.0.Final</version>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>org.hibernate.common</groupId>-->
<!--            <artifactId>hibernate-commons-annotations</artifactId>-->
<!--            <version>5.0.1.Final</version>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>org.hibernate</groupId>-->
<!--            <artifactId>hibernate-testing</artifactId>-->
<!--            <version>5.2.10.Final</version>-->
<!--        </dependency>-->
        <!-- <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.0-api</artifactId>
            <version>1.0.1.Final</version>
        </dependency> -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>5.0.1.Final</version>
        </dependency>

        <dependency>
            <groupId>IntexWrap</groupId>
            <artifactId>IntexWrap</artifactId>
            <version>3.3E</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/IntexWrap.jar</systemPath>
        </dependency>

<!--        <dependency>-->
<!--            <groupId>org.springframework</groupId>-->
<!--            <artifactId>spring-tx</artifactId>-->
<!--            <version>5.0.0.M5</version>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>org.springframework</groupId>-->
<!--            <artifactId>spring-jdbc</artifactId>-->
<!--            <version>5.0.0.M5</version>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>org.springframework</groupId>-->
<!--            <artifactId>spring-orm</artifactId>-->
<!--            <version>5.0.0.M5</version>-->
<!--        </dependency>-->

        <!-- Spring Security -->
<!--        <dependency>-->
<!--            <groupId>org.springframework.security</groupId>-->
<!--            <artifactId>spring-security-core</artifactId>-->
<!--            <version>4.1.0.RELEASE</version>-->
<!--        </dependency>-->
        <dependency> <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>4.1.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>4.1.0.RELEASE</version>
        </dependency>

        <!-- Oracle Driver dependencies -->
        <!--        <dependency>
                    <groupId>ojdbc6.jar</groupId>
                    <artifactId>ojdbc6.jar</artifactId>
                    <version>1.0</version>
                    <scope>system</scope>
                    <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/ojdbc6.jar</systemPath>
                </dependency>
         -->
        <dependency>
          <groupId>com.oracle</groupId>
          <artifactId>ojdbc6</artifactId>
          <version>11.2.0.4</version>
        </dependency>
        <!-- SFTP classes dependencies -->

        <dependency>
            <groupId>com.jscape</groupId>
            <artifactId>sinetfactory</artifactId>
            <version>7.0</version>
        </dependency>

        <dependency>
            <groupId>com.jcraft</groupId>
            <artifactId>jsch</artifactId>
            <version>0.1.55</version>
        </dependency>

        <!--dependency>
            <groupId>sinetfactory</groupId>
            <artifactId>sinetfactory</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/sinetfactory.jar</systemPath>
        </dependency-->
        <!-- symphony client classes dependencies -->
        <dependency>
            <groupId>snappy-java</groupId>
            <artifactId>snappy-java</artifactId>
            <version>1.0.4.1</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/snappy-java-1.0.4.1.jar</systemPath>
        </dependency>

        <!-- dependency> <groupId>sinetfactory</groupId> <artifactId>jackson-all</artifactId>
            <version>1.9.4</version> <scope>system</scope> <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/jackson-all-1.9.4.jar</systemPath>
            </dependency -->

        <dependency>
            <groupId>jackson-core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>2.5.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/jackson-core-2.5.0-rc1.jar</systemPath>
        </dependency>

        <dependency>
            <groupId>jackson-databind</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.5.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/jackson-databind-2.5.0-rc1.jar</systemPath>
        </dependency>

        <dependency>
            <groupId>jackson-annotations</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>2.5.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/jackson-annotations-2.5.0-rc1.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>JavaSoamApi</groupId>
            <artifactId>JavaSoamApi</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/JavaSoamApi.jar</systemPath>
        </dependency>

        <dependency>
            <groupId>JavaSymexecApi</groupId>
            <artifactId>JavaSymexecApi</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/JavaSymexecApi.jar</systemPath>
        </dependency>

        <dependency>
            <groupId>paranamer</groupId>
            <artifactId>paranamer</artifactId>
            <version>2.3</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/paranamer-2.3.jar</systemPath>
        </dependency>

        <dependency>
            <groupId>avro</groupId>
            <artifactId>avro</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/avro.jar</systemPath>
        </dependency>

        <dependency>
            <groupId>commons-cli</groupId>
            <artifactId>commons-cli</artifactId>
            <version>1.2</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/commons-cli-1.2.jar</systemPath>
        </dependency>

        <dependency>
            <groupId>IntexWrap</groupId>
            <artifactId>IntexWrap</artifactId>
            <version>3.3E</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/IntexWrap.jar</systemPath>
        </dependency>

        <!-- Java Mail dependecy -->
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>javax.mail</artifactId>
            <version>1.4.4</version>
        </dependency>

        <dependency>
            <groupId>CPA2JavaClient</groupId>
            <artifactId>CPA2JavaClient</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/CPA2JavaClient.jar</systemPath>
        </dependency>

        <dependency>
            <groupId>com.fanniemae.faas.tcserver</groupId>
            <artifactId>tcsFedletIdentityAsserterProvider</artifactId>
            <version>1.5.0</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>5.0.0.M5</version>
        </dependency>
        <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz</artifactId>
            <version>2.2.3</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.batch</groupId>
            <artifactId>spring-batch-core</artifactId>
            <version>4.0.0.M1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.batch</groupId>
            <artifactId>spring-batch-infrastructure</artifactId>
            <version>4.0.0.M1</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- for unit tests -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>3.2.3.RELEASE</version>
        </dependency>

        <!-- This is for mocking the service -->
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>1.9.5</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <version>2.2.8</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/hsqldb-2.2.8.jar</systemPath>
        </dependency>

        <dependency>
            <groupId>prismtools</groupId>
            <artifactId>prismtools</artifactId>
            <version>2.2.8</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/prismtools-0.0.1.jar</systemPath>
        </dependency>

        <!-- ESB jar from local -->
        <dependency>
            <groupId>esb-client</groupId>
            <artifactId>esb-client</artifactId>
            <version>4.1.3</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/esb-client-4.1.3.jar</systemPath>
        </dependency>

        <!-- Epv jar from nexus -->
        <dependency>
            <groupId>com.fanniemae.sharedservices.evas</groupId>
            <artifactId>evas-sdk</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>18.0</version>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
            <version>4.5.2</version>
        </dependency>
        <dependency>
            <groupId>com.cenqua.clover</groupId>
            <artifactId>clover</artifactId>
            <version>3.1.12</version>
        </dependency>
        <dependency>
            <groupId>com.cenqua.clover</groupId>
            <artifactId>clover</artifactId>
            <version>3.1.12</version>
        </dependency>

        <!-- Voltage jar from nexus -->
        <dependency>
            <groupId>com.fanniemae.hpvltg</groupId>
            <artifactId>hp_voltage_lib</artifactId>
            <version>1.0</version>
        </dependency>

        <dependency>
            <groupId>com.netezza</groupId>
            <artifactId>nzjdbc</artifactId>
            <version>7.2.1</version>
        </dependency>

    </dependencies>

最后一件事,如果我将从错误消息的堆栈跟踪,它指向 ch.qos.logback:logback-classic:jar:1.2.3:compile 它与 org.springframework.boot:spring-boot-starter-web:jar:2.2.8.RELEASE:compile

wecizke3

wecizke31#

我终于解决了这个问题。步骤如下:
通过错误堆栈跟踪找出哪个依赖项导致了这个问题
获取maven依赖插件树。使用此树详细信息可以确定此库是否作为其他依赖项的一部分出现。就我而言 logback-classic 以及 log4j-over-slf4j 我们提出了这个问题。他们在一起 spring-boot-starter-web 使用 <exclusions><exclusion></exclusion></exclusions> 在你的 pom.xml 在这个问题的库的依赖中。在我看来是这样的:

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>logback-classic</artifactId>
                    <groupId>ch.qos.logback</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>log4j-over-slf4j</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
            </exclusions>
        </dependency>

相关问题