[jboss-jira] [JBoss JIRA] Issue Comment Edited: (AS7-1443) TcclMBeanServer uses wrong classloader

Adrian Brock (JIRA) jira-events at lists.jboss.org
Tue Aug 2 09:43:23 EDT 2011


    [ https://issues.jboss.org/browse/AS7-1443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12618116#comment-12618116 ] 

Adrian Brock edited comment on AS7-1443 at 8/2/11 9:43 AM:
-----------------------------------------------------------

A while ago I created an MBeanServer that does all this correctly without having to use JBossMX.
http://anonsvn.jboss.org/repos/jbossas/projects/jbossmx/trunk/mbeanserver/

Since it is a small standalone jar and uses an MBeanServerBuilder, it can also be installed as the "PlatformBeanServer", guaranteeing that everything uses it.

1) Add the jar to the classpath.
2) Define the system property 
-Djavax.management.initial=org.jboss.jmx.mbeanserver.JBossMBeanServerBuilder

      was (Author: warjort):
    A while ago I created an MBeanServer that does all this correctly without having to use JBossMX.
http://anonsvn.jboss.org/repos/jbossas/projects/jbossmx/trunk/mbeanserver/

Since it is a small standalone jar and uses an MBeanServerBuilder, it can also be installed as the "PlatformBeanServer", guaranteeing that everything uses it.

1) Add the jar to the classpath.
2) Define the system property 
-Djavax.management.initial=org.jboss.jmx.mbeanServer.JBossMBeanServerBuilder
  
> TcclMBeanServer uses wrong classloader
> --------------------------------------
>
>                 Key: AS7-1443
>                 URL: https://issues.jboss.org/browse/AS7-1443
>             Project: Application Server 7
>          Issue Type: Bug
>          Components: JMX
>    Affects Versions: 7.0.0.Final
>            Reporter: Adrian Brock
>            Assignee: John Bailey
>
> There is an MBeanServer implementation org.jboss.as.jmx.tcl.TcclMBeanServer that attempts to implement the classloader switching for MBeans found in jboss6 and before.
> However it uses the wrong classloader. 
> It uses "PlatformMBeanServer".getClassLoaderFor(ObjectName) of the mbean as the classloader.
> This is not the classloader passed to createBean(), i.e. the deployment's classloader, it is the classloader where the MBean was loaded from, they are not necessarily the same.
> This means classes in the deployment will not be visible for invocations on the mbean unless the place where the mbean class is defined is either the same classloader (this will be true in most cases) or it happens to import the deployment's classloader (very unlikely).
> There is a related issue in that because getClassLoaderFor() is no longer correct, deserialisation of requests using the jmx remote connector won't work for classes passed over the wire that are in the deployment.
> Finally, because TcclMBeanServer is not built using an MBeanServerBuilder, it can't be the platform MBeanServer, which means tools like jconsole wont use it and the classloader will be wrong for those requests.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list