tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Eclipse/Error listenerStart problem need Class Loader Configuration Dumper
Date Fri, 03 Jun 2005 16:12:04 GMT

I would like to dump the configuration of a specific instance of a class
loader form within tomcat.  For some reason when I run TC standalone my
listener works no problem, the class loader can find my class from
within my webapp directory.  However when its run under Eclipse it can
not, I notice that Eclipse does not create/copy a
conf/ file.

The problem exhibits itself as a ClassNotFoundException throw because
the class loader can not find my Listener class, but when TC is running
standalone it can be found and the only copy exists within the
WEB-INF/classes directory of my webapp.

So my next step to tracking down this problem is to somehow dump the
configuration status of the "loader" variable within this snipper from
5.5.9.  So that I can identify incorrect CLASSPATH setup or priorities
between to two runtime tomcat setups.

Maybe such verbose dumping code could be included within tomcat and used
to emit a CLASSPATH walk for any ClassNotFoundExceptions thrown, this
really basic error must cause developers many hours of head scratching
when it would be nice if the error message indicated all the paths where
it looked and did not find a matching class.  So at least you know where
it looked.

 From 5.5.9:

    public boolean listenerStart() {

        if (log.isDebugEnabled())
            log.debug("Configuring application event listeners");

        // Instantiate the required listeners
        ClassLoader loader = getLoader().getClassLoader();
        String listeners[] = findApplicationListeners();
        Object results[] = new Object[listeners.length];
        boolean ok = true;
        for (int i = 0; i < results.length; i++) {
            if (getLogger().isDebugEnabled())
                getLogger().debug(" Configuring event listener class '" +
                    listeners[i] + "'");
            try {
                Class clazz = loader.loadClass(listeners[i]);
                results[i] = clazz.newInstance();
            } catch (Throwable t) {
                                  listeners[i]), t);
                ok = false;
        if (!ok) {
            return (false);

Darryl L. Miles

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

View raw message