[jboss-jira] [JBoss JIRA] Updated: (JGRP-803) CLONE -Use the correct MBeanServer if multiple MBeanServers are present

Robert Buck (JIRA) jira-events at lists.jboss.org
Tue Jul 22 14:52:16 EDT 2008


     [ https://jira.jboss.org/jira/browse/JGRP-803?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Buck updated JGRP-803:
-----------------------------

        Fix Version/s:     (was: 2.3)
    Affects Version/s:     (was: 2.2.8)
                           (was: 2.2.9)
                           (was: 2.2.9.1)
                           (was: 2.2.9.2)
          Description: 
The prior bug did not fix the issue of running the cache under jboss when the following options are present:

set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote

The code is presently as follows (which is incorrect, by the way):

{code}
157   	       List servers=MBeanServerFactory.findMBeanServer(null);
158 	      if(servers == null || servers.size() == 0)
159 	         throw new Exception("TreeCacheView.init(): no MBeanServers found");
{code}

TreeCacheView fails to deploy because it is using the wrong MBeanServer. Rather than doing the above, you should either do something like:

{code}
   import org.jboss.mx.util.MBeanServerLocator;
   ...
   // find the local MBeanServer
   MBeanServer server = MBeanServerLocator.locateJBoss();
{code}

, or you should do something like this:

{code}
    public static MBeanServer getDefaultMBeanServer() {
        return findMBeanServer("jboss");
    }

    private static MBeanServer findMBeanServer(String agentId) {
        List servers = MBeanServerFactory.findMBeanServer(null);
        if (servers != null && servers.size() > 0) {
            for (Object object : servers) {
                MBeanServer server = (MBeanServer) object;
                if (server.getDefaultDomain().equals(agentId)) {
                    return server;
                }
            }
        }
        return null;
    }
{code}

The reason is because with Java 5, when the "-Dcom.sun.management.jmxremote" switch is turned on, the default platform MBeanServer is the zeroth instance rather than "jboss".

See:

http://fisheye.jboss.com/browse/JBossCache/core/support-branches/1.4.1.SP8_JBCACHE-1247/src/org/jboss/cache/TreeCacheView.java?r=4384

To test, deploy the tree cache view, and start JBoss with the JAVA_OPTS mentioned above.


  was:
The prior bug did not fix the issue of running the cache under jboss when the following options are present:

set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote

The code is presently as follows (which is incorrect, by the way):

{code}
157   	       List servers=MBeanServerFactory.findMBeanServer(null);
158 	      if(servers == null || servers.size() == 0)
159 	         throw new Exception("TreeCacheView.init(): no MBeanServers found");
{code}

TreeCacheView fails to deploy because it is using the wrong MBeanServer. Rather than doing the above, you should either do something like:

{code}
   import org.jboss.mx.util.MBeanServerLocator;
   ...
   // find the local MBeanServer
   MBeanServer server = MBeanServerLocator.locateJBoss();
{code}

, or you should do something like this:

{code}
    public static MBeanServer getDefaultMBeanServer() {
        return findMBeanServer("jboss");
    }

    private static MBeanServer findMBeanServer(String agentId) {
        List servers = MBeanServerFactory.findMBeanServer(null);
        if (servers != null && servers.size() > 0) {
            for (Object object : servers) {
                MBeanServer server = (MBeanServer) object;
                if (server.getDefaultDomain().equals(agentId)) {
                    return server;
                }
            }
        }
        return null;
    }
{code}

The reason is because with Java 5, when the "-Dcom.sun.management.jmxremote" switch is turned on, the default platform MBeanServer is the zeroth instance rather than "jboss".

To test, deploy the tree cache view, and start JBoss with the JAVA_OPTS mentioned above.




> CLONE -Use the correct MBeanServer if multiple MBeanServers are present
> -----------------------------------------------------------------------
>
>                 Key: JGRP-803
>                 URL: https://jira.jboss.org/jira/browse/JGRP-803
>             Project: JGroups
>          Issue Type: Bug
>            Reporter: Robert Buck
>            Assignee: Bela Ban
>
> The prior bug did not fix the issue of running the cache under jboss when the following options are present:
> set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote
> The code is presently as follows (which is incorrect, by the way):
> {code}
> 157   	       List servers=MBeanServerFactory.findMBeanServer(null);
> 158 	      if(servers == null || servers.size() == 0)
> 159 	         throw new Exception("TreeCacheView.init(): no MBeanServers found");
> {code}
> TreeCacheView fails to deploy because it is using the wrong MBeanServer. Rather than doing the above, you should either do something like:
> {code}
>    import org.jboss.mx.util.MBeanServerLocator;
>    ...
>    // find the local MBeanServer
>    MBeanServer server = MBeanServerLocator.locateJBoss();
> {code}
> , or you should do something like this:
> {code}
>     public static MBeanServer getDefaultMBeanServer() {
>         return findMBeanServer("jboss");
>     }
>     private static MBeanServer findMBeanServer(String agentId) {
>         List servers = MBeanServerFactory.findMBeanServer(null);
>         if (servers != null && servers.size() > 0) {
>             for (Object object : servers) {
>                 MBeanServer server = (MBeanServer) object;
>                 if (server.getDefaultDomain().equals(agentId)) {
>                     return server;
>                 }
>             }
>         }
>         return null;
>     }
> {code}
> The reason is because with Java 5, when the "-Dcom.sun.management.jmxremote" switch is turned on, the default platform MBeanServer is the zeroth instance rather than "jboss".
> See:
> http://fisheye.jboss.com/browse/JBossCache/core/support-branches/1.4.1.SP8_JBCACHE-1247/src/org/jboss/cache/TreeCacheView.java?r=4384
> To test, deploy the tree cache view, and start JBoss with the JAVA_OPTS mentioned above.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list