Tomcat start error: severe: error listener start

Tomcat start error: severe: error listener start

problem

Today, we deal with a problem. After modifying the code and deploying it to the server, we report an error when starting Tomcat. The error message is as follows:

org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/projectname] startup failed due to previous errors

error listener this error message is too vague. Check it web.xml We need more detailed log information to know what caused the error, so that we can quickly locate the error point. So we need to modify the log level of Tomcat to output what we need.

method

Create a new file called in the WEB-INF/classes directory logging.properties , as follows

handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler  

org.apache.juli.FileHandler.level = FINE  
org.apache.juli.FileHandler.directory = ${catalina.base}/logs  
org.apache.juli.FileHandler.prefix = error-debug.   

java.util.logging.ConsoleHandler.level = FINE  
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter 

In this way, Tomcat's own log is used for log output.

After adding the log output configuration file, you can see the detailed error report after restart. After looking at the log, I found my own error, because the JDK version used by my local compilation environment is higher than that of the server. As a result, spring failed to initialize the bean, and Tomcat started with an error.
Everyone's mistakes are not the same, so I won't repeat the following mistakes.

Read More: