Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

How to create global resources on the fly?

Mikolaj Rydzewski

2006-12-04

Replies:

Hi,

There's one thing I don't like in Tomcat: I have to edit server.xml file
to add new global resources (i.e. data ource definition). It's not a big
problem on a production, one doesn't change such things often. But on
developement server it's quite annoing.

I don't want to put datasource definition inside META-INF/context.xml.
There's already resourceLink there (in my case). Sure, I could have two
versions of context.xml, one for production and the other for dev,
but... but I dont't want to change that ;-)

I'd like to be able to: place a small xml file (i.e. resource
definition, exactly like in the server.xml) in some directory watched by
Tomcat, and Tomcat to 'deploy' it (create a datasource, mail session,
etc). Just like it do with resource elements. I think that JBoss has
that feature, but it's too heavy for my needs.

I have tried and it is possible to create new datasources via JMX,
without restarting Tomcat.

Is there such a tool or I have to write it? ;-)

There're some promising entries in the server.xml file:
<Listener className="org.apache.catalina.core.AprLifecycleListener" />
<Listener
className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener
className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>

What do you think?

--
Mikolaj Rydzewski <miki@(protected)>


Attachment: smime.p7s
©2008 junlu.com - Jax Systems, LLC, U.S.A.