티스토리 뷰

줍줍/코딩하다 안거

logback 설정 에러

일상다반ㅅㅏ 2019. 6. 6. 16:04

1. SLF4J: Class path contains multiple SLF4J bindings

에러내용 :

1
2
3
4
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/eng/spring_project/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/SampleBoard/WEB-INF/lib/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/eng/spring_project/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/SampleBoard/WEB-INF/lib/slf4j-log4j12-1.6.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
cs

해결방법 : 

에러내용을 보면 slf4j를 사용하는게 여러개 선언되어있다하니 logback이 아닌 다른 태그하나를 주석처리하면 된다.

1
2
3
4
5
6
7
8
9
10
11
12
<!-- multiple SLF4J bindings 에러나와서 주석 처리 (logback랑 겹치나봄) -->
<!-- <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>${org.slf4j-version}</version>
    <scope>runtime</scope>
</dependency> -->
<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>1.2.3</version>
</dependency>
cs

 

2. java.lang.NoClassDefFoundError: org/slf4j/event/LoggingEvent

에러내용 : 

1
2
3
Failed to instantiate SLF4J LoggerFactory
Reported exception:
java.lang.NoClassDefFoundError: org/slf4j/event/LoggingEvent ~~~~ 다음 줄부턴 생략쓰
cs

해결방법 : 

slf4j와 logback-classic버전에러라고 한다. 버전을 변경하면 해결된다.

찾아보면 아래와 같이 해결하라고 나와있다

Logback-classic version 1.1.4 and later require slf4j-api version 1.7.15 or later.

(참고 : https://www.slf4j.org/codes.html#log4j_version 맨아래에 적혁있음)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    ~~~~~ 생략 ~~~~~
    <properties>
        <java-version>1.6</java-version>
        <org.springframework-version>4.2.4.RELEASE</org.springframework-version>
        <org.aspectj-version>1.6.10</org.aspectj-version>
        <org.slf4j-version>1.7.25</org.slf4j-version>
    </properties>
 
    <dependencies>
        ~~~~~ 생략 ~~~~~
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.2.3</version>
        </dependency>
        ~~~~~ 생략 ~~~~~
cs

 

'줍줍 > 코딩하다 안거' 카테고리의 다른 글

mySQL LAST_INSERT_ID()  (0) 2019.06.17
로깅 설정  (0) 2019.05.21
오류와 예외  (0) 2019.05.15
클래스 멤버와 인스턴스 멤버  (0) 2018.12.30
Date와 Timestamp 차이  (0) 2018.12.09