Java Datasource Management via WebApp
Currently, we store datasource definitions in the Tomcat container inside server.xml and expose environment variables through context.xml.
Any time we change an environment variable or datasource, it requires a server restart for those changes to be live.
Is there a way that we could create a web application to manage these things? Instead of storing them in the server context.xml and server.xml files, we could store them in another file and have them be modifiable through the webapp. When an application wants a datasource, it could request it from the webapp (maybe through messaging). I had thought about modifying the jndi elements at runtime and saving the changes in a file, but found that Tomcat does not allow that.
If it's not obvious, I have only a little experience with the technologies involved, but would like a direction to head in. I don't want to do anything hackish and would like to follow standards.
Would it be correct to have a webapp that handles global datasource and global variable management, requiring you to request these objects throu开发者_开发百科gh messaging? If not, what are some preferable alternatives?
Well, you could have used the Tomcat "admin" package, if it existed. But then, it was never ported from version 5 to 6 for various reasons. The post itself states the right way on how one must right the admin tool.
In the meantime, you could possibly use the MBeans exposed by Tomcat, although I can't vouch for anything useful being present.
Look at migrating to a different application server.
For instance Glassfish might suit your requirements.
http://blogs.oracle.com/alexismp/entry/glassfish_ose_3_0_1
http://glassfish.java.net/
精彩评论