97

When I start Tomcat I get the following error:

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?

benstpierre
  • 32,833
  • 51
  • 177
  • 288
  • 1
    I am using Guice-Servlet and by doing a try/catch around my setup method for this framework I was able to catch all exceptions and rethrow them after logging myself. I still had to blindly debug getting Guice-Servlet's filter to work but anything added to that seems to just work. – benstpierre Jun 21 '10 at 16:54
  • 1
    It appears that stack traces goto stdout but Intellij does not read the stdout for Tomcat. http://tomcat.apache.org/tomcat-6.0-doc/logging.html I need make stdout in tomcat redirect to a file so Intellij can view it. – benstpierre Jun 22 '10 at 19:28

16 Answers16

138

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.

Siddharth
  • 9,349
  • 16
  • 86
  • 148
matt b
  • 138,234
  • 66
  • 282
  • 345
81

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
Micha Roon
  • 3,957
  • 2
  • 30
  • 48
  • Note that if you don't have a classes directory in WEB-INF, you can just make one and it'll work fine. – Muhd Jul 15 '16 at 20:52
21

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)
 . . .
Tom van der Woerdt
  • 29,532
  • 7
  • 72
  • 105
Assen Kolov
  • 4,143
  • 2
  • 22
  • 32
9

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

tuku
  • 415
  • 5
  • 12
  • 3
    yay, this saved me! . Also it would be a good idea to look at the /path/to/solr/example/resources/log4j.properties and edit your log directory – user9869932 Aug 20 '14 at 21:29
5

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.

Martin Schapendonk
  • 12,893
  • 3
  • 19
  • 24
Renato
  • 51
  • 1
  • 1
2

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/
Amir Bilal
  • 447
  • 3
  • 7
2

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.

1

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.

Prasanthi
  • 11
  • 1
1

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.

user2682165
  • 63
  • 1
  • 2
  • 7
1

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

Vijay
  • 11
  • 1
1

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

Tommi
  • 8,550
  • 5
  • 32
  • 51
  • Will this cause deploy exceptions to actually properly log? – benstpierre Jun 21 '10 at 16:45
  • Yes. I've used this exact method do find causes of problems during deployment. – Tommi Jun 21 '10 at 19:27
  • 1
    I'm sorry but the log file is impenetrable with a log level of DEBUG. It does contain a few exceptions that doesn't seem to have anything to do with the problem - which I suspect is a Struts problem in my case. – Arne Evertsson Nov 07 '10 at 12:23
0

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.

matchew
  • 19,195
  • 5
  • 44
  • 48
0

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.

0

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.

0

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

user1114134
  • 598
  • 1
  • 6
  • 10
-1

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
J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142
Vivek Garg
  • 2,115
  • 1
  • 20
  • 17