tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Caldarale, Charles R" <>
Subject RE: How to use catalina classloader
Date Wed, 25 Oct 2006 16:32:21 GMT
> From: Ravi116 [] 
> Subject: RE: How to use catalina classloader
> Wondering if the code loads with Catalina
> classloader based on package structure ?

Looks to me like either that or the privileged flag should work.  Here's
the relevant code snippets from

            // Special case class loader for a container provided
            if (isContainerProvidedServlet(actualClass) && 
                    ! ((Context)getParent()).getPrivileged() ) {
                // If it is a priviledged context - using its own
                // class loader will work, since it's a child of the
                // loader
                classLoader = this.getClass().getClassLoader();

            // Special handling for ContainerServlet instances
            if ((servlet instanceof ContainerServlet) &&
                  (isContainerProvidedServlet(actualClass) ||
                    ((Context)getParent()).getPrivileged() )) {
                ((ContainerServlet) servlet).setWrapper(this);

     * Return <code>true</code> if the specified class name represents a
     * container provided servlet class that should be loaded by the
     * server class loader.
     * @param classname Name of the class to be checked
    private boolean isContainerProvidedServlet(String classname) {
        if (classname.startsWith("org.apache.catalina.")) {
            return (true);
        try {
            Class clazz =
            return (ContainerServlet.class.isAssignableFrom(clazz));
        } catch (Throwable t) {
            return (false);

Not sure why the privileged flag by itself is insufficient.  Perhaps the
"since it's a child of the container loader" comment isn't completely
accurate, or something isn't being inherited properly.

 - Chuck

MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message