Author: gnodet
Date: Tue Jan 9 03:02:50 2007
New Revision: 494372
URL: http://svn.apache.org/viewvc?view=rev&rev=494372
Log:
Ensure the TCL is set to the MBean implementation classloader before invoking.
It seems there are cases where the TCL is set to the system classloader and may
cause
problems with JAXP providers (only included in the container classloader)
Modified:
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/BaseStandardMBean.java
Modified:
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/BaseStandardMBean.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/BaseStandardMBean.java?view=diff&rev=494372&r1=494371&r2=494372
==============================================================================
---
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/BaseStandardMBean.java
(original)
+++
incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/management/BaseStandardMBean.java
Tue Jan 9 03:02:50 2007
@@ -305,6 +305,7 @@
* @throws ReflectionException
*/
public Object invoke(String name, Object[] params, String[] signature)
throws MBeanException, ReflectionException {
+ ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
try {
Class[] parameterTypes = new Class[signature.length];
for (int i = 0; i < parameterTypes.length; i++) {
@@ -313,6 +314,7 @@
parameterTypes[i] = Class.forName(signature[i]);
}
}
+
Thread.currentThread().setContextClassLoader(getImplementation().getClass().getClassLoader());
return MethodUtils.invokeMethod(getImplementation(), name, params,
parameterTypes);
}
catch (ClassNotFoundException e) {
@@ -331,6 +333,8 @@
} else {
throw new MBeanException(e);
}
+ } finally {
+ Thread.currentThread().setContextClassLoader(oldCl);
}
}