Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Adding ServletContextListener causes web app to not deploy

Fenderbosch, Eric

2005-02-11

Replies:

I've got a small web app that's working just fine. As soon as I add a listener, it fails to deploy.

Here's the relevant part of web.xml:

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<context-param>
  <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
  <param-value>net.fender.bazaar.struts.BazaarMessageResources</param-value>
</context-param>
<listener>
  <listener-class>net.fender.bazaar.servlet.BazaarServletContextListener</listener-class>
</listener>

And the VERY simple listener:

package net.fender.bazaar.servlet;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

class BazaarServletContextListener implements ServletContextListener {

  private ServletContext context;

  public void contextDestroyed(ServletContextEvent event) {
    context = null;
  }

  public void contextInitialized(ServletContextEvent event) {
    context = event.getServletContext();
  }
}

And the server log:
INFO: Removing web application at context path /bazaar
Feb 11, 2005 11:16:37 AM org.apache.catalina.core.StandardHostDeployer install
INFO: Processing Context configuration file URL file:C:\java\jakarta-tomcat-5.0.28\conf\Catalina\localhost\bazaar.xml
Feb 11, 2005 11:17:30 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Skipped installing application listeners due to previous error(s)
Feb 11, 2005 11:17:30 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Feb 11, 2005 11:17:30 AM org.apache.catalina.core.StandardContext start
SEVERE: Context startup failed due to previous errors

I'm using Tomcat 5.0.28 and Sun JDK 1.4.2_06-b03.

Any ideas?
TIA


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.