directory

Tomcat starts the Maven project on a Linux system

The project error contents are as follows:

Key points:

Solutions:

Take a look at three screenshots for details:

1 Directory Structure

2 Project package name

3. Add code: Remove the JAR

4. Find slf4J-log4j12xxx. jar in lib and delete it



Tomcat starts the Maven project on a Linux system

If log4J-over-slf4j. jar and slf4j-log4j12.jar are in the same class, the log4j-over-slf4j.jar and slf4j-log4j12.jar are in the same class.

The project error contents are as follows:

logger for a complete 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.
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/tomcat/apache-tomcat-8.053./webapps/Lj_Porject/WEB-INF/lib/slf4j-log4j12-1.725..jar! /org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/tomcat/apache-tomcat-8.053./webapps/Lj_Porject/WEB-INF/lib/logback-classic-1.111..jar! /org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path.preempting StackOverflowError. 
SLF4J: See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
22-Jan-2019 11:21:42.834 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: 
 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Lj_Porject]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:755)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:731)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:973)
	at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1850)
	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:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ExceptionInInitializerError
	at org.slf4j.impl.StaticLoggerBinder.<init>(StaticLoggerBinder.java:72)
	at 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 ch.qos.logback.classic.util.StatusViaSLF4JLoggerFactory.addStatus(StatusViaSLF4JLoggerFactory.java:32)
	at ch.qos.logback.classic.util.StatusViaSLF4JLoggerFactory.addInfo(StatusViaSLF4JLoggerFactory.java:20)
	at ch.qos.logback.classic.servlet.LogbackServletContainerInitializer.onStartup(LogbackServletContainerInitializer.java:32)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5352)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)...10 more
Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path.preempting StackOverflowError. See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
	at org.slf4j.impl.Log4jLoggerFactory.<clinit>(Log4jLoggerFactory.java:54)...20 more

22-Jan-2019 11:21:42.836 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive /home/tomcat/apache-tomcat-8.053./webapps/Lj_Porject.war
 java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Lj_Porject]]
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:731)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
	at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:973)
	at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1850)
	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:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

22-Jan-2019 11:21:42.836 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /home/tomcat/apache-tomcat-8.053./webapps/Lj_Porject.war has finished in 8,059 ms
22-Jan-2019 11:21:42.838 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /home/tomcat/apache-tomcat-8.053./webapps/examples
22-Jan-2019 11:22:39.968 WARNING [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [57.036] milliseconds.
22-Jan-2019 11:22:39.979 INFO [local
Copy the code

Key points:

Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path, preempting StackOverflowError. See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
	at org.slf4j.impl.Log4jLoggerFactory.<clinit>(Log4jLoggerFactory.java:54)
	... 20 more
Copy the code

The reason is that log4J-over-SLf4J and SLf4J-log4j12 are two JARS associated with the Java logging system that can cause stack overflow exceptions when they are both in the classpath.

Solutions:

In the POM.xml file, add the <exclusion> tag to the used dependency packages to exclude SLf4J-log4j12.jar

For example: red font is excluded content

< the dependency > < groupId > org, apache hadoop < / groupId > < artifactId > hadoop – client < / artifactId > < version > server < / version >



org.slf4j


slf4j-log4j12


 

 

Take a look at three screenshots for details:

1 Directory Structure

 

 

2 Project package name

 

 

3. Add code: Remove the JAR

 

4.Find slf4J-log4j12xxx. jar in lib and delete it before packing ok

 

Ok, then go to the Linux system to start the project!