Accessing classes across Web App's servlet contexts

A

Albretch

I am using Apache Tomcat/4.1.18 and need for a class to be accessed
across all web app contexts.

The class is read-only (no update of any kinds), singleton type of
class that is (as all singletons should) NOT lazy loaded, but all its
members are set via static initialization. (kind of a global
reference)

Now, how/where do you deploy/place this class for it to be accessed
by all
servlets?

I have tried a number of places inside Tomcat, but I have always
gotten

java.lang.IllegalAccessError or java.lang.NoClassDefFoundError

while trying to access this class.

I could imagine this was a common need and did online searches which
answers could be basically reduced to:

. putting the classes in shared/classes/ or common/classes/ or

. putting the jars in common/lib or shared/lib

. store the singleton instance in the system properties

The first two options did not work and the third one I find
unnatural. Since there are libraries and clasees that are used across
webapps, I think there must be a natural way to do this.

What am I missing here?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top