Announcement Announcement Module
Collapse
No announcement yet.
Need help with JMX, Spring, Tomcat, & MC4J Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help with JMX, Spring, Tomcat, & MC4J

    I'm using Spring 1.2.7, Tomcat 5.5.16, & JDK 1.5. I start up tomcat with these options:

    -Dcom.sun.management.jmxremote.authenticate=false
    -Dcom.sun.management.jmxremote.ssl=false
    -Dcom.sun.management.jmxremote.port=8999
    -Dcom.sun.management.jmxremote

    My spring JMX conf looks like this (from the reference docs):

    <bean id="exporter" class="org.springframework.jmx.export.MBeanExporte r">
    <property name="beans">
    <map>
    <entry key="bean:name=testBean1" value-ref="testBean"/>
    </map>
    </property>
    </bean>

    <bean id="testBean" class="org.springframework.jmx.JmxTestBean">
    <property name="name" value="TEST"/>
    <property name="age" value="100"/>
    </bean>

    For MC4J, I use the Tomcat option with this:

    service:jmx:rmi:///jndi/rmi://localhost:8999/jmxrmi

    I connect just fine, but I don't see my spring beans.

    Our target platform is WebSphere but we use Tomcat for development. I'd like to come up with something that will work on both. It's ok if I have two separate confs for each server.

    Thanks to anyone who can help.

    -Michael

  • #2
    This is all I see in the logs:

    Code:
    11:05:19,929 [ain Thread] INFO  [MBeanExporter       ] - Bean with name 'swGenerateurMetDispatcher' has been autodetected for JMX exposure
    11:05:19,945 [ain Thread] DEBUG [MBeanExporter       ] - Located MBean under key [swGenerateurMetDispatcher]: registering with JMX server
    11:05:19,945 [ain Thread] DEBUG [MBeanExporter       ] - Unable to register MBean [canal.det.service.workflow.mege2med2met.impl.SWGenerateurMetDispatcherImpl@343829] with key [swGenerateurMetDispatcher]

    Comment


    • #3
      mark the exporter as non lazy - lazy-init="false".

      Comment


      • #4
        Originally posted by costin
        mark the exporter as non lazy - lazy-init="false".
        I had that defined as default..

        Here is the file with it added again:

        Code:
        <beans default-lazy-init="false">
        	<bean id="exporter"
        		class="org.springframework.jmx.export.MBeanExporter"
                lazy-init="false">
        		<property name="autodetect" value="true" />
        	</bean>
        
        </beans>
        Is there a Spring mailing list? I don't find mention of one on the website. I'm really stuck here, I am afraid I'll have to code up the JMX by hand because I can't get this working.

        Thanks for your help.

        Comment


        • #5
          Yes - the lists are listed here : http://sourceforge.net/mail/?group_id=73357 (from the development page).
          The log mention that the bean could not be registered - I'm not sure however why this happens since Spring only calls the underlying server. The samples included in the Spring distribution contain jmx support - use them and see how they work - you might spot some mistake somewhere.

          Comment


          • #6
            Working now, apparently it was the example in the documentation not having lazy-init="false". I'll open a JIRA issue for that.

            Now I'm finding that the InterfaceBasedMBeanInfoAssembler is not working..

            Code:
            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
            
            
            <beans default-lazy-init="false">
            
              <bean id="exporter"
                class="org.springframework.jmx.export.MBeanExporter">
                <property name="beans">
                  <map>
                    <entry key="bean:name=detCalendar" value-ref="detCalendar" />
                    <entry key="bean:name=swDepileurMegST"
                      value-ref="swDepileurMegST" />
                    <entry key="bean:name=swDepileurMegEM"
                      value-ref="swDepileurMegEM" />
                  </map>
                </property>
                <property name="assembler">
                  <bean
                    class="org.springframework.jmx.export.assembler.InterfaceBasedMBeanInfoAssembler">
                    <property name="interfaceMappings">
                      <props>
                        <prop key="detCalendar">
                          canal.det.service.technique.DetCalendarMBean
                        </prop>
                        <prop key="swDepileurMegST">
                          canal.det.service.workflow.common.DispatcherMBean
                        </prop>
                        <prop key="swDepileurMegEM">
                          canal.det.service.workflow.common.DispatcherMBean
                        </prop>
                      </props>
                    </property>
                  </bean>
                </property>
              </bean>
            
            
            </beans>

            Comment


            • #7
              What do you mean by not working - what do you expect to happen and does not?

              Comment


              • #8
                The 'key' of each properties entry for InterfaceBasedMBeanInfoAssembler should match the 'key' of each entry in the 'beans' Map on MBeanExporter. To simply this I often use a PropertyPlaceholderConfigurer for the keys:

                <bean id="exporter" class="..MBeanExporter">
                <property name="beans">
                <map>
                <entry key="${myMBean}" value-ref="someBean"/>
                </property>
                <property name="assembler">
                <bean
                class="org.springframework.jmx.export.assembler.In terfaceBasedMBeanInfoAssembler">
                <property name="interfaceMappings">
                <value>
                ${myMBean}=com.myapp.someInterface
                </value>
                </property>
                </bean>
                </property>
                </bean>

                In the PropertyPlaceholderConfigurer the property 'myMBean' is mapped to the ObjectName.

                Rob

                Comment


                • #9
                  Originally posted by cunparis
                  Working now, apparently it was the example in the documentation not having lazy-init="false". I'll open a JIRA issue for that.
                  Issue opened:

                  http://opensource.atlassian.com/proj...rowse/SPR-1935

                  Comment


                  • #10
                    I hope you can sort it out, but if you really get stuck, you can use JBoss.

                    It has Tomcat 5.5.x embedded, and you don't need to faff about with MX4J since JBoss already has an MBeanServer built in, incl. JMX console.

                    Comment


                    • #11
                      There's a neat solution to this described here:

                      http://www.smartkey.co.uk/blogArticl...ticleNumber=87

                      Comment

                      Working...
                      X