Announcement Announcement Module
Collapse
No announcement yet.
jmx in tomcat 5.5 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • jmx in tomcat 5.5

    Hello,

    I'm new to spring and trying to export some MBeans.
    My application is running as Servlet in tomcat 5.5. In the net I've found some examples how to use jmx in spring:

    Code:
    	<!--+
    		| JMX
    		+-->		
    	<bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean"/>
    
    	<bean id="serverConnector" class="org.springframework.jmx.support.ConnectorServerFactoryBean">
    		  <property name="objectName" value="connector:name=rmi"/>
    		  <property name="serviceUrl" 
                   value="service:jmx:rmi://localhost/jndi/rmi://localhost:9099/myconnector"/>
    	</bean>
    
    
    	<bean id="helloBean"
    		class="jmx.HelloWorldMBean" />
    Code:
    package jmx;
    
    public class HelloWorldMBean implements IHelloWorldMBean {
    
        public String getHello() {
            return "hello world";
        }
    }
    if i start tomcat and the jconsole I don't see any beans. When I start tomcat with -Dcom.sun.management.jmxremote.port=1099
    -Dcom.sun.management.jmxremote.authenticate=false I see the server for tomcat. But my configuration should start a seperate one?
    Or is it wrong when I insert "service:jmx:rmi://localhost/jndi/rmi://localhost:9099/myconnector" on the third tab jconsole to open the connection?

    Thanks for your help

    Mike

  • #2
    oh, I've forgotten to post the coder for the exporter:



    Code:
    <bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
        <property name="beans">
          <map>
            <entry key="bean:name=helloBean" value-ref="helloBean"/>
          </map>
        </property>
      </bean>

    Comment


    • #3
      No need for ServerConnector

      Hi,

      you don´t need the "serverConnector".
      Only make sure jmx is enabled with it properties in catalina.sh.
      See the configuration below. Works with tomcat 5.5 and shows all beans (tomcats and yours).
      You have to use the InterfaceBased..Assembler if you define your MBean-functionality with Interfaces.


      <bean id="mbeanServer" class="java.lang.management.ManagementFactory" factory-method="getPlatformMBeanServer"/>

      <bean id="exporter" class="org.springframework.jmx.export.MBeanExporte r" lazy-init="false">
      <property name="server" ref="mbeanServer"/>
      <property name="beans">
      <map>
      <entry key="xyadmin.eva:name=eva.loader" value-ref="evaLoader" />
      </map>
      </property>
      <property name="assembler">
      <bean class="org.springframework.jmx.export.assembler.In terfaceBasedMBeanInfoAssembler">
      <property name="managedInterfaces">
      <value>x.x.x.IEVAQueryLoaderMBean</value>
      </property>
      </bean>
      </property>
      </bean>

      Comment


      • #4
        Hi,

        I am trying to do the same thing having tomcat to manage my servlet web app. I have read this article http://tomcat.apache.org/tomcat-5.0-doc/index.html, but I don't understand how to get it to work.

        Can you please help?

        I have a servlet running on tomcat. I just want to export some configuration so that I can change it remotely. Can you please tell me how to achieve that?

        Comment


        • #5
          Whole Tomcat-Docs

          Hi,

          your link points the index-page of whole tomcat-docs. Don't know what you tried to do.
          But first, do you tried my first reply?
          Are you familiar with JMX-Basics?

          May be you should try a simpler Example before. Do you tried the Example in the Spring-Docs?

          Jörg

          Comment

          Working...
          X