I am not an expert on this, but here are my thoughts for what it is worth.
You will need to place the class in the COMMON folder so both your webapps
and TOMCAT itself can see it.  However, you will have to dig through the docs
on Tomcat and see what parameter (probably in the server.xml) file you will
have to set to use your LifeCycleListener class instead of TOMCAT's.

-----Original Message-----
From: Simon Watson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 05, 2006 12:29 PM
To: users@tomcat.apache.org
Subject: Lifecycle listener class loading problem

I'm trying to implement a lifecycle listener to initialise and, more
importantly, shutdown a resource that I wish to access from multiple
webapps.

If I put my listener class in common/classes then I get an error on startup:
SEVERE: Begin event threw error
java.lang.NoClassDefFoundError: org/apache/catalina/LifecycleListener

If I put the listener class in server/classes then the server starts
up ok but the class can't be used by any webapps. Is there a way
around this?

To describe the bigger picture, I have a singleton class that is
managing a resource via JNI that is required by several webapps. It's
important that I can control the initialisation/shutdown of this
resource. I've tried a shutdownhook and a finalize method but neither
of these are invoked by Tomcat when it shuts down, hence my interest
in a lifecycle listener. Because the resource is used across multiple
webapps, the standard contextlistener approach won't work.

I'm running Tomcat 5.5 as a Windows service.

Any help/suggestions would be much appreciated.

Simon.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to