Monday, January 30, 2017

Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError.

Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError.


Solution:


So you have to exclude conflict dependencies. Try this:

 <exclusion>
   <groupid>org.slf4j</groupid>
   <artifactid>slf4j-log4j12</artifactid>
  </exclusion>
  <exclusion>
   <groupid>log4j</groupid>
   <artifactid>log4j</artifactid>
  </exclusion>
 </exclusions>


This solved same problem with slf4j and Dozer.

log4j-over-slf4j.jar and slf4j-log4j12.jar cannot be present simultaneously


The presence of slf4j-log4j12.jar, that is the log4j binding for SLF4J, will force all SLF4J calls to be delegated to log4j. The presence of log4j-over-slf4j.jar will in turn delegate all log4j API calls to their SLF4J equivalents. If both are present simultaneously, slf4j calls will be delegated to log4j, and log4j calls redirected to SLF4j, resulting in an endless loop.

Resource Link: https://www.slf4j.org/legacy.html#log4jRecursion


My pom.xml
----------
<pre class="brush: py">
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>me.kaka.web.relayfile.conf</groupId>
<artifactId>KakaRelayConf</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>OttaRelayConf</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
<relativePath />
<!-- lookup parent from repository -->
</parent>
<properties>
<java.version>1.7</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.spy</groupId>
<artifactId>spymemcached</artifactId>
<version>2.9.1</version>
<scope>compile</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>javax.servlet</groupId> -->
<!-- <artifactId>servlet-api</artifactId> -->
<!-- <version>2.5</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>javax.servlet</groupId> -->
<!-- <artifactId>javax.servlet-api</artifactId> -->
<!-- <version>3.1.0</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>javax</groupId> -->
<!-- <artifactId>javaee-web-api</artifactId> -->
<!-- <version>7.0</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<!-- https://mvnrepository.com/artifact/aopalliance/aopalliance -->
<dependency>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.32</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.3.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slim3</groupId>
<artifactId>slim3</artifactId>
<version>1.0.16</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.7.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.30</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.appengine/appengine-api-labs -->
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-labs</artifactId>
<version>1.7.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-el -->
<!-- <dependency> -->
<!-- <groupId>org.apache.tomcat.embed</groupId> -->
<!-- <artifactId>tomcat-embed-el</artifactId> -->
<!-- <version>8.0.33</version> -->
<!-- </dependency> -->
<dependency>
<groupId>com.github.isrsal</groupId>
<artifactId>spring-mvc-logger</artifactId>
<version>0.2</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- <plugin> -->
<!-- <groupId>org.springframework.boot</groupId> -->
<!-- <artifactId>spring-boot-maven-plugin</artifactId> -->
<!-- <configuration> -->
<!-- <mainClass>me.kaka.web.relayfile.conf.controller.Application</mainClass> -->
<!-- </configuration> -->
<!-- </plugin> -->
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<packagingIncludes>WEB-INF/lib/*.jar</packagingIncludes>
</configuration>
</plugin>
</plugins>
<finalName>ROOT</finalName>
</build>
</project>
</pre>

<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">
<modelVersion>4.0.0</modelVersion>
<groupId>me.kaka.web.relayfile.conf</groupId>
<artifactId>KakaRelayConf</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>OttaRelayConf</name>
<url>http://maven.apache.org</url>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<java.version>1.7</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.spy</groupId>
<artifactId>spymemcached</artifactId>
<version>2.9.1</version>
<scope>compile</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>javax.servlet</groupId> -->
<!-- <artifactId>servlet-api</artifactId> -->
<!-- <version>2.5</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->

<!-- <dependency> -->
<!-- <groupId>javax.servlet</groupId> -->
<!-- <artifactId>javax.servlet-api</artifactId> -->
<!-- <version>3.1.0</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->

<!-- <dependency> -->
<!-- <groupId>javax</groupId> -->
<!-- <artifactId>javaee-web-api</artifactId> -->
<!-- <version>7.0</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->

<!-- https://mvnrepository.com/artifact/aopalliance/aopalliance -->
<dependency>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
<version>1.0</version>
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.32</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.3.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slim3</groupId>
<artifactId>slim3</artifactId>
<version>1.0.16</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.7.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.30</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.appengine/appengine-api-labs -->
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-labs</artifactId>
<version>1.7.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-el -->
<!-- <dependency> -->
<!-- <groupId>org.apache.tomcat.embed</groupId> -->
<!-- <artifactId>tomcat-embed-el</artifactId> -->
<!-- <version>8.0.33</version> -->
<!-- </dependency> -->

<dependency>
<groupId>com.github.isrsal</groupId>
<artifactId>spring-mvc-logger</artifactId>
<version>0.2</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- <plugin> -->
<!-- <groupId>org.springframework.boot</groupId> -->
<!-- <artifactId>spring-boot-maven-plugin</artifactId> -->
<!-- <configuration> -->
<!-- <mainClass>me.kaka.web.relayfile.conf.controller.Application</mainClass> -->
<!-- </configuration> -->
<!-- </plugin> -->
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<packagingIncludes>WEB-INF/lib/*.jar</packagingIncludes>
</configuration>
</plugin>
</plugins>

<finalName>ROOT</finalName>
</build>
</project>

Resource Link: http://stackoverflow.com/questions/20117720/detected-both-log4j-over-slf4j-jar-and-slf4j-log4j12-jar-on-the-class-path-pree

No comments:

Post a Comment