Search code examples
servletstomcat7java-ee-6servletcontextlistenerservlet-listeners

Servlet Context Listener preventing webapp from loading


I am creating a Java Servlet application which requires a pool of database connections. I have implemented the ConnectionPool class as a ServletContextListener, overriding contextInitialized and contextDestroyed. I also declared it as a listener in the web.xml. Stack exchange did not allow me to post the code directly, saying it was too much code, so I have put pastebin links to my code.

When I deploy the web app, it does not start it. When I try to start it manually, the tomcat manager app is unable to do so. It gives me a generic error message. The log I have posted starts after deploying, but before manually starting.

My catalina.out file
My connection pool file
My web.xml file


Solution

  • I realized what went wrong. When I looked through my code, I realized I never initialized a variable that I was referencing. When I corrected that, my code ran smoothly. Moral of the story: Everyone makes mistakes; use exception handling on everything!