tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomcat-users.l...@the-morg.org
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/catalina.properties 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:
./jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java:3602

    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) {
                getLogger().error
                    (sm.getString("standardContext.applicationListener",
                                  listeners[i]), t);
                ok = false;
            }
        }
        if (!ok) {
            getLogger().error(sm.getString("standardContext.applicationSkipped"));
            return (false);
        }



--
Darryl L. Miles

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message