Extracting startup errors from Spring contexts
Consider the following output from a Tomcat server under Eclipse:
INFO: Initializing Coyote HTTP/1.1 on http-8080
INFO:开发者_StackOverflow社区 Initialization processed in 634 ms
INFO: Starting service Catalina
INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
SEVERE: Error listenerStart
SEVERE: Context [/MyServlet] startup failed due to previous errors
I would like to figure out what exception caused "Error listenerStart", but Spring seems to be preventing me from finding the error via Eclipse. I'd love to start Catalina manually, but that doesn't seem to do anything.
What's the best way to find the hidden exception? I'm not afraid to use torture methods.
In my case, the answer was:
- Debug
java.util.logging.SimpleLogger
to find out what exceptions were being hidden. - Figure out that my
logging.properties
file, cut-and-pasted from the Tomcat docs, was bunk. Several exceptions were going into black holes in log files (maybe they weren't flushed)? Switching everything to a singleConsoleLogger
enabled me to see all exceptions. - Make sure that
-Djava.util.logging.config.file="/<path>/logging.properties"
was present in my Run Configuration.
Try to configure logger (Log4j for example) and log errors to console.
Check tomcat's logs directory, see if it logged to an alternate log file.
精彩评论