Java Tomcat 启动日志 - 严重:错误 filterStart 如何获取堆栈跟踪?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3016808/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 15:35:55  来源:igfitidea点击:

Tomcat startup logs - SEVERE: Error filterStart how to get a stack trace?

javatomcatlogging

提问by benstpierre

When I start Tomcat I get the following error:

当我启动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

It seems odd that the logs for Tomcat would not include a stack trace. Does somebody have a suggestion for how to increase the logging in Tomcat to get stack traces for errors like this?

Tomcat 的日志不包含堆栈跟踪,这似乎很奇怪。有人对如何增加 Tomcat 中的日志记录以获取此类错误的堆栈跟踪有建议吗?

回答by matt b

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

检查Tomcat 创建的localhost_yyyy_mm_dd.logORlocalhost.yyyy-mm-dd.log日志,这些日志通常存储该类型的信息。我不希望完整的堆栈跟踪被转储到标准输出。

回答by Tommi

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

为 Tomcat 设置 log4j 日志记录非常简单。以下引用自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
  1. 使用以下内容创建一个名为 log4j.properties 的文件并将其保存到 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. 下载 Log4J(v1.2 或更高版本)并将 log4j jar 放在 $CATALINA_HOME/common/lib 中。

  3. 下载 Commons Logging 并将 commons-logging-xyzjar(不是 commons-logging-api-xyzjar)与 log4j jar 一起放在 $CATALINA_HOME/common/lib 中。
  4. 启动Tomcat

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

您可能还想看看http://wiki.apache.org/tomcat/FAQ/Logging

回答by Micha Roon

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

在 WEB-INF/classes 中创建一个名为 logging.properties 的文件,内容如下:

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

回答by Renato

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

也许您的应用程序是使用与 Tomcat 不同的 JRE 编译的。

Check java -versionon 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.

检查java -version您的服务器,然后使用相同版本编译您的代码。我遇到错误是因为我的 Eclipse 标准 JRE 是 1.6,而 Tomcat 使用的是 1.5 - 这行不通。

回答by Assen Kolov

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_BASEis set to ${home}/.IntelliJIdea10/system/tomcat/Unnamed_r6-idea, and the log files are in in [CATALINA_BASE]/logs.

Tomcat 确实会记录堆栈跟踪,但是当从 IDE 启动 tomcat 时,它并不总是清楚日志文件的位置。当我从 IntelliJ 启动它时,CATALINA_BASE设置为${home}/.IntelliJIdea10/system/tomcat/Unnamed_r6-idea,并且日志文件在[CATALINA_BASE]/logs.

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

要查看日志,请找到日志文件,或编辑[CATALINA_HOME]/conf/logging.properties以将 tomcat 记录器输出定向到控制台。下面我在默认的 tomcat 配置中添加了第二个处理程序:

 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:

现在完整的堆栈跟踪出现在 IntelliJ 输出中:

 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)
 . . .

回答by matchew

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.

在花了最后一个小时解决几乎相同的问题后,只想做出贡献。我的解决方案是我们的应用程序 .jar 不知何故已损坏,因此从我们的开发服务器放置 jar 提供了修复。

回答by Prasanna HR

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.

我有一个类似的问题。雷纳托的小费对我有用。我使用了旧版本的 java 类文件(在 WEB-INF/classes 文件夹下),问题消失了。所以,应该是编译器版本不匹配。

回答by Prasanthi

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

如果有人收到类似 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.jaror not. if you dot have u will get above error and ur application will not be available.

然后请检查您的tomcat/lib 目录是否包含cors-filter-1.5.jar。如果你有你会得到上述错误,你的应用程序将不可用。

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

所以,我只是设法从其他 tomcat 文件夹复制了 jar 文件,后来我没有收到上述错误。

回答by Amir Bilal

In CentOS 6 and Solr 4.4.0

在 CentOS 6 和 Solr 4.4.0 中

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

我不得不编译一些 lib 文件来解决这个错误

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

回答by tuku

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 restarttomcat

然后重启tomcat