증상

log4j 1.2.15와 1.2.17 을 사용할 경우 다음 에러 발생

[ERROR] Failed to execute goal on project TSAStatus: Could not resolve dependencies for project xxx. The following artifacts could not be resolved: com.sun.jdmk:jmxtools:jar:1.2.1, com.sun.jmx:jmxri:jar:1.2.1: Could not transfer artifact com.sun.jdmk:jmxtools:jar:1.2.1 from/to java.net (https://maven-repository.dev.java.net/nonav/repository): No connector available to access repository java.net (https://maven-repository.dev.java.net/nonav/repository) of type legacy using the available factories WagonRepositoryConnectorFactory -> [Help 1]

 

원인

1.2.15 부터 다음 artifact 에 대해 depedancy 가 걸렸으나(http://logging.apache.org/log4j/1.2/changes-report.html) repository 에 없어서 발생

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

 

해결

#1

  1. JCL의 Facade Framework 인 slf4j 를 사용하면 적절한 log4j 를 연결해 줌.

    <dependency>
    	<groupId>org.slf4j</groupId>
    	<artifactId>slf4j-log4j12</artifactId>
    	<version>1.7.5</version>
    </dependency>
    XML

 

#2

  1. log4j 1.2.16 을 사용(https://issues.apache.org/bugzilla/show_bug.cgi?id=43304) - 1.2.17 도 동일한 문제가 발생하므로 1.2.16을 써야 함
  2. dependancy artifact 를 받아서 사용하는 nexus repository 에 넣어줌.

Ref