Announcement Announcement Module
Collapse
No announcement yet.
JMX in Weblogic 9 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JMX in Weblogic 9

    Can anyone provide a configuration excerpt for Weblogic 9 and JMX?

    I'm having a really frustrating time trying to connect to the embedded MBeanServer in WL9. Here is what I have so far but the exporter fails at startup because it says it can find an MBean Server...

    <bean id="exporter" class="org.springframework.jmx.export.MBeanExporte r">
    <property name="beans">
    <map>
    <!-- there is a bean named 'repository' defined elsewhere -->
    <entry key="bean:name=repository1" value-ref="repository"/>
    </map>
    </property>
    </bean>

    <!-- expose weblogic server's runtime mbeanserver connection -->
    <bean id="runtimeMbeanServerConnection"
    class="org.springframework.jmx.support.MBeanServer ConnectionFactoryBean">
    <property name="serviceUrl"
    value="service:jmx:t3://${WS_HOST}:${WS_PORT}/jndi/weblogic.management.mbeanservers.runtime"/>
    <property name="environment">
    <props>
    <prop key="java.naming.security.principal">${WS_USERNAME }</prop>
    <prop key="java.naming.security.credentials">${WS_USERNA ME}</prop>
    <prop key="jmx.remote.protocol.provider.pkgs">weblogic.m anagement.remote</prop>
    </props>
    </property>
    </bean>

    Basically, I need to know how to set the "server" property on the exporter. Thanks, in advance.

    Dan.

  • #2
    Have you looked at WebLogicMBeanServerFactoryBean?

    Comment


    • #3
      His example is taken from the BEA dev2dev site, so I imagine its what BEA recommends for Weblogic 9.

      The problem with that example is there is a typo:

      Code:
               <prop key="java.naming.security.principle">
                  ${WS_USERNAME}</prop>
               <prop key="java.naming.security.credentials">
                  ${WS_USERNAME}</prop>
      should read:

      Code:
               <prop key="java.naming.security.principle">
                  ${WS_USERNAME}</prop>
               <prop key="java.naming.security.credentials">
                  ${WS_PASSWORD}</prop>
      Unless of course your username and password values are the same for your server.

      Of course the various variables would have to inserted into the appliation context using a PropertyPlaceholderConfigurer, something they don't mention in the BEA example.

      Comment


      • #4
        Also, shouldn't it be
        Code:
        java.naming.security.principal

        Comment


        • #5
          The WeblogicMBeanServerFactoryBean utilizes the weblogic.management.Helper class to locate the MBeanServer (via the MBeanHome interface). This interface has been deprecated for 9.0. According to the docs:

          "Deprecated. 9.0.0.0 Replaced by standard JMX design patterns in which clients use the javax.management.MBeanServerConnection interface to discover MBeans, attributes, and attribute types at runtime."

          That is why I used the example from the article by Rod and the BEA folks at this url:

          http://dev2dev.bea.com/pub/a/2005/09...ic_server.html

          (Notice the configuration on page 4).

          However, what the article doesn't tell you is how to configure an "exporter" in this environment. Setting the "server" property on the MBeanExporter to point to this MBeanServerConnectionFactoryBean yields a class cast at startup. What am I missing?

          Thanks all.

          Comment


          • #6
            BTW,

            In my development environment, the username and passwords are the same so the fact that the property placeholders reference the same property don't make a difference to me. Also, I did catch the typo on 'principal'. It will error if you use 'principle'.

            Dan

            Comment


            • #7
              More information.... With the following configuration:

              Code:
                  <!-- Hibernate 3.0's JMX statistics service -->
                  <!-- Implements the StatisticsServiceMBean management interface -->
                  <bean name="poppeourri:service=hibernateStatistics" class="org.hibernate.jmx.StatisticsService" >
                      <property name="sessionFactory" ref="sessionFactory"/>
                  </bean>
                  <!-- ========================= JMX EXPORTER DEFINITION ========================= -->
              
                  <bean id="exporter" class="org.springframework.jmx.export.MBeanExporter" >
                      <property name="autodetect" value="true"/>
                      <property name="server" ref="mbeanServer"/>
                  </bean>
              
                  <bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean">
                      <property name="locateExistingServerIfPossible" value="true"/>
                  </bean>
              
                  <!-- expose weblogic server's runtime mbeanserver connection -->
                  <bean id="runtimeMbeanServerConnection"
                          class="org.springframework.jmx.support.MBeanServerConnectionFactoryBean" >
                      <property name="serviceUrl"
                                    value="service:jmx:t3://${WS_HOST}:${WS_PORT}/jndi/weblogic.management.mbeanservers.runtime"/>
                      <property name="environment">
                          <props>
                              <prop key="java.naming.security.principal">${WS_USERNAME}</prop>
                              <prop key="java.naming.security.credentials">${WS_PASSWORD}</prop>
                              <prop key="jmx.remote.protocol.provider.pkgs">weblogic.management.remote</prop>
                          </props>
                      </property>
                  </bean>
              .... everything deploys without error. Unfortunately, the mbeanServer bean does not find the Weblogic MBean server and therefore creates a new one. The hibernate statistics mbean (in this example) IS being registered with this newly created MBean server. This does me little good as I am planning to demonstrate the Spring Managed Beans console plug-in which looks at the built in Weblogic MBean server. Right now the console says "There are no Spring managed beans"....

              Dan.

              Comment


              • #8
                WebLogic Server 9 exposes its MBeanServer via JNDI and it can be accessed quite easily now using a plain JndiObjectFactoryBean. This is different from the WLS 8.1 setup which requires one for the special WeblogicMBeanServer*FactoryBean implementations.

                The required configuration is:

                <bean class="org.springframework.jndi.JndiObjectFactoryB ean">
                <property name="jndiName" value="java:comp/env/jmx/runtime"/>
                </bean>


                Regards,

                Rob

                Comment


                • #9
                  Thanks Rob. This is a heck of alot easier. It now appears as though the exporter is using the Weblogic MBean Server (referenced via JNDI) -- yeah! I say this because the log debug messages indicate that the 'poppeourri:service=hibernateStatistics' has been autodetected and subsequently registered with the JMX server. I no longer get the message that "a JMX server could not be found -- creating new MBean server". All is well.... but wait.

                  Unfortunately, when I access the "Spring Managed Beans" tab for this web application exposed via the new WL console plug-in I still see "No Spring MBeans Registered". Do you know anything about this plug-in? Shouldn't I see the hiberate statistics service here?

                  Thanks again for your help.

                  Dan.

                  Comment


                  • #10
                    No Spring MBeans Registered.

                    Hi ,

                    Facing the same issue with Spring 1.2.5 on WLS9.0, "Spring Management Objects" Tab is visible for the webApp that has been configured for the plugin. But When clicking on the tab gives a message "No Spring MBeans Registered" message.

                    Am I missing something with the configuration or is it the problem with the plug-in itself ?

                    Any pointers will be appreciated.

                    Cheers
                    Abhijeet Rai

                    Comment


                    • #11
                      Hi ,

                      Facing the same issue with Spring 1.2.5 on WLS9.0, "Spring Management Objects" Tab is visible for the webApp that has been configured for the plugin. But When clicking on the tab gives a message "No Spring MBeans Registered" message.

                      Am I missing something with the configuration or is it the problem with the plug-in itself ?

                      Any pointers will be appreciated.

                      Cheers
                      Abhijeet Rai

                      Comment


                      • #12
                        I used a running example for a presentation I gave earlier this year. Take a look at http://www.springdeveloper.com/psug/meeting.html

                        There is also a downloadable zip file with code for this example - see http://www.springdeveloper.com/psug/bea-spring.html

                        This was all deployed on WLS 9.1

                        Comment


                        • #13
                          Thanks

                          Thanks for your example, it works like a gem. On dev2dev site these things hasnt been mentioned the extra configuration settings that needs to be done !!! Someone from BEA has to update it.

                          Cheers
                          Abhijeet Rai

                          Comment


                          • #14
                            JndiObjectFactoryBean for Weblogic 8?

                            hi,
                            more or less on this issue...:
                            I understand that JndiObjectFactoryBean can be used with Weblogic9, but what about Weblogic 8?
                            MUST I use WeblogicJndiMBeanserverFactoryBean if I've got WLS 8?

                            thanks,

                            Comment


                            • #15
                              What about WebLogic 10.3g ?

                              Originally posted by trisberg View Post
                              I used a running example for a presentation I gave earlier this year. Take a look at http://www.springdeveloper.com/psug/meeting.html

                              There is also a downloadable zip file with code for this example - see http://www.springdeveloper.com/psug/bea-spring.html

                              This was all deployed on WLS 9.1
                              Having deployed this WAR in WebLogic 10.3g, the Spring Framework is empty and displays "There are no items to display". Any clue please ?

                              Many thanks in advance.

                              Nicolas

                              Comment

                              Working...
                              X