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

Thread: Need help with JMX, Spring, Tomcat, & MC4J

  1. #1

    Default 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
    Attached Images Attached Images

  2. #2

    Default

    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]

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

    Default

    mark the exporter as non lazy - lazy-init="false".
    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

  4. #4

    Default

    Quote 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.

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

    Default

    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.
    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

  6. #6

    Default

    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>

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

    Default

    What do you mean by not working - what do you expect to happen and does not?
    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

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

    Default

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

    Co-Author - Pro Spring

  9. #9

    Default

    Quote 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

  10. #10
    Join Date
    Aug 2004
    Location
    Sydney
    Posts
    503

    Default

    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.

Posting Permissions

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