Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: JMX in Weblogic 9

  1. #1
    Join Date
    Aug 2004
    Location
    Philadelphia, PA, USA
    Posts
    17

    Default 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.
    Dan Hayes
    J2EE Architect
    http://www.mydogboris.com

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Have you looked at WebLogicMBeanServerFactoryBean?
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default

    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.

  4. #4
    Join Date
    Aug 2004
    Posts
    1,107

    Default

    Also, shouldn't it be
    Code:
    java.naming.security.principal
    Thomas Risberg
    SpringSource by Pivotal
    http://www.springsource.org

  5. #5
    Join Date
    Aug 2004
    Location
    Philadelphia, PA, USA
    Posts
    17

    Default

    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.
    Dan Hayes
    J2EE Architect
    http://www.mydogboris.com

  6. #6
    Join Date
    Aug 2004
    Location
    Philadelphia, PA, USA
    Posts
    17

    Default

    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
    Dan Hayes
    J2EE Architect
    http://www.mydogboris.com

  7. #7
    Join Date
    Aug 2004
    Location
    Philadelphia, PA, USA
    Posts
    17

    Default

    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.
    Dan Hayes
    J2EE Architect
    http://www.mydogboris.com

  8. #8
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    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
    Rob Harrop
    Lead Engineer, dm Server
    SpringSource
    http://www.springsource.com

    Co-Author - Pro Spring

  9. #9
    Join Date
    Aug 2004
    Location
    Philadelphia, PA, USA
    Posts
    17

    Default

    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.
    Dan Hayes
    J2EE Architect
    http://www.mydogboris.com

  10. #10
    Join Date
    Aug 2005
    Location
    Sydney,Australia
    Posts
    11

    Default 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
    Abhijeet Rai
    Java Analyst Programmer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •