This discussion is archived
2 Replies Latest reply: Feb 11, 2012 7:30 AM by 893353 RSS

Conetext of Classloader with Tomcat 6

802711 Newbie
Currently Being Moderated
Hi,

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:
digester.setUseContextClassLoader(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.

Thanks

Edit: Just found someone who seem to get round the issue by somehow setting "Thread's context classloader to the
WebappClassloader" in Jetty:
http://metro.1045641.n5.nabble.com/web-app-classloader-and-JMX-td1068193.html

Any idea how I can do this in Tomcat?

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

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points