Aug 11th, 2006, 04:30 AM
SEVERE: Error listenerStart - finding the error
I often think about adding little bits of information as I learn more. Then after a while the information seems trivial - obviously since I've learned it and I can no longer remember the key fact that is needed to pass on. However, this is one I have to pass on. Maybe most of you already know this but I;m sure some won't!
Ever get the SEVERE: Error listenerStart and can't find the error? Logs don't seem to help since this is a container start up problem.
use a plugin
I'm using tomcat - and whilst I understand Jetty is meant to be good for development, it doesn't seem to yet support eclipse 3.2. You probably have a script to start and restart tomcat or using a plugin to restart it. I'm using sysdeo (http://www.eclipseplugincentral.com/...k-cid-120.html) which seemed to me to be the most common. With the sysdeo plug in I can start my tomcat in eclipse which can link in to the debugger.
attach the source
in your build path (project properties, java build path) select the libraries tab and the spring jar. Expand the + and click on source attachemtent, and edit the path to be the spring source 'src' directory.
in the spring jar on the build path, find org.springframework.web.context and the ContextLoaderListener class. Set a breakpoint at line 49, which will read this.contextLoader.initWebApplicationContext(event .getServletContext());
find the error!
Now when you start tomcat from within an eclipe plugin it will stop at the above. Choose to 'step return' once and then wait for the container to load everything up and find an error. If there is an error you will now be at standardcontext.listenerstart and you can now look at the error in the variable window under 't'. There are 'cause' error, make sure you take a look at them all since some can be wrapped/hidden. If you're using hibernate, I find that this does show the hbm mapping file problems, but the actual bean which causes the error can be wrong - it seems to just take the first bean in its list!
Good luck. Hopefully I and others will no longer spend a day wasting time scanning for errors!