Can anyone help me?
Liang Xiao Zhu escribió:
Hi Bill,
I did what you said and still doesnt work!!! I show my code and how
I've implemented the whole things.
I added in the java/org/apache/catalina/deploy/mbeans-descriptors.xml
the follow code:
...
<mbean name="Kaugures"
className="org.apache.catalina.mbeans.AuguresMBean"
description="Augures environment"
domain="Catalina"
group="Resources"
type="org.apache.catalina.deploy.Augures">
<attribute name="className"
description="Fully qualified class name of the managed
object"
type="java.lang.String"
writeable="false"/>
<operation name="HelloWorld"
description="Prueba de AUGURUS"
impact="ACTION"
returnType="java.lang.String">
</operation>
...
And the file (java/org/apache/catalina/deploy/Augurus.java) to
implement the bean is here:
package org.apache.catalina.deploy;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.management.ObjectName;
import org.apache.tomcat.util.modeler.Registry;
import org.apache.catalina.mbeans.MBeanUtils;
import org.apache.catalina.mbeans.AugurusMBean;
public class Augurus implements AugurusMBean {
private Registry registry = MBeanUtils.createRegistry();
public Augurus() {
ObjectName name = null;
try {
name = new ObjectName("Application:Name=Server,Type=Server");
registry.getRegistry(null, null).registerComponent(this, name,
null);
} catch (Exception e) {
e.printStackTrace();
}
}
// interface method implementations
public String HelloWorld(){
return "Hola";
}
}
And finally, the interface
(java/org/apache/catalina/mbeans/AugurusMBean.java):
package org.apache.catalina.mbeans;
public interface AugurusMBean{
public String HelloWorld();
}
Could you tell what wrong is? Because I didn't find nothing about my
Bean.
Thanks in advance!!!
Bill Barker escribió:
To use the mbeans-descriptor.xml method, somewhere in your code you
need to do something like:
Registry.getRegistry(null,
null).registerComponent(this, oname, null );
Where 'oname' is the ObjectName that you want to register your
component under. Since you are using TC6, the correct import is:
import org.apache.tomcat.util.modeler.Registry;
"Liang Xiao Zhu" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi Bill,
Yes, I am implementing a custom class that doesnt extend from any
Tomcat class. But I dont know how to self-register, I tried change
the mbeans-descriptor.xml and others things and looks like that
nothing works!!!
Thanks
Bill Barker escribió:
Chuck's post works for implementing custom Tomcat components (e.g.
a custom Realm extending RealmBase). If you are implementing a
custom class that doesn't extend any Tomcat class, then your class
will have to self-register itself. Since you say you are using
TC6, the default configuration should give you access to the
Registry class to allow you to do it using the
mbeans-descriptor.xml method that the (forked) commons-modeler uses.
"ubekhet" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi Caldarale,
Yes, I use the current version of Tomcat. Thanks for your link,
but I want to know how to implement MBean, because according the
web you gave, I have to add my MBean to the mbeans-descriptor.xml
and also the folder where is contained.
For example, if I want to implement the HelloWorld in
java/org/apache/catalina/mbeans, first of all I have to add to
mbeans-descriptor.xml in java/org/apache/catalina and then also in
java/org/apache/catalina/mbeans.
On the other hand, I've implemented HelloWorld.java in
java/org/apache/catalina/deploy and HelloWorldMBean as interface
in java/org/apache/catalina/mbeans. This implementation is the
correct way? Other way in the same java/org/apache/catalina/deploy
directory contain another mbeans-descriptor.xml file
Can you say me, if I am right?
Thanks a lots!!!
Caldarale, Charles R wrote:
-----Original Message-----
From: Liang Xiao Zhu [mailto:[EMAIL PROTECTED]
Subject: JMX MBean
I am searching how to implement a MBean for a class that I
implemented, which add some new funcionality to Tomcat.
Don't suppose you'd care to tell us what version of Tomcat you're
using?
If it's the current level, have you followed these instructions?
http://tomcat.apache.org/tomcat-6.0-doc/mbeans-descriptor-howto.html
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE
PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the
e-mail
and its attachments from all computers.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]