Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
“线程中的异常”;“主要”;java.lang.ExceptionInInitializeError:log4j-slf4j-impl不能与log4j-to-slf4j一起出现_Java_Maven_Log4j - Fatal编程技术网

“线程中的异常”;“主要”;java.lang.ExceptionInInitializeError:log4j-slf4j-impl不能与log4j-to-slf4j一起出现

“线程中的异常”;“主要”;java.lang.ExceptionInInitializeError:log4j-slf4j-impl不能与log4j-to-slf4j一起出现,java,maven,log4j,Java,Maven,Log4j,即使我已经从pom.xml文件中删除了log4j-to-slf4j和log4j-slf4j-impl的依赖项,我仍然会收到相同的错误。我已经在终端中执行了一个mvn依赖项:清除本地存储库和mvn清理验证,但错误似乎仍然存在。有什么帮助吗 我认为依赖项中存在一些错误,但无法找出其中的位置。我想使用log4j2和slf4j进行日志记录 Exception in thread "main" java.lang.ExceptionInInitializerError at c

即使我已经从pom.xml文件中删除了log4j-to-slf4j和log4j-slf4j-impl的依赖项,我仍然会收到相同的错误。我已经在终端中执行了一个mvn依赖项:清除本地存储库mvn清理验证,但错误似乎仍然存在。有什么帮助吗

我认为依赖项中存在一些错误,但无法找出其中的位置。我想使用log4j2和slf4j进行日志记录

Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.moveinsync.routeconfiguration.application.RouteConfigurationCrudApplication.main(RouteConfigurationCrudApplication.java:10)
Caused by: org.apache.logging.log4j.LoggingException: log4j-slf4j-impl cannot be present with log4j-to-slf4j
    at org.apache.logging.slf4j.Log4jLoggerFactory.validateContext(Log4jLoggerFactory.java:49)
    at org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:39)
    at org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:30)
    at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:54)
    at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:30)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:363)
    at org.apache.commons.logging.LogAdapter$Slf4jAdapter.createLocationAwareLog(LogAdapter.java:130)
    at org.apache.commons.logging.LogAdapter.createLog(LogAdapter.java:91)
    at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:67)
    at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:59)
    at org.springframework.boot.SpringApplication.<clinit>(SpringApplication.java:196)
    ... 1 more
线程“main”java.lang.ExceptionInInitializeError中的异常 位于com.moveinsync.routeconfiguration.application.routeconfiguration CrudApplication.main(routeconfiguration CrudApplication.java:10) 原因:org.apache.logging.log4j.LoggingException:log4j-slf4j-impl不能与log4j-to-slf4j一起出现 位于org.apache.logging.slf4j.Log4jLoggerFactory.validateContext(Log4jLoggerFactory.java:49) 位于org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:39) 位于org.apache.logging.slf4j.Log4jLoggerFactory.newLogger(Log4jLoggerFactory.java:30) 位于org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:54) 位于org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:30) 位于org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:363) 位于org.apache.commons.logging.LogAdapter$Slf4jAdapter.createLocationAwareLog(LogAdapter.java:130) 位于org.apache.commons.logging.LogAdapter.createLog(LogAdapter.java:91) 位于org.apache.commons.logging.LogFactory.getLog(LogFactory.java:67) 位于org.apache.commons.logging.LogFactory.getLog(LogFactory.java:59) 位于org.springframework.boot.SpringApplication(SpringApplication.java:196) ... 还有一个 下面是我的pom.xml文件的依赖项部分。请看一看,帮我找出我做错了什么

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
            <version>2.3.4.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-bom</artifactId>
            <version>2.13.3</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>

        <!--SLF4J Bridge
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>2.13.3</version>
        </dependency>-->

        <!--Web Servlet Support-->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-web</artifactId>
            <version>2.13.3</version>
        </dependency>

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

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <!--<version>${logback.version}</version>-->
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.30</version>
        </dependency> -->

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

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-aws</artifactId>
            <version>2.2.2.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>5.2.9.RELEASE</version>
            <exclusions>
                <!-- Exclude Commons Logging in favor of SLF4j -->
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.3.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-io</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>5.2.9.RELEASE</version>
        </dependency>
        <!-- Spring -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.7.2</version>
        </dependency>
        <!-- MoveInSync Dependencies-->
        <dependency>
            <groupId>com.moveinsync.routeconfiguration</groupId>
            <artifactId>mis-routeconfiguration-model</artifactId>
            <version>2.1.4-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>com.moveinsync.routeconfiguration</groupId>
            <artifactId>mis-routeconfiguration-client</artifactId>
            <version>2.1.8-SNAPSHOT</version>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-aws-context -->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-aws-context</artifactId>
                <version>2.2.2.RELEASE</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.3.4.RELEASE</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                            <mainClass>theMainClass</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
spring-boot-starter-log4j2
2.3.4.1发布
org.apache.logging.log4j
log4japi
org.apache.logging.log4j
log4j型芯
org.apache.logging.log4j
log4j物料清单
2.13.3
进口
聚甲醛
org.apache.logging.log4j
log4jweb
2.13.3
回写
回归经典
1.2.3
测试
回写
回溯堆芯
org.springframework.boot
springbootstarter缓存
org.springframework.cloud
春天的云
2.2.2.1发布
org.springframework.boot
spring引导配置处理器
真的
org.springframework
spring上下文
5.2.9.1发布
公用记录
公用记录
org.apache.commons
commons-lang3
3.3.2
org.apache.commons
公地io
1.3.2
文件上传
文件上传
1.3
org.springframework
弹簧网
5.2.9.1发布
org.aspectj
aspectjweaver
1.7.2
com.moveinsync.routeconfiguration
mis路由配置模型
2.1.4-快照
com.moveinsync.routeconfiguration
错误路由配置客户端
2.1.8-快照
org.springframework.cloud
SpringCloudAWS上下文
2.2.2.1发布
org.springframework.boot
springbootmaven插件
2.3.4.1发布
org.apache.maven.plugins
maven jar插件
3.2.0
真的
解放党/
主课