You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Roytman, Alex" <Ro...@peacetech.com> on 2002/08/27 03:13:01 UTC

User Defined Realm. How to register MBean in Tomcat 4.1.x

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


Your advice is greatly appreciated

Thank you

Alex

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: User Defined Realm. How to register MBean in Tomcat 4.1.x

Posted by Remy Maucherat <re...@apache.org>.
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.
> 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?
> 
> 
> Your advice is greatly appreciated

You can use the descriptors attribute of the ServerLifecycleListener 
listener in server.xml. The value should be a filename (or a list of 
filename); each of these should point to an XML file describing some 
custom beans according to the commons-modeler DTD.

Remy


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: User Defined Realm. How to register MBean in Tomcat 4.1.x

Posted by Amy Roh <am...@apache.org>.
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:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>