Sebastian Biedermann wrote:
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:
<Server>
[...]
<ListenerclassName="TomcatListener"/>
[...]
</Server>
And I have this little Java example code here which I put in
/usr/share/tomcat6/lib/TomcatListener.java :
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 java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at
org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:205)
at org.apache.tomcat.util.digester.Rule.begin(Rule.java:153)
at
org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1356)
... 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?
You may need to compile that and make it a .class, no ?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org