2 Replies Latest reply: Feb 11, 2012 9:30 AM by 893353 RSS

    Conetext of Classloader with Tomcat 6


      I've run into some problems on Tomcat 6 when invoking mbeans that load resources from the classpath.

      The code I am calling through JMX makes use of Apache Digester which goes onto load classes within the package it was initialised. This works fine in the context of the Servlet container but when run through the JMX environment (where the thread context class loader is the one at the bottom of the class loader hierarchy) these classes can no longer be found by Digester.

      The code I am calling deliberately makes sure Digester uses the Context Class loaded by setting the following method to true:
      Unfortunately I can’t change that method parameter to "false" so I was wondering if there was any other way where I could force the JMX environment to run the same as the web app environment.


      Edit: Just found someone who seem to get round the issue by somehow setting "Thread's context classloader to the
      WebappClassloader" in Jetty:

      Any idea how I can do this in Tomcat?

      Edited by: user9038336 on 14-Nov-2011 15:23