[jira] [Commented] (ARTEMIS-2163) Classloading issue if artemis-commons is not in ther same classloader as artemis-client-* or artemis-server
[ https://issues.apache.org/jira/browse/ARTEMIS-2163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16688262#comment-16688262 ] ASF subversion and git services commented on ARTEMIS-2163: -- Commit b52f3afe88d53ed084e83ea8347024310cd884c8 in activemq-artemis's branch refs/heads/2.6.x from [~ehsavoie] [ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=b52f3af ] [ARTEMIS-2163]: Classloading issue if artemis-commons is not in the same classloader as artemis-client-* or artemis-server. * Passing the owner class to define the classloader to load classes via ClassLoadingUtil with artemis-commons in a different classloader.. JIRA: https://issues.apache.org/jira/browse/ARTEMIS-2163 (cherry picked from commit 80525f1c9165fde93fd3b0c73b77ff66fd02d1cb) > Classloading issue if artemis-commons is not in ther same classloader as > artemis-client-* or artemis-server > --- > > Key: ARTEMIS-2163 > URL: https://issues.apache.org/jira/browse/ARTEMIS-2163 > Project: ActiveMQ Artemis > Issue Type: Wish > Components: Broker >Affects Versions: 2.6.3 >Reporter: Emmanuel Hugonnet >Priority: Major > > The class org.apache.activemq.artemis.utils.ClassLoadingUtil is defined in > artemis-commons. In a jboss-modules environment this creates a loop to be > able to load classes from another module. > Setting the ThreadContext classloader to the calling class before invoking > ClassLoadingUtil > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-2163) Classloading issue if artemis-commons is not in ther same classloader as artemis-client-* or artemis-server
[ https://issues.apache.org/jira/browse/ARTEMIS-2163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16688261#comment-16688261 ] ASF subversion and git services commented on ARTEMIS-2163: -- Commit b52f3afe88d53ed084e83ea8347024310cd884c8 in activemq-artemis's branch refs/heads/2.6.x from [~ehsavoie] [ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=b52f3af ] [ARTEMIS-2163]: Classloading issue if artemis-commons is not in the same classloader as artemis-client-* or artemis-server. * Passing the owner class to define the classloader to load classes via ClassLoadingUtil with artemis-commons in a different classloader.. JIRA: https://issues.apache.org/jira/browse/ARTEMIS-2163 (cherry picked from commit 80525f1c9165fde93fd3b0c73b77ff66fd02d1cb) > Classloading issue if artemis-commons is not in ther same classloader as > artemis-client-* or artemis-server > --- > > Key: ARTEMIS-2163 > URL: https://issues.apache.org/jira/browse/ARTEMIS-2163 > Project: ActiveMQ Artemis > Issue Type: Wish > Components: Broker >Affects Versions: 2.6.3 >Reporter: Emmanuel Hugonnet >Priority: Major > > The class org.apache.activemq.artemis.utils.ClassLoadingUtil is defined in > artemis-commons. In a jboss-modules environment this creates a loop to be > able to load classes from another module. > Setting the ThreadContext classloader to the calling class before invoking > ClassLoadingUtil > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-2163) Classloading issue if artemis-commons is not in ther same classloader as artemis-client-* or artemis-server
[ https://issues.apache.org/jira/browse/ARTEMIS-2163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16688141#comment-16688141 ] ASF subversion and git services commented on ARTEMIS-2163: -- Commit 80525f1c9165fde93fd3b0c73b77ff66fd02d1cb in activemq-artemis's branch refs/heads/master from [~ehsavoie] [ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=80525f1 ] [ARTEMIS-2163]: Classloading issue if artemis-commons is not in the same classloader as artemis-client-* or artemis-server. * Passing the owner class to define the classloader to load classes via ClassLoadingUtil with artemis-commons in a different classloader.. JIRA: https://issues.apache.org/jira/browse/ARTEMIS-2163 > Classloading issue if artemis-commons is not in ther same classloader as > artemis-client-* or artemis-server > --- > > Key: ARTEMIS-2163 > URL: https://issues.apache.org/jira/browse/ARTEMIS-2163 > Project: ActiveMQ Artemis > Issue Type: Wish > Components: Broker >Affects Versions: 2.6.3 >Reporter: Emmanuel Hugonnet >Priority: Major > > The class org.apache.activemq.artemis.utils.ClassLoadingUtil is defined in > artemis-commons. In a jboss-modules environment this creates a loop to be > able to load classes from another module. > Setting the ThreadContext classloader to the calling class before invoking > ClassLoadingUtil > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-2163) Classloading issue if artemis-commons is not in ther same classloader as artemis-client-* or artemis-server
[ https://issues.apache.org/jira/browse/ARTEMIS-2163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16688142#comment-16688142 ] ASF GitHub Bot commented on ARTEMIS-2163: - Github user asfgit closed the pull request at: https://github.com/apache/activemq-artemis/pull/2416 > Classloading issue if artemis-commons is not in ther same classloader as > artemis-client-* or artemis-server > --- > > Key: ARTEMIS-2163 > URL: https://issues.apache.org/jira/browse/ARTEMIS-2163 > Project: ActiveMQ Artemis > Issue Type: Wish > Components: Broker >Affects Versions: 2.6.3 >Reporter: Emmanuel Hugonnet >Priority: Major > > The class org.apache.activemq.artemis.utils.ClassLoadingUtil is defined in > artemis-commons. In a jboss-modules environment this creates a loop to be > able to load classes from another module. > Setting the ThreadContext classloader to the calling class before invoking > ClassLoadingUtil > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-2163) Classloading issue if artemis-commons is not in ther same classloader as artemis-client-* or artemis-server
[ https://issues.apache.org/jira/browse/ARTEMIS-2163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16688140#comment-16688140 ] ASF subversion and git services commented on ARTEMIS-2163: -- Commit 80525f1c9165fde93fd3b0c73b77ff66fd02d1cb in activemq-artemis's branch refs/heads/master from [~ehsavoie] [ https://git-wip-us.apache.org/repos/asf?p=activemq-artemis.git;h=80525f1 ] [ARTEMIS-2163]: Classloading issue if artemis-commons is not in the same classloader as artemis-client-* or artemis-server. * Passing the owner class to define the classloader to load classes via ClassLoadingUtil with artemis-commons in a different classloader.. JIRA: https://issues.apache.org/jira/browse/ARTEMIS-2163 > Classloading issue if artemis-commons is not in ther same classloader as > artemis-client-* or artemis-server > --- > > Key: ARTEMIS-2163 > URL: https://issues.apache.org/jira/browse/ARTEMIS-2163 > Project: ActiveMQ Artemis > Issue Type: Wish > Components: Broker >Affects Versions: 2.6.3 >Reporter: Emmanuel Hugonnet >Priority: Major > > The class org.apache.activemq.artemis.utils.ClassLoadingUtil is defined in > artemis-commons. In a jboss-modules environment this creates a loop to be > able to load classes from another module. > Setting the ThreadContext classloader to the calling class before invoking > ClassLoadingUtil > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-2163) Classloading issue if artemis-commons is not in ther same classloader as artemis-client-* or artemis-server
[ https://issues.apache.org/jira/browse/ARTEMIS-2163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16686989#comment-16686989 ] ASF GitHub Bot commented on ARTEMIS-2163: - Github user ehsavoie commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2416#discussion_r233576260 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java --- @@ -982,7 +982,13 @@ protected ConnectorFactory instantiateConnectorFactory(final String connectorFac return AccessController.doPrivileged(new PrivilegedAction() { @Override public ConnectorFactory run() { -return (ConnectorFactory) ClassloadingUtil.newInstanceFromClassLoader(connectorFactoryClassName); +ClassLoader cl = Thread.currentThread().getContextClassLoader(); --- End diff -- done > Classloading issue if artemis-commons is not in ther same classloader as > artemis-client-* or artemis-server > --- > > Key: ARTEMIS-2163 > URL: https://issues.apache.org/jira/browse/ARTEMIS-2163 > Project: ActiveMQ Artemis > Issue Type: Wish > Components: Broker >Affects Versions: 2.6.3 >Reporter: Emmanuel Hugonnet >Priority: Major > > The class org.apache.activemq.artemis.utils.ClassLoadingUtil is defined in > artemis-commons. In a jboss-modules environment this creates a loop to be > able to load classes from another module. > Setting the ThreadContext classloader to the calling class before invoking > ClassLoadingUtil > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-2163) Classloading issue if artemis-commons is not in ther same classloader as artemis-client-* or artemis-server
[ https://issues.apache.org/jira/browse/ARTEMIS-2163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16686879#comment-16686879 ] ASF GitHub Bot commented on ARTEMIS-2163: - Github user clebertsuconic commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2416#discussion_r233539372 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java --- @@ -982,7 +982,13 @@ protected ConnectorFactory instantiateConnectorFactory(final String connectorFac return AccessController.doPrivileged(new PrivilegedAction() { @Override public ConnectorFactory run() { -return (ConnectorFactory) ClassloadingUtil.newInstanceFromClassLoader(connectorFactoryClassName); +ClassLoader cl = Thread.currentThread().getContextClassLoader(); --- End diff -- @ehsavoie can you amend it then? > Classloading issue if artemis-commons is not in ther same classloader as > artemis-client-* or artemis-server > --- > > Key: ARTEMIS-2163 > URL: https://issues.apache.org/jira/browse/ARTEMIS-2163 > Project: ActiveMQ Artemis > Issue Type: Wish > Components: Broker >Affects Versions: 2.6.3 >Reporter: Emmanuel Hugonnet >Priority: Major > > The class org.apache.activemq.artemis.utils.ClassLoadingUtil is defined in > artemis-commons. In a jboss-modules environment this creates a loop to be > able to load classes from another module. > Setting the ThreadContext classloader to the calling class before invoking > ClassLoadingUtil > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-2163) Classloading issue if artemis-commons is not in ther same classloader as artemis-client-* or artemis-server
[ https://issues.apache.org/jira/browse/ARTEMIS-2163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16686858#comment-16686858 ] ASF GitHub Bot commented on ARTEMIS-2163: - Github user ehsavoie commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2416#discussion_r233531108 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java --- @@ -982,7 +982,13 @@ protected ConnectorFactory instantiateConnectorFactory(final String connectorFac return AccessController.doPrivileged(new PrivilegedAction() { @Override public ConnectorFactory run() { -return (ConnectorFactory) ClassloadingUtil.newInstanceFromClassLoader(connectorFactoryClassName); +ClassLoader cl = Thread.currentThread().getContextClassLoader(); --- End diff -- No problem there > Classloading issue if artemis-commons is not in ther same classloader as > artemis-client-* or artemis-server > --- > > Key: ARTEMIS-2163 > URL: https://issues.apache.org/jira/browse/ARTEMIS-2163 > Project: ActiveMQ Artemis > Issue Type: Wish > Components: Broker >Affects Versions: 2.6.3 >Reporter: Emmanuel Hugonnet >Priority: Major > > The class org.apache.activemq.artemis.utils.ClassLoadingUtil is defined in > artemis-commons. In a jboss-modules environment this creates a loop to be > able to load classes from another module. > Setting the ThreadContext classloader to the calling class before invoking > ClassLoadingUtil > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-2163) Classloading issue if artemis-commons is not in ther same classloader as artemis-client-* or artemis-server
[ https://issues.apache.org/jira/browse/ARTEMIS-2163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16686643#comment-16686643 ] ASF GitHub Bot commented on ARTEMIS-2163: - Github user clebertsuconic commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2416#discussion_r233483727 --- Diff: artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java --- @@ -982,7 +982,13 @@ protected ConnectorFactory instantiateConnectorFactory(final String connectorFac return AccessController.doPrivileged(new PrivilegedAction() { @Override public ConnectorFactory run() { -return (ConnectorFactory) ClassloadingUtil.newInstanceFromClassLoader(connectorFactoryClassName); +ClassLoader cl = Thread.currentThread().getContextClassLoader(); --- End diff -- Couldn't you change ClassLoadingUtil as ```java public static Object newInstanceFromClassLoader(final String className) { return newInstanceFromClassLoader(ClassloadingUtil.class, className); } public static Object newInstanceFromClassLoader(Class classOwner, final String className) { ClassLoader loader = classOwner.getClassLoader(); try { Class clazz = loader.loadClass(className); return clazz.newInstance(); } catch (Throwable t) { if (t instanceof InstantiationException) { System.out.println(INSTANTIATION_EXCEPTION_MESSAGE); } loader = Thread.currentThread().getContextClassLoader(); if (loader == null) throw new RuntimeException("No local context classloader", t); try { return loader.loadClass(className).newInstance(); } catch (InstantiationException e) { throw new RuntimeException(INSTANTIATION_EXCEPTION_MESSAGE + " " + className, e); } catch (ClassNotFoundException e) { throw new IllegalStateException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } } ``` and pass in the class parameter on these cases? Or would this have issues with Security on the JDK? If there are no issues I would prefer the parameter added? > Classloading issue if artemis-commons is not in ther same classloader as > artemis-client-* or artemis-server > --- > > Key: ARTEMIS-2163 > URL: https://issues.apache.org/jira/browse/ARTEMIS-2163 > Project: ActiveMQ Artemis > Issue Type: Wish > Components: Broker >Affects Versions: 2.6.3 >Reporter: Emmanuel Hugonnet >Priority: Major > > The class org.apache.activemq.artemis.utils.ClassLoadingUtil is defined in > artemis-commons. In a jboss-modules environment this creates a loop to be > able to load classes from another module. > Setting the ThreadContext classloader to the calling class before invoking > ClassLoadingUtil > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (ARTEMIS-2163) Classloading issue if artemis-commons is not in ther same classloader as artemis-client-* or artemis-server
[ https://issues.apache.org/jira/browse/ARTEMIS-2163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16675338#comment-16675338 ] ASF GitHub Bot commented on ARTEMIS-2163: - GitHub user ehsavoie opened a pull request: https://github.com/apache/activemq-artemis/pull/2416 [ARTEMIS-2163]: Classloading issue if artemis-commons is not in the same classloader as artemis-client-* or artemis-server. * Setting TCCL to be able to load classes via ClassLoadingUtil with artemis-commons in a different classloader. JIRA: https://issues.apache.org/jira/browse/ARTEMIS-2163 You can merge this pull request into a Git repository by running: $ git pull https://github.com/ehsavoie/apache-activemq-artemis ARTEMIS-2163 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/activemq-artemis/pull/2416.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2416 commit 10b75a8963fa440f2e16f0c28deefb22115e8b04 Author: Emmanuel Hugonnet Date: 2018-11-05T15:42:21Z [ARTEMIS-2163]: Classloading issue if artemis-commons is not in the same classloader as artemis-client-* or artemis-server. * Setting TCCL to be able to load classes via ClassLoadingUtil with artemis-commons in a different classloader. JIRA: https://issues.apache.org/jira/browse/ARTEMIS-2163 > Classloading issue if artemis-commons is not in ther same classloader as > artemis-client-* or artemis-server > --- > > Key: ARTEMIS-2163 > URL: https://issues.apache.org/jira/browse/ARTEMIS-2163 > Project: ActiveMQ Artemis > Issue Type: Wish > Components: Broker >Affects Versions: 2.6.3 >Reporter: Emmanuel Hugonnet >Priority: Major > > The class org.apache.activemq.artemis.utils.ClassLoadingUtil is defined in > artemis-commons. In a jboss-modules environment this creates a loop to be > able to load classes from another module. > Setting the ThreadContext classloader to the calling class before invoking > ClassLoadingUtil > -- This message was sent by Atlassian JIRA (v7.6.3#76005)