Java Learning -051-detected both Log4j-over-slf4j.jar and bound Slf4j-log4j12.jar on the class path, preempting Stackoverflowerror

Source: Internet
Author: User
Tags addchild

Error message: Detected both Log4j-over-slf4j.jar and bound Slf4j-log4j12.jar on the class path, preempting stackoverflowerror

Scene:

product server using spring-boot Framework Development,zookeeper as a micro-service framework, the package is completed after the discovery service can not start,Tomcat The startup error log appears as follows:

Log text Details:

1 08-nov-2017 11:32:10.984 INFO [localhost-startstop-1] org.apache.jasper.servlet.TldScanner.scanJars at least one  JAR is scanned for TLDs yet contained no TLDs. Enable debug logging for the logger for a all list of JARs that were Scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.2 slf4j:class path contains multiple slf4j bindings.3 slf4j:found binding in [jar:file:/shenmajr/shenma-frss-web/webapps/root/web-inf/lib/slf4j-log4j12-1.7.25.jar! /org/slf4j/impl/staticloggerbinder.class]4 slf4j:found binding in [jar:file:/shenmajr/shenma-frss-web/webapps/root/web-inf/lib/ Logback-classic-1.1.11.jar!/org/slf4j/impl/staticloggerbinder.class]5 Slf4j:see http://www.slf4j.org/codes.html#multiple_bindings for an explanation.6 slf4j:detected both Log4j-over-slf4j.jar and bound Slf4j-log4j12.jar on the class path, preempting stackoverflowerror . 7 Slf4j:see also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.8 08-nov-2017 11:32:11.129 SEVERE [localhost-startstop-1] Org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild:start:9 org.apache.catalina.LifecycleException:Failed to start component [Standardengine[catalina]. Standardhost[localhost]. Standardcontext[]]Ten At Org.apache.catalina.util.LifecycleBase.start (lifecyclebase.java:153) One At org.apache.catalina.core.ContainerBase.addChildInternal (containerbase.java:725) A At Org.apache.catalina.core.ContainerBase.addChild (containerbase.java:701) - At Org.apache.catalina.core.StandardHost.addChild (standardhost.java:717) - At Org.apache.catalina.startup.HostConfig.deployWAR (hostconfig.java:940) the At Org.apache.catalina.startup.hostconfig$deploywar.run (hostconfig.java:1816) - At Java.util.concurrent.executors$runnableadapter.call (executors.java:511) - At Java.util.concurrent.FutureTask.run (futuretask.java:266) - At Java.util.concurrent.ThreadPoolExecutor.runWorker (threadpoolexecutor.java:1142) + At Java.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:617) - At Java.lang.Thread.run (thread.java:745) + caused By:java.lang.ExceptionInInitializerError AAt Org.slf4j.impl.StaticLoggerBinder.<Init>(staticloggerbinder.java:72) atAt Org.slf4j.impl.StaticLoggerBinder.<Clinit>(staticloggerbinder.java:45) - At Org.slf4j.LoggerFactory.bind (loggerfactory.java:150) - At org.slf4j.LoggerFactory.performInitialization (loggerfactory.java:124) - At org.slf4j.LoggerFactory.getILoggerFactory (loggerfactory.java:412) - At Org.slf4j.LoggerFactory.getLogger (loggerfactory.java:357) - At org.apache.commons.logging.impl.SLF4JLogFactory.getInstance (slf4jlogfactory.java:155) in At org.apache.commons.logging.impl.SLF4JLogFactory.getInstance (slf4jlogfactory.java:132) - At Org.apache.commons.logging.LogFactory.getLog (logfactory.java:273) to At Org.springframework.boot.web.support.SpringBootServletInitializer.onStartup ( springbootservletinitializer.java:85) + At Org.springframework.web.SpringServletContainerInitializer.onStartup ( springservletcontainerinitializer.java:169) - At org.apache.catalina.core.StandardContext.startInternal (standardcontext.java:5292) the At Org.apache.catalina.util.LifecycleBase.start (lifecyclebase.java:147) *     ... Ten more $ caused by:java.lang.IllegalStateException:Detected both Log4j-over-slf4j.jar and bound Slf4j-log4j12.jar on the CLA SS Path, preempting stackoverflowerror. See also Http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.Panax NotoginsengAt Org.slf4j.impl.Log4jLoggerFactory.<Clinit>(log4jloggerfactory.java:54) -... More

The workaround is as follows:

class Library conflicts are caused by the load class when Tomcat starts loading the class library. by viewing the dependencies of the MAVEN project Engineering Library through the MVN dependency:tree command, you can find references such as the following slf4j-log4j12 class Library, so this reference relies on exclusions cancellation in Project Engineering .

(⊙o⊙) ..., the red box is misplaced, everyone do not blame ha

There may be a variety of conflicts in the actual project, but it is easier to solve such problems with a little effort to check the dependencies of the conflict.

Java Learning -051-detected both Log4j-over-slf4j.jar and bound Slf4j-log4j12.jar on the class path, preempting Stackoverflowerror

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.