Tomcat 启动日志-SEVere: 错误过滤器开始如何获取堆栈跟踪?

当我启动 Tomcat 时,会得到以下错误:

Jun 10, 2010 5:17:25 PM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
Jun 10, 2010 5:17:25 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/mywebapplication] startup failed due to previous errors

Tomcat 的日志不包括堆栈跟踪,这看起来很奇怪。有人对如何增加 Tomcat 中的日志记录以获得类似这样的错误的堆栈跟踪有什么建议吗?

129442 次浏览

Check the localhost_yyyy_mm_dd.log OR localhost.yyyy-mm-dd.log logs that Tomcat creates, these typically store that type of info. I wouldn't expect the full stacktrace to be dumped to standard out.

Setting up log4j logging for Tomcat is pretty simple. The following is quoted from http://tomcat.apache.org/tomcat-5.5-doc/logging.html :

  1. Create a file called log4j.properties with the following content and save it into common/classes.

              log4j.rootLogger=DEBUG, R
    log4j.appender.R=org.apache.log4j.RollingFileAppender
    log4j.appender.R.File=${catalina.home}/logs/tomcat.log
    log4j.appender.R.MaxFileSize=10MB
    log4j.appender.R.MaxBackupIndex=10
    log4j.appender.R.layout=org.apache.log4j.PatternLayout
    log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
    
  2. Download Log4J (v1.2 or later) and place the log4j jar in $CATALINA_HOME/common/lib.

  3. Download Commons Logging and place the commons-logging-x.y.z.jar (not commons-logging-api-x.y.z.jar) in $CATALINA_HOME/common/lib with the log4j jar.
  4. Start Tomcat

You might also want to have a look at http://wiki.apache.org/tomcat/FAQ/Logging

create a file named logging.properties in WEB-INF/classes with following content:

org.apache.catalina.core.ContainerBase.[Catalina].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].handlers = java.util.logging.ConsoleHandler

Maybe your application is compiled with a different JRE than Tomcat.

Check java -version on your server and then compile your code with the same version. I had the error because my Eclipse standard JRE was 1.6 and Tomcat used 1.5 - this can't work.

Tomcat does log the stacktrace, but it is not always clear where the log files are, when tomcat is started from an IDE. When I start it from IntelliJ, CATALINA_BASE is set to ${home}/.IntelliJIdea10/system/tomcat/Unnamed_r6-idea, and the log files are in in [CATALINA_BASE]/logs.

To see the logs, either locate the log files, or edit [CATALINA_HOME]/conf/logging.properties to direct tomcat logger output to console. Below I added a second handler to the default tomcat configuration:

 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

Now the full stacktrace appears in the IntelliJ output:

 Dec 27, 2011 12:02:45 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter filterChainProxy
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'filterChainProxy' is defined   at
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:529)
. . .

Just wanted to contribute after spending the last hour on a nearly identical problem. My solution was that somehow our applicatons .jar was corrupted, so placing the jar from our dev server provided a fix.

I had a similar issue. Renato's tip worked for me. I used a older version of java class files (under WEB-INF/classes folder) and the problem disappeared. So, it should have been the compiler version mismatch.

if anyone is getting error like SEVERE: Error filterStart Apr 29, 2013 4:49:20 PM org.apache.catalina.core.StandardContext startInternal SEVERE: Context [/TraceMW] startup failed due to previous errors

then please check whether your tomcat/lib directory contains cors-filter-1.5.jar or not. if you dot have u will get above error and ur application will not be available.

So, i just managed to copy the jar file from other tomcat folder and i didnt get the above mentioned error later.

In CentOS 6 and Solr 4.4.0

I had to comp some lib files to get this error addressed

cp ~/solr-4.4.0/example/lib/ext/* /usr/share/tomcat6/lib/

you need to copy the files

cp /path/to/solr/example/lib/ext/* /path/to/tomcat/lib
cp /path/to/solr/example/resources/* /path/to/tomcat/lib // or inside extracted solr

and then restart tomcat

This did the trick for me:Just remove all the libraries and then compile and run. It would prompt their are errors in your project confirm. Rerun the project after applying the libraries.

I too got the same error and struggled a lot in fixing this issue. Spent quiet a bit time in searching Google and found the following solution and my issue got resolved.

the issue was due to, missing Struts2 Libraries in the deployment path. Most of the folks may put the libraries for compilation and tend to forget to attach required libraries for run-time. So I added the same libraries in the web deployment assembly, and the issue was OFF.

Generally Server JDK version will be lower than the deployed application (built with higher jdk version)

I got the same issue, unable to start the application once it is deployed in tomcat. But, once I copy the Struts set of jars into CATALINA_HOME\lib (Tomcat dir) directory it is resolved. You don't need to have these jars in your WEB_INF\lib but you need to have them in your Build Path.

commons-fileupload-1.2.1.jar

commons-io-1.3.2.jar

freemarker-2.3.16.jar

javassist-3.11.0.GA.jar

struts2-convention-plugin-2.2.1.jar

struts2-core-2.2.1.jar

xwork-core-2.2.1.jar

Usually there is an information about the problem in localhost.[date].log. But sometimes there is nothing in this log. This can happen if there is messed configuration of the project (several developers worked on it for a long time and each added something from himself). I faced this problem WITHOUT any information in log. Rather fast and robust approach:

  1. Try to remove everything which can cause any problem from web.xml. You even can remove everything except tag. If application still cannot be deployed - go on.

  2. Remove every *.xml descriptor from WEB-INF/classes. If application cannot be deployed - go on.

  3. Remove all logging configuration you can find in your war (logging.properties, log4j.properties). Try to deploy. At this step I've got more informative error, but deployment still failed.

After googling for this error I found out that project included old version of xerces, which clashed with Tomcat's version (which was newer) and didn't the application to be deployed. After upgrade of xerces in web-application everything became fine.

Run Following command to show catalina logs on the terminal---

sh start-camunda.sh; tail -f server/apache-tomcat-8.0.24/logs/catalina.out