On Monday 03 January 2005 00:31, Patrick Lacson wrote:
> Here's a link to sample code for integrating tomcat 5.5.4
>
> http://lacson.name/archives/2004/12/how_to_embed_to.html
Patrick, thanks for your link. I don't currently intend to embed Tomcat,
just make an app running within Tomcat manageable. The latter I figured
out, among other things, through an out-of-band discussion with Peter
Rossbach. I can't offer a completely general solution, though.
I'm using the Spring framework (http://www.springframework.org) and had
a look at the JMX support classes that are currently in the CVS sandbox
directory. I found that, amazingly, with their help I could expose
attributes and operations of my app to JMX without writing any code.
All that is required are some declarations in the application context
file (applicationContext.xml).
Create an MBeanServer registered as a bean
<bean id="mbeanserver"
class="org.springframework.jmx.factory.MBeanServerFactoryBean">
<property name="defaultDomain"><value>MyDomain</value></property>
</bean>
Wrap an MBean adapter around my repositorymanager bean (not shown),
which is a completely ordinary java object. In this case, public
methods are exposed as attributes/operations. Alternatively, metadata
can be used.
<bean id="mbeanadapter"
class="org.springframework.jmx.JmxMBeanAdapter">
<property name="server"><ref bean="mbeanserver"/></property>
<property name="beans">
<map>
<entry key="MyDomain:id=Repository">
<ref bean="repositorymanager"/>
</entry>
</map>
</property>
</bean>
Create a connector listening, by default, on
service:jmx:jmxmp://localhost:9876 (this requires
jmxremote_optional.jar)
<bean id="jmxconnector"
class="org.springframework.jmx.remote.ConnectorServiceBean">
<property name="server"><ref bean="mbeanserver"/></property>
</bean>
Maybe this was of interest to anyone...
Michael
--
Michael Schuerig This is not a false alarm
mailto:michael@schuerig.de This is not a test
http://www.schuerig.de/michael/ --Rush, Red Tide
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
|