tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amy Roh <amy...@apache.org>
Subject Re: User Defined Realm. How to register MBean in Tomcat 4.1.x
Date Tue, 27 Aug 2002 04:01:11 GMT
Hi Alex,

Roytman, Alex wrote:
> Dear Catalina developers,
> 
> I am trying to port my LDAP realm from tomcat 4.0.x to tomcat 4.1.9.
> I was unable to find any information on how to make my custom Realm work =
> in Catalina's JMX environment. The problem is I do not know how to =
> register (do I need to) a MBean for my realm. Please pardon me if my =
> questions seems to be naive but I had no chance to learn JMX.
> 
> When I try to use my realm Tomcat starts fine, the Realm itself works =
> just fine too but tomcat reports error that MBean for my Realm is not =
> found.=20
> Well it can't be found - it is not registered. So my question is:
> 1. Does tomcat 4.1.x have any way to register custom MBeans ? As far as =
> I understand, right now they are defined in mbeans-descriptors.xml file =
> which is not meant to be modified by deployers. Also how should I supply =
> a factory method for my MBean and do I need it at all.=20
> I tried to fool tomcat by providing modified copy of the =
> mbeans-descriptors.xml and MBeanFactory.class  in =
> $CATALINA_HOME/server/classes and it seems to take it but of course it =
> is just a dirty hack.

You can just add a mbean description for your custom Realm in 
mbeans-descriptors.xml file.  The following would be an example mbean 
description for a custom Realm.

   <mbean         name="MyLDAPRealm"
             className="org.apache.catalina.mbeans.ClassNameMBean"
           description="MyLDAPRealm"
                domain="Catalina"
                 group="Realm"
                  type="org.apache.catalina.realm.MyLDAPRealm">

     <attribute   name="className"
           description="Fully qualified class name of the managed object"
                  type="java.lang.String"
             writeable="false"/>
   </mbean>




> 2. Is it a crime to not to have a MBean for one of the tomcat components =
> (i.e. registering realm with no appropriate MBean)? If MBean is not =
> mandatory can error message be suppressed?

No, it is not a crime. ;-)  Like you said, Tomcat(except admin webapp) 
and your custom components will work fine without registering MBean for 
it.  Also, You can turn off MBean support by commenting out two 
Listeners (ServerLifecycleListener and GlobalResourcesLifecycleListener) 
in server.xml if you want to avoid seeing the mbean errors.  However, 
you need those Listeners if you want to run admin webapp.

Amy

> 
> 
> Your advice is greatly appreciated
> 
> Thank you
> 
> Alex
> 
> --
> To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>
> 




--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message