简体   繁体   English

获取 java.lang.IllegalStateException:在 Spring 启动中执行测试 class 时检测到 Logback 配置错误

[英]Getting java.lang.IllegalStateException: Logback configuration error detected while executing Test class in Spring boot

Exception while running Test class in spring boot Application:在 spring 启动应用程序中运行测试 class 时出现异常:

2020-07-12 00:17:51,654 [main] INFO org.jsmart.zerocode.core.utils.RunnerUtils - ### testClass : class GetTest.GetFileTest
Logging system failed to initialize using configuration from 'file:/C:/Users/Desktop/pts-mi-sourcecode/acquiring-api/common-config/target/classes/log4j2-local.xml'
java.lang.IllegalStateException: Logback configuration error detected: 
ERROR in ch.qos.logback.core.joran.spi.Interpreter@20:13 - no applicable action for [Appenders], current ElementPath  is [[Configuration][Appenders]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@21:73 - no applicable action for [Console], current ElementPath  is [[Configuration][Appenders][Console]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@22:19 - no applicable action for [PatternLayout], current ElementPath  is [[Configuration][Appenders][Console][PatternLayout]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@23:14 - no applicable action for [pattern], current ElementPath  is [[Configuration][Appenders][Console][PatternLayout][pattern]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@27:200 - no applicable action for [RollingFile], current ElementPath  is [[Configuration][Appenders][RollingFile]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@30:26 - no applicable action for [JsonLayout], current ElementPath  is [[Configuration][Appenders][RollingFile][JsonLayout]]

Test Class:测试 Class:

import org.jsmart.zerocode.core.domain.JsonTestCase;
import org.jsmart.zerocode.core.domain.TargetEnv;
import org.junit.Test;
import org.junit.runner.RunWith;

import testrunner.ZerocodeSpringBootRunner;

@TargetEnv("application.properties")
@RunWith(ZerocodeSpringBootRunner.class)
public class GetFileTest {
    
     

    @Test
    @JsonTestCase("test_Merchant_Profile.json")
    public void testGETOk(){

    }

}

You obviously have configured your application to use the Logback libraries but are attempting to use a Log4j 2 configuration.您显然已将应用程序配置为使用 Logback 库,但正在尝试使用 Log4j 2 配置。 Logback won't understand the syntax of a Log4j 2 configuration file. Logback 无法理解 Log4j 2 配置文件的语法。 You either need to provide a Logback configuration file or replace the Logback dependencies with Log4j 2 dependencies.您要么需要提供 Logback 配置文件,要么将 Logback 依赖项替换为 Log4j 2 个依赖项。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 获取 java.lang.IllegalStateException: Logback 配置错误检测到错误 - Getting java.lang.IllegalStateException: Logback configuration error detected error DAO 层测试:java.lang.IllegalStateException:配置错误:为测试类找到多个@BootstrapWith 声明 - DAO Layer test: java.lang.IllegalStateException: Configuration error: found multiple declarations of @BootstrapWith for test class java.lang.IllegalStateException:在使用 spring boot 实现开放 api 时无法读取类的元数据 - java.lang.IllegalStateException: Unable to read meta-data for class while implementing open api with spring boot Spring Ehcache 配置:java.lang.IllegalStateException:错误 - Spring Ehcache configuration : java.lang.IllegalStateException: error Spring Boot 集成测试抛出错误“java.lang.IllegalStateException: Timeout on blocking read for 5000 MILLISECONDS” - Spring Boot Integration test throws error "java.lang.IllegalStateException: Timeout on blocking read for 5000 MILLISECONDS" java.lang.IllegalStateException:配置错误:为测试类找到了@BootstrapWith的多个声明 - java.lang.IllegalStateException: Configuration error: found multiple declarations of @BootstrapWith for test class 春季启动 java.lang.IllegalStateException - Spring boot java.lang.IllegalStateException Spring JPA测试java.lang.IllegalStateException - Spring JPA Test java.lang.IllegalStateException 使用 Spring Boot 从 Kafka 消费时启动 gradle 项目时出错:“java.lang.IllegalStateException: Error processing condition on ...” - Error in starting gradle project while using Spring Boot to Consume from Kafka: "java.lang.IllegalStateException: Error processing condition on ..." java.lang.IllegalStateException: Failed to read Class-Path attribute from manifest of jar error using Selenium through Maven in Spring Boot - java.lang.IllegalStateException: Failed to read Class-Path attribute from manifest of jar error using Selenium through Maven in Spring Boot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM