Actually, I design all my webapps so that you
don't have to edit the war file. The exact same byte-for-byte copy of the WAR serves for local
testing, Beta testing, and production. I do this by defining the variable parts of the webapp as externally-injectable resources that can be retrieved via JNDI. The database location info comes that way naturally, since I always use server-pooled DataSources, but I also use external resource definitions to specify where file upload directories are, locations of server-specific property files, and so forth.
It makes the program design slightly more complex, but keeps the build simple. Just as importantly, it ensures that the wrong copy of a WAR doesn't get deployed and have Production updating a Test database or
vice versa. Since there's only one copy, it's never the "wrong" one.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.