Announcement Announcement Module
Collapse
No announcement yet.
MBeanServerFactoryBean.locateExistingServerIfPossi ble not working with JBoss? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MBeanServerFactoryBean.locateExistingServerIfPossi ble not working with JBoss?

    Up-to-date stack

    + Spring 2.5.1
    + JBoss 4.2.2GA
    + jrockit-R27.4.0-jdk1.5.0_12

    With the appended configuration, I am finding that my JMX-aware 'addressOrIPFilter' instance is being advertised in the JDK's JMX server, NOT in the jboss one...

    At startup, I see:

    Code:
    INFO  [MBeanExporter] Located managed bean 'HIST:name=addressOrIPFilter': registering with JMX server as MBean [HIST:name=addressOrIPFilter]
    BUT I can't see the bean in JBoss' jmx-console but I CAN see it in the JDK's jconsole.

    Code:
      <!--  JMX stuff -->
      <bean
        id="mbeanServer"
        class="org.springframework.jmx.support.MBeanServerFactoryBean">
        <property
          name="locateExistingServerIfPossible"
          value="true" />
      </bean>
    
      <!--this bean must not be lazily initialized if the exporting is to happen-->
      <bean
        id="exporter"
        class="org.springframework.jmx.export.MBeanExporter"
        lazy-init="false">
        <property name="beans">
          <map>
            <entry
              key="HIST:name=addressOrIPFilter"
              value-ref="addressOrIPFilter" />
          </map>
        </property>
        <property
          name="assembler"
          ref="assembler" />
        <property
          name="server"
          ref="mbeanServer" />
      </bean>
    
      <bean
        id="attributeSource"
        class="org.springframework.jmx.export.annotation.AnnotationJmxAttributeSource" />
    
      <bean
        id="assembler"
        class="org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler">
        <property
          name="attributeSource"
          ref="attributeSource" />
      </bean>
      <!--  /JMX stuff -->
    I have tried establishing my own 'MBeanServerLocator' class; essentially:

    Code:
        String serverId = null;
        final String SERVER_DELEGATE = "JMImplementation:type=MBeanServerDelegate";
        final String MBEAN_SERVER_ID_KEY = "MBeanServerId";
    
    ...
    
          MBeanServer aMBeanServer = ManagementFactory.getPlatformMBeanServer();
          ObjectName delegateObjName = new ObjectName(SERVER_DELEGATE);
          serverId = (String) aMBeanServer.getAttribute(delegateObjName,
              MBEAN_SERVER_ID_KEY);
    ...
          return serverId;
    This returns something like "TRIFFID_1203314753436" which DOES correspond to what the JBoss console tells me...

    Anybody out there had the same issue?

    The code and configuration I am using is copied/pasted from another app that is in production and behaving correctly...this used:

    + Spring 2.0.5
    + JBoss 4.0.5GA
    + jrockit-R27.2.0-jdk1.5.0_10

    I am wondering if something "under the covers" has changed that I am not aware of...

    Thoughts/suggestions gratefully received...

    Cheers,

    Alph

  • #2
    I THINK I solved it...

    Dug around, found:

    http://wiki.jboss.org/wiki/Wiki.jsp?...eansInJConsole

    The key is to use the -Djboss.platform.mbeanserver, then it is possible to do:

    Code:
      <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
        <property name="locateExistingServerIfPossible" value="true" />
      </bean>
    Still wondering why I need to add this system property 'tho...but this is probably a JBoss issue.

    Cheers,

    Alph

    Comment


    • #3
      But...

      if one then adds the property -Xmanagement, one gets:

      Code:
      [JRockit] Local management server started.
      19:19:42,953 INFO  [Server] Starting JBoss (MX MicroKernel)...
      19:19:42,953 INFO  [Server] Release ID: JBoss [Trinity] 4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)
      19:19:42,953 INFO  [Server] Home Dir: C:\DEVTOOLS\jboss-4.2.2.GA
      19:19:42,953 INFO  [Server] Home URL: file:/C:/DEVTOOLS/jboss-4.2.2.GA/
      19:19:42,953 INFO  [Server] Patch URL: null
      19:19:42,953 INFO  [Server] Server Name: ULS
      19:19:42,953 INFO  [Server] Server Home Dir: C:\DEVTOOLS\jboss-4.2.2.GA\server\ULS
      19:19:42,953 INFO  [Server] Server Home URL: file:/C:/DEVTOOLS/jboss-4.2.2.GA/server/ULS/
      19:19:42,954 INFO  [Server] Server Log Dir: C:\DEVTOOLS\jboss-4.2.2.GA\server\ULS\log
      19:19:42,954 INFO  [Server] Server Temp Dir: C:\DEVTOOLS\jboss-4.2.2.GA\server\ULS\tmp
      19:19:42,954 INFO  [Server] Root Deployment Filename: jboss-service.xml
      Failed to boot JBoss:
      javax.management.InstanceNotFoundException: JMImplementation:service=LoaderRepository,name=Default
      	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1010)
      	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:804)
      	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
      	at org.jboss.system.server.ServerImpl.initBootLibraries(ServerImpl.java:628)
      	at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:429)
      	at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
      	at org.jboss.Main.boot(Main.java:200)
      	at org.jboss.Main$1.run(Main.java:508)
      	at java.lang.Thread.run(Thread.java:595)
      All good clean fun!

      Cheers,

      Alph

      Comment


      • #4
        More

        ...on this little conversation I am having with myself...

        Going back to:

        http://wiki.jboss.org/wiki/Wiki.jsp?...eansInJConsole

        it appears that it is necessary to actually supply all 3 properties mentioned:

        Code:
        set JAVA_OPTS=%JAVA_OPTS% -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl
        set JAVA_OPTS=%JAVA_OPTS% -Djboss.platform.mbeanserver
        set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote
        I had assumed that I could pick and choose.

        If one adds all 3, all is OK.

        Hope this helps someone else...

        Alph

        Comment

        Working...
        X