#12 Fix chaining of tomcat classloaders

closed-invalid
None
5
2001-06-10
2001-05-01
Anonymous
No

I think there is a problem with
ContextClassLoaderInterceptor; when the
embedded tomcat service starts and existing contexts
are initialized, the tomcat context class loaders get
linked together in a complex (and broken!
way).

In ContextClassLoaderInterceptor.contextInit in the
current version (1.5
according to CVS), the contextInit method is:

public void contextInit( Context context)
throws TomcatException
{

((AdaptiveClassLoader)context.getServletLoader().getParentLoader()).setParent(Thread.currentThread().getContextClassLoader());

Thread.currentThread().setContextClassLoader(((ClassLoader)context.getServletLoader().getClassLoader()));
}

This sets the parent loader of the servlet context just
fine, but leaves the
context class loader changed.

Existing tomcat contexts are initialized one by one and
this leaves the tomcat
context class loaders all chained together, which leads
to some very strange
effects.

The ideal solution might be to modify the Tomcat
ContextManager class to reset
the thread context class loader after each context is
initialised. I wanted
to avoid changing tomcat so the only solution I could
find was to modify
ContextClassLoaderInterceptor.

Discussion

  • Nobody/Anonymous

    patch to ContextClassLoaderInterceptor in contrib/tomcat

     
  • Scott M Stark

    Scott M Stark - 2001-06-10

    Logged In: YES
    user_id=175228

    This class is no longer used in the tomcat bundle.

     
  • Scott M Stark

    Scott M Stark - 2001-06-10
    • assigned_to: nobody --> starksm
    • status: open --> closed-invalid
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks