Announcement Announcement Module
Collapse
No announcement yet.
Common Weblogic and Tomcat configuration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Common Weblogic and Tomcat configuration

    Hello,

    We have a web application (Spring MVC) that we need to deploy on Tomcat and Weblogic containers. We use an applicationContext.xml file initialized via
    Code:
    org.springframework.web.context.ContextLoaderListener
    to initialize our JMX related beans.

    We can configure our set up in applicationContext.xml to work in Tomcat, or in Weblogic, but not in both. Our managed beans disappear in Tomcat if we attempt to use the same configuration as Weblogic. We would like applicationContext.xml to be configured the same for either container.

    Details: springframework 2.0.1, tomcat 5.5.20, weblogic 9.2

    Setup for Weblogic (our production container):

    Code:
       <bean id="defaultMbeanServer" factory-method="createMBeanServer" class="javax.management.MBeanServerFactory" />
    
        <bean id="mbeanServer" class="org.springframework.jndi.JndiObjectFactoryBean">
              <property name="jndiName" value="java:comp/env/jmx/runtime" />
              <property name="defaultObject" ref="defaultMbeanServer" />
        </bean> 
    
    	<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
    		<property name="server" ref="mbeanServer"/> 
    		<property name="beans">
    			<map>
    				<entry key="com.some.co.system:serviceManagement=systemManager" value-ref="portalDSManager"/>
                    <entry key="com.some.co.system:cacheManagement=manageCache" value-ref="cacheManager"/>
                    <entry key="com.some.co.system:logging=logLevelController" value-ref="logLevelController"/>
                </map>
    		</property>
            <property name="assembler">
                <!-- will create management interface using annotation metadata -->
                <bean id="assembler" class="org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler">
                    <property name="attributeSource" ref="jmxAttributeSource"/>
                </bean>
            </property>
            <property name="registrationBehaviorName" value="REGISTRATION_REPLACE_EXISTING"/>
    	</bean>
    Setup for Tomcat requires removal of
    Code:
     <property name="server" ref="mbeanServer"/>
    node from the exporter bean.


    Code:
       <bean id="defaultMbeanServer" factory-method="createMBeanServer" class="javax.management.MBeanServerFactory" />
    
        <bean id="mbeanServer" class="org.springframework.jndi.JndiObjectFactoryBean">
              <property name="jndiName" value="java:comp/env/jmx/runtime" />
              <property name="defaultObject" ref="defaultMbeanServer" />
        </bean> 
    
    	<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
    		<property name="beans">
    			<map>
    				<entry key="com.some.co.system:serviceManagement=systemManager" value-ref="portalDSManager"/>
                    <entry key="com.some.co.system:cacheManagement=manageCache" value-ref="cacheManager"/>
                    <entry key="com.some.co.system:logging=logLevelController" value-ref="logLevelController"/>
                </map>
    		</property>
            <property name="assembler">
                <!-- will create management interface using annotation metadata -->
                <bean id="assembler" class="org.springframework.jmx.export.assembler.MetadataMBeanInfoAssembler">
                    <property name="attributeSource" ref="jmxAttributeSource"/>
                </bean>
            </property>
            <property name="registrationBehaviorName" value="REGISTRATION_REPLACE_EXISTING"/>
    	</bean>
    Thank you in advance for your assistance.

  • #2
    A default mbean server like this works for me (Spring 2.5.4, WLS 10.0, Tomcat 5.5.26):

    Code:
    <bean id="defaultMbeanServer" factory-method="locateMBeanServer"
        class="org.springframework.jmx.support.JmxUtils" />
    Chris

    Comment

    Working...
    X