Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug Tomcat Application Startup

Normally, my instance of Tomcat starts-up without any problem. However, when I add a new filter to the 'preview' web app, that application fails to start:

09-Jun-2011 12:23:49 org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
09-Jun-2011 12:23:49 org.apache.catalina.core.StandardContext start
SEVERE: Context [] startup failed due to previous errors
09-Jun-2011 12:23:49 com.polopoly.application.StandardApplication destroy
INFO: Application 'preview' destroy started.

Tomcat itself starts fine - other wars / web apps deploy and start as normal.

As there's no stack trace in the log, I'm not exactly sure what the issue is. I can't connect a remote debugger to the app because it's not running any more. Can I place breakpoints at the init of the app or filter?

What is the best approach / preferred method for debugging issues during the start-up of a web application in Tomcat?

like image 404
Michael Avatar asked Dec 13 '22 12:12

Michael


1 Answers

Sure you can. Just put all tomcat source to your IDE and then start tomcat using

catalina jpda start

Put appropriate break points. For example somewhere org.apache.catalina.core.StandardContext.

If you still cannot catch the problem use command line: -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y

suspend=y is important here.

But I think that the problem is not in tomcat itself but in your application. So, start from debugging it. Put breakpoints into all entry points (servlets, filters, listeners etc. ) If it does not work, do the following.

Comment out everything from your web.xml. Start app. Working? Fine! Now uncomment half of your stuff. And so on.

I believe you will be able to locate the problem. Good luck.

like image 53
AlexR Avatar answered Dec 30 '22 17:12

AlexR