my dog learned polymorphism
The moose likes Tomcat and the fly likes Configure DataSource via JMX Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "Configure DataSource via JMX" Watch "Configure DataSource via JMX" New topic
Author

Configure DataSource via JMX

f roh
Greenhorn

Joined: Mar 11, 2011
Posts: 2
Hi,


Question:
Is it possible to configure the datasource of tomcat (any version) via JMX/MBeans?
If its possible will the changes be only transient (like JBoss) or can i persist them?

Why am i asking this:
i am trying to create a program which is able to deploy a file on a tomcat server and configure this server as described in a config file.


i do appreciate your help
thanks
fabian
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17030
    
  26

Welcome to the JavaRanch, Fabian!

Tomcat doesn't have "a" datasource, but it can support as many datasources as you want.

Most of the time I configure my datasources on a per-application basis, so I just put all that info in the context.xml file for the webapp along with all the other app config information. JBoss, however, goes for server-wide configurations. The view from the application is the same, however.

Using JMX to configure Tomcat is usually overkill, since you can't usually modify a database connection pool on the fly - you do it before the app goes online and (usually) leave it alone as long as the app is running, since otherwise you're in much the same situation as someone attempting to change tires on a moving automobile.

There are a number of ways to do what you're asking, but I'm actually not sure if they're worth the trouble.


An IDE is no substitute for an Intelligent Developer.
f roh
Greenhorn

Joined: Mar 11, 2011
Posts: 2
Ok,

thanks for the answer...

i think i will solve this issue with java IO and jdom. so just insert the datasource in the xml file.
i thought using jmx would be a nicer way because i could develop against the api.
 
Have you checked out Aspose?
 
subject: Configure DataSource via JMX
 
It's not a secret anymore!