I wanted to know if there is a way we can separate the server configurations away from a web application so that we may be free to deploy into any JBoss server without having to worry about server configurations during build time.
This is the situation. We have built a web application that deploys to four separate JBoss instances, and each server has its own set of configurations that are required by the web application. Ideally, I would like to house those configurations on each JBoss server (ideally as a properties or xml), and somehow have the web application read those values (they would be string values similar to those from a properties file) from the server it is deployed against without having to build the application 4 different times. I have thought about using JNDI, but I do not know to implement it without having to place the values within the env-entry tags within the jboss-web.xml/web.xml which defeats the purpose of what I am trying to do.
Our application is a standard J2EE application that uses the following technologies.
I am wondering if I could build a SAR module that would take the properties, and place them within the JNDI as soon as the server starts. This way we can read the properties from the JNDI through our web application. I am hoping that this is not overkill. This way, the SAR is responsible only for configuration properties and getting them into the JNDI, and our web application would be responsible for running our application with configurations from the JNDI. If anyone has a different solution, please let me know.
One possible way is to create a properties file and place it in the JBOSS_HOME/server/< servername>/conf folder of each of the JBoss instances where you have your application deployed. The JBOSS_HOME/server/< servername>/conf is by default available in classpath. So in your web application code, you can do something like: