views:

240

answers:

7

For a typical J2EE web application, the datasource connection settings are stored as part of the application server configuration.

Is there a way to version control these configuration details? I want more control on the datasource and other application server config changes.

What is the standard practice for doing this?

A: 

Our (Spring) apps have a hardcoded jndi name in the spring config file. That way, the same ear can be deployed to dev, qa and prod environments, and you don't have to worry about database connection details.

The app server admins ensure that a datasource is registered against that jndi name, with the connection details as appropriate on each environment.

tunaranch
A: 

But how does this let me manage changes to datasource configurations in the application servers. Here's a scenario:

  1. DBAs change the connection password of the database server.

  2. Webspehere/Weblogic administrator makes corresponding changes to server configuration through administrator console.

The above change is not version controlled so there is no clean way of knowing the history of such changes.

The problem is not about how the application should be configured but about how the configuration changes should be version controlled. Perhaps it sounds like an overkill for simple projects but for some projects, controlling changes like these really becomes a problem.

Rahul
+1  A: 

When working with WebSphere we found the best approach was to script the deployment and place the script under version control plus the response files for each of the target environments.

bmatthews68
By "response" files - did you mean the log files? - if so, do you recommend setting up the scripts to automatically update the workspace (which is under version control) or did you mean checking in the logs (post-deployment) by hand? Thanks in advance! – critical.skill
Critical Skill
A: 

Any time you ask yourself "should X be in version control" the default answer is "yes".

For a more refined answer, ask yourself this: is the file created by a person (like a source file or a document) or is it generated by another program (like an object file or a distribution PDF)?

File that are created, and/or maintained, by a human should be under configuration control.

Charlie Martin
+1  A: 

Tracking configuration changes to your application server through version control is a good thing to ask for. However, It does imply that all changes are done via scripting, instead of the administrative web interface. I recommend

http://www.ibm.com/developerworks/java/library/j-ap01139/index.html?ca=drs-

as a good background information article on this topic.

Update: Just recently, part 2 has been published here: http://www.ibm.com/developerworks/java/library/j-ap02109/index.html?ca=drs-

Pieter V
+1  A: 

Websphere canbe tricky as the directory structure is a mess of files - often there appears to be duplicates and it's hard to figure which is the magic file you need to backup / restore . The question of how to go about this should not detract from the need to do it. - which is a definite yes.

mP
A: 

We are always using version control for our app server settings. It's a tool called WLST (weblogic scripting tool) which is part of the weblogic server distribution. The domain configuration is stored within a Jython script, which can easily be executed via command line and therefore integrates superb with our build tool maven.

Creating a preconfigured running weblogic domain only needs to execute a maven goal. All those annoying problems of misconfigured jdbc connections or wrong jms destination parameters are gone. You will always have a appserver configuration which matches the source code at a given time. You will never need to remember which app server setting must be applied for this specific version of the project you are working on.

I really recommend this.

I also would like to know, if there are similar solutions for other application server available. As far as i know there is a way for glassfish via ant. How this can be achieved for JBoss?

OC4J has an ant task that lets you do certain things, like create data sources.
tunaranch