You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Jakob Praher <pr...@liwest.at> on 2002/11/21 16:29:24 UTC

howto extend catalina with mbeans

hi all,

first of all kudos for the 4.1.x release - working with jmx is simply
great ;-)

I have a question, how to best extend catalina through jmx:

for instance I have a special connector mbean or adaptor mbean, that I
want to load into catalina.

is there a way (for instance in the server.xml configuration file) to
laod this mbean during startup ?

if not: what is the best way to plug in a third party mbean into
catalina ?

should I write a custom lifecyclelistener?

thanks 

-- Jakob
"the best way to predict the future ist to invent it" -- Alan Kay





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


Re: howto extend catalina with mbeans

Posted by Costin Manolache <cm...@yahoo.com>.
Jakob Praher wrote:


>> Right now catalina can be extended with Valves or connectors or
>> listeners.
>> Some of them  (like jk connector ) can define MBeans. The major problem
>> is having the admin interface recognize them - it should work
>> but I never tried.
> 
> I'll have to look at them.
> 
> I only know that the default mbeans are plugged in with a
> lifecyclelistener.

The lifecycle listener generates model mbeans for components. 
A component can register its own mbeans.

There is one major problem - if a component is not recognized by
modeler ( which generates the mbean proxy ) you may see an exception.
That will be fixed ( by using the META-INF and the introspection - and 
allowing external components to be loaded by modeler ).


> but I like the idea of beeing able to add MBeans to webapps.
> where is your code located in the jakarta-modeller source tree ?

Registry.java. 
There are 2 pieces of code - one for loading descriptors from 
META-INF and another one for generating metadata using introspection.

Using mbeans in webapps ( or adding modeler wrappers for any
bean ) is easy, the real problem is integrating those mbeans
with the admin and using the full power of the mbean model ( like
jboss is doing ) ( for things like reloading modules, etc).

The module-as-webapp stuff in tomcat3.3 tried to solve the same problem,
but mbeans and mlets are a _far_ better solution.


>> The only important thing is to get the MBeanServer using the same
>> mechanisms ( i.e. get existing instead of creating new one ).
>> 
> don't know exactly what you mean by this ...

Don't create the mbean server - first look for existing instances.
Look at Registry.java for the code that gets the mbean server.


>> Another issue that wasn't much discussed is having mechanisms to
>> use mbeans as extensions ( hooks, etc) - and use the mbean lifecycle
>> and naming as a registration ( or alternatively, use a JNDI/JMX
>> combination - the big problem with JMX is that you can't get the real
>> object, all calls must be made via mbean server)
> 
> yes that's the tradeof. this makes JMX so powerful ( no direct
> references ) but it can make things slow ...

For config stage - it doesn't matter most of the time, it's not 
a critical path. ( you don't do 100 config changes per second ).

JMX notifications can be used to dynamically add/remove modules - 
but the problem is that inside the code you must use the real
instance ( instead of invoke ). 

That's why I think JNDI + JMX is the right solution - catalina
already has a very good JNDI support, and what we can do is 
use JNDI for naming and JMX for management ( the way they were
intended :-). 

JMX notifications and name can be used to lookup in JNDI for the
actual hook ( Valve, interceptor, handler, etc ), and combined
with the mlet stuff this gives us the maximum flexibility
( i.e. you can add/remove/change/reconfig connectors and valves without
restarting the server - if you want to ).

All this is relatively easy to implement - but it requires a lot
of preparation ( and agreement on the details ).


> one thing I could imagine is to go both directions:
> 
> a) via MBeans
> b) via plain java interfaces ...

That's my opinion as well ( with the "plain java interfaces" bound in the
JNDI ).

Costin 





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


Re: howto extend catalina with mbeans

Posted by Jakob Praher <oe...@hapra.at>.
Am Don, 2002-11-21 um 19.29 schrieb Costin Manolache:
> The solution is not yet very well defined. 
yup. I have experienced the same.

> 
> Right now catalina can be extended with Valves or connectors or listeners.
> Some of them  (like jk connector ) can define MBeans. The major problem
> is having the admin interface recognize them - it should work
> but I never tried.

I'll have to look at them.

I only know that the default mbeans are plugged in with a
lifecyclelistener.

> 
> I already committed some code to modeler to allow modules to 
> have their own modeler description ( in META-INF/modeler-mbean.xml )
> and have it loaded automatically using getResources(). The code
> is not yet used, but will probably be for 5.0 ( or I hope so ).
> But if you implement your own mbean - you can register them yourself.
> 

ok. would be interesting to see what the avalon project is doing in this
direction - they have management extensions for their containers.

but I like the idea of beeing able to add MBeans to webapps.
where is your code located in the jakarta-modeller source tree ?

> The only important thing is to get the MBeanServer using the same 
> mechanisms ( i.e. get existing instead of creating new one ).
> 
don't know exactly what you mean by this ... 

> Also note that there are discussions on using modeler mbean to implement
> config changes ( it is not yet clear what's the best solution ), that
> may affect the support for custom mbeans.
> 
sounds interesting.

> Another issue that wasn't much discussed is having mechanisms to
> use mbeans as extensions ( hooks, etc) - and use the mbean lifecycle
> and naming as a registration ( or alternatively, use a JNDI/JMX combination 
> - the big problem with JMX is that you can't get the real object, all
> calls must be made via mbean server)

yes that's the tradeof. this makes JMX so powerful ( no direct
references ) but it can make things slow ...

one thing I could imagine is to go both directions:

a) via MBeans 
b) via plain java interfaces ...


thanks very much for your help 

-- Jakob

> 
> Costin
> 
> 
> 
> Jakob Praher wrote:
> 
> > hi all,
> > 
> > first of all kudos for the 4.1.x release - working with jmx is simply
> > great ;-)
> > 
> > I have a question, how to best extend catalina through jmx:
> > 
> > for instance I have a special connector mbean or adaptor mbean, that I
> > want to load into catalina.
> > 
> > is there a way (for instance in the server.xml configuration file) to
> > laod this mbean during startup ?
> > 
> > if not: what is the best way to plug in a third party mbean into
> > catalina ?
> > 
> > should I write a custom lifecyclelistener?
> > 
> > thanks
> > 
> > -- Jakob
> > "the best way to predict the future ist to invent it" -- Alan Kay
> 
> 
> 
> 
> --
> 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>


Re: howto extend catalina with mbeans

Posted by Jakob Praher <pr...@liwest.at>.
Am Don, 2002-11-21 um 19.29 schrieb Costin Manolache:
> The solution is not yet very well defined. 
yup. I have experienced the same.

> 
> Right now catalina can be extended with Valves or connectors or listeners.
> Some of them  (like jk connector ) can define MBeans. The major problem
> is having the admin interface recognize them - it should work
> but I never tried.

I'll have to look at them.

I only know that the default mbeans are plugged in with a
lifecyclelistener.

> 
> I already committed some code to modeler to allow modules to 
> have their own modeler description ( in META-INF/modeler-mbean.xml )
> and have it loaded automatically using getResources(). The code
> is not yet used, but will probably be for 5.0 ( or I hope so ).
> But if you implement your own mbean - you can register them yourself.
> 

ok. would be interesting to see what the avalon project is doing in this
direction - they have management extensions for their containers.

but I like the idea of beeing able to add MBeans to webapps.
where is your code located in the jakarta-modeller source tree ?

> The only important thing is to get the MBeanServer using the same 
> mechanisms ( i.e. get existing instead of creating new one ).
> 
don't know exactly what you mean by this ... 

> Also note that there are discussions on using modeler mbean to implement
> config changes ( it is not yet clear what's the best solution ), that
> may affect the support for custom mbeans.
> 
sounds interesting.

> Another issue that wasn't much discussed is having mechanisms to
> use mbeans as extensions ( hooks, etc) - and use the mbean lifecycle
> and naming as a registration ( or alternatively, use a JNDI/JMX combination 
> - the big problem with JMX is that you can't get the real object, all
> calls must be made via mbean server)

yes that's the tradeof. this makes JMX so powerful ( no direct
references ) but it can make things slow ...

one thing I could imagine is to go both directions:

a) via MBeans 
b) via plain java interfaces ...


thanks very much for your help 

-- Jakob

> 
> Costin
> 
> 
> 
> Jakob Praher wrote:
> 
> > hi all,
> > 
> > first of all kudos for the 4.1.x release - working with jmx is simply
> > great ;-)
> > 
> > I have a question, how to best extend catalina through jmx:
> > 
> > for instance I have a special connector mbean or adaptor mbean, that I
> > want to load into catalina.
> > 
> > is there a way (for instance in the server.xml configuration file) to
> > laod this mbean during startup ?
> > 
> > if not: what is the best way to plug in a third party mbean into
> > catalina ?
> > 
> > should I write a custom lifecyclelistener?
> > 
> > thanks
> > 
> > -- Jakob
> > "the best way to predict the future ist to invent it" -- Alan Kay
> 
> 
> 
> 
> --
> 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>


Re: howto extend catalina with mbeans

Posted by Costin Manolache <cm...@yahoo.com>.
The solution is not yet very well defined. 

Right now catalina can be extended with Valves or connectors or listeners.
Some of them  (like jk connector ) can define MBeans. The major problem
is having the admin interface recognize them - it should work
but I never tried.

I already committed some code to modeler to allow modules to 
have their own modeler description ( in META-INF/modeler-mbean.xml )
and have it loaded automatically using getResources(). The code
is not yet used, but will probably be for 5.0 ( or I hope so ).
But if you implement your own mbean - you can register them yourself.

The only important thing is to get the MBeanServer using the same 
mechanisms ( i.e. get existing instead of creating new one ).

Also note that there are discussions on using modeler mbean to implement
config changes ( it is not yet clear what's the best solution ), that
may affect the support for custom mbeans.

Another issue that wasn't much discussed is having mechanisms to
use mbeans as extensions ( hooks, etc) - and use the mbean lifecycle
and naming as a registration ( or alternatively, use a JNDI/JMX combination 
- the big problem with JMX is that you can't get the real object, all
calls must be made via mbean server)

Costin



Jakob Praher wrote:

> hi all,
> 
> first of all kudos for the 4.1.x release - working with jmx is simply
> great ;-)
> 
> I have a question, how to best extend catalina through jmx:
> 
> for instance I have a special connector mbean or adaptor mbean, that I
> want to load into catalina.
> 
> is there a way (for instance in the server.xml configuration file) to
> laod this mbean during startup ?
> 
> if not: what is the best way to plug in a third party mbean into
> catalina ?
> 
> should I write a custom lifecyclelistener?
> 
> thanks
> 
> -- Jakob
> "the best way to predict the future ist to invent it" -- Alan Kay




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