tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian Biedermann <>
Subject Tomcat LifecycleListener
Date Thu, 07 Apr 2011 12:48:21 GMT
Dear List,

I want to programm an Eventlistener for the tomcat6 Server that gives
me an event when a war-file ist started.

So I added a line to the server.xml:


And I have this little Java example code here which I put in
/usr/share/tomcat6/lib/ :

import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;

public class TomcatListener implements LifecycleListener {
   public void lifecycleEvent(LifecycleEvent event) {
     if(event.getType().equals(Lifecycle.BEFORE_START_EVENT)) {
       // do something before Tomcat starts
     else if (event.getType().equals(Lifecycle.AFTER_STOP_EVENT)) {
       // so something after Tomcat shut down

But unfortunately the tomcat server is not starting anymore, the logfile says:

Caused by: java.lang.ClassNotFoundException: TomcatListener
	at Method)
	at java.lang.ClassLoader.loadClass(
	at java.lang.ClassLoader.loadClass(
	at org.apache.tomcat.util.digester.ObjectCreateRule.begin(
	at org.apache.tomcat.util.digester.Rule.begin(
	at org.apache.tomcat.util.digester.Digester.startElement(
	... 20 more
07.04.2011 14:12:09 org.apache.catalina.startup.Catalina start
FATAL: Cannot start server. Server instance is not configured.

Maybe that´s stupid from my side, but I dont know where to put the java or
what´s going wrong there. Do I have to create a .jar?

How can i get this to work?

Thanks for help

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message