You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ewan Harrow <3m...@sneakemail.com> on 2004/06/30 13:08:41 UTC

Deploy/install custom jmx mbean in tomcat 5.0.19

How does one actually deploy an mbean in tomcat5 so that it is
accessibile via the admin webapp or is this not actually possible?

I have created a TestMBean interface and a simple implementation class
with a get/set and int attribute and copied to
<TOMCAT_HOME>/shared/classes.  Along with the classes I created a
deployment descriptor named mbean-descriptor.xml

<?xml version="1.0"?>
<mbeans-descriptors>
    <mbean name="Stuff" className="Test" description="Test stuff"
domain="Test" group="Resources" type="TestMBean">
        <operation name="getNumber" description="gets the number"
impact="ACTION" returnType="int"></operation>
    </mbean>
</mbeans-descriptors>

I then updated the <TOMCAT_HOME>/conf/server.xml so that the listener
included the new mbean-descriptor.xml.

<Server>
  <Listener
className="org.apache.catalina.mbeans.ServerLifecycleListener"
descriptors="/mbean-descriptor.xml"></Listener>

I get no errors when restarting but also nothing in the admin webapp or
the jmxproxy.

What am I doing wrong?  I had hoped that this would have been as easy
as adding an mbean to JBoss.

rgds

ewan





	
	
		
___________________________________________________________ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself http://uk.messenger.XXXXXXXXX

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Deploy/install custom jmx mbean in tomcat 5.0.19

Posted by Peter Rossbach <pr...@objektpark.de>.
Currently,

your bean are not started automaticly with this configuration. You must 
write a own LifecycleListener
that start your Mbeans.

Other options is you can configure at engine element is

<Engine mbeansFile="conf/tomcat5-mbeans.xml">
</Engine>

Look at commons-modeler project for documentation:

Here is my example to made a better support possible:

<bean>

    <mbean name="Bean:type=Bean"
        code="org.apache.commons.modeler.modules.MyBean">
        <attribute name="name" value="Peter"/>
    </mbean>
    <jmx-attribute objectName="Bean:type=Bean"
        name="street"
        value="Am Jo"/>

    <jmx-operation objectName="Bean:type=Bean"
        operation="start"/>
    <mbean name="Bean:type=Bean2"
        code="org.apache.commons.modeler.modules.MyBean">
    </mbean>
    <jmx-operation objectName="Bean:type=Bean2"
        operation="setall">
        <arg type="java.lang.String" value="Peter"/>
        <arg type="java.lang.String">Am Jo</arg>
    </jmx-operation>

    <mbean name="Bean:type=Bean3"
        code="org.apache.commons.modeler.modules.MyBean">
        <arg type="java.lang.String" value="Peter"/>
        <arg type="java.lang.String">Am Jo</arg>
    </mbean>

</bean>

I have send a patch for some month to the commons-modeler project 
(http://jakarta.apache.org/commons/modeler/) for better
suppport, but there wasn't accepted.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26493

regards
Peter
 
Ewan Harrow schrieb:

>How does one actually deploy an mbean in tomcat5 so that it is
>accessibile via the admin webapp or is this not actually possible?
>
>I have created a TestMBean interface and a simple implementation class
>with a get/set and int attribute and copied to
><TOMCAT_HOME>/shared/classes.  Along with the classes I created a
>deployment descriptor named mbean-descriptor.xml
>
><?xml version="1.0"?>
><mbeans-descriptors>
>    <mbean name="Stuff" className="Test" description="Test stuff"
>domain="Test" group="Resources" type="TestMBean">
>        <operation name="getNumber" description="gets the number"
>impact="ACTION" returnType="int"></operation>
>    </mbean>
></mbeans-descriptors>
>
>I then updated the <TOMCAT_HOME>/conf/server.xml so that the listener
>included the new mbean-descriptor.xml.
>
><Server>
>  <Listener
>className="org.apache.catalina.mbeans.ServerLifecycleListener"
>descriptors="/mbean-descriptor.xml"></Listener>
>
>I get no errors when restarting but also nothing in the admin webapp or
>the jmxproxy.
>
>What am I doing wrong?  I had hoped that this would have been as easy
>as adding an mbean to JBoss.
>
>rgds
>
>ewan
>
>
>
>
>
>	
>	
>		
>___________________________________________________________ALL-NEW Yahoo! Messenger - sooooo many all-new ways to express yourself http://uk.messenger.XXXXXXXXX
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org