diff --git a/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ClassLoaderSPIConnectionFactory.java b/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ClassLoaderSPIConnectionFactory.java index 59df52a870..961547e696 100644 --- a/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ClassLoaderSPIConnectionFactory.java +++ b/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ClassLoaderSPIConnectionFactory.java @@ -39,7 +39,7 @@ public abstract class ClassLoaderSPIConnectionFactory implements SPIConnectionFa ClassLoader newClassLoader = getContextClassLoader(settings); Thread.currentThread().setContextClassLoader(newClassLoader); - return instantiateConnectionFactory(newClassLoader, settings); + return instantiateConnectionFactory(settings); } protected ClassLoader getContextClassLoader(Properties settings) { @@ -76,5 +76,5 @@ public abstract class ClassLoaderSPIConnectionFactory implements SPIConnectionFa return ClassLoaderSPIConnectionFactory.class.getClassLoader(); } - protected abstract ConnectionFactory instantiateConnectionFactory(ClassLoader cl, Properties settings) throws Exception; + protected abstract ConnectionFactory instantiateConnectionFactory(Properties settings) throws Exception; } diff --git a/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ReflectionSPIConnectionFactory.java b/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ReflectionSPIConnectionFactory.java index d284188346..e379ca7221 100644 --- a/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ReflectionSPIConnectionFactory.java +++ b/tooling/maven-activemq-perf-plugin/src/main/java/org/apache/activemq/tool/spi/ReflectionSPIConnectionFactory.java @@ -23,8 +23,8 @@ import java.util.Properties; public abstract class ReflectionSPIConnectionFactory extends ClassLoaderSPIConnectionFactory { - public ConnectionFactory instantiateConnectionFactory(ClassLoader cl, Properties settings) throws Exception { - Class factoryClass = cl.loadClass(getClassName()); + public ConnectionFactory instantiateConnectionFactory(Properties settings) throws Exception { + Class factoryClass = Thread.currentThread().getContextClassLoader().loadClass(getClassName()); ConnectionFactory factory = (ConnectionFactory)factoryClass.newInstance(); configureConnectionFactory(factory, settings); return factory;