In my Tomcat logs (catalina) I am getting the following error preventing my application from starting up:
SEVERE: Error listenerStart 24-Mar-2009 13:23:10 org.apache.catalina.core.StandardContext start SEVERE: Context [/exampleA] startup failed due to previous errors
I do not know why I am getting this. In my web.xml I have the following
<listener>
<listener-class>
uk.co.a.listener.SessionListener
</listener-class>
</listener>
<listener>
<listener-class>
uk.co.a.listener.SessionAttributeListener
</listener-class>
</listener>
When I comment out the listeners it starts up fine. The code for the listners are below:
public class SessionAttributeListener implements HttpSessionAttributeListener {
static Log log = LogFactory.getLog(SessionAttributeListener.class.getName());
public void attributeAdded(HttpSessionBindingEvent hsbe) {
log.debug("VALUE attributeAdded to THE SESSION:" + hsbe.getName());
}
public void attributeRemoved(HttpSessionBindingEvent hsbe) {
log.debug("VALUE attributeRemoved from THE SESSION:" + hsbe.getName());
}
public void attributeReplaced(HttpSessionBindingEvent hsbe) {
log.debug("VALUE attributeReplaced in THE SESSION:" + hsbe.getName());
}
}
and
public class SessionListener implements HttpSessionListener {
static Log log = LogFactory.getLog(SessionListener.class.getName());
private static int activeSessions = 0;
public void sessionCreated(HttpSessionEvent evt)
{
activeSessions++;
log.debug("No. of active sessions on:"+
new java.util.Date()+" : "+activeSessions);
}
public void sessionDestroyed (HttpSessionEvent evt)
{
activeSessions--;
}
}
Why is this not starting? Or where can I look for more information?
UPDATE
There only seems to be a problem with SessionAttributeListener from starting up. The SessionListener was not starting up because the <listener> were declared after the <servlet>
UPDATE
There was a problem with the JAR file used. The class for SessionAttributeListener was not included. When it was included the application started.
UPDATE
The AttributeListener does not seem to be running. When it is used the code fails. Is there a simple way to check if a listener is running?