First sorry for the vague question.
I am looking for a configuration framework for Java to manage database connection strings, content paths, integration endpoints, etc. I.e. when my servlet starts up, it should be able to query a configuration service at runtime for a database connection and use that connection to bootstrap itself. Likewise, when it needs to contact a service it is integrated with, it should be able to contact the same configuration service for the URL. Obviously, those answers should be different for test environments than for production.
Does anything like that exist?
I don't have experience of developing and deploying servlets, but for "normal" applications, a common approach is to have several configuration files (in whatever syntax you want, for example, XML or Java properties): one configuration file with settings for your test environment, another configuration file with settings for your production environment, and so on.
Then you use a mechanism to tell your application which configuration file it should use. The mechanism for this could be a command-line argument, a Java system property, or an environment variable. Alternatively, your application/servlet might look for a hardcoded configuration filename on its classpath, in which case you would make the environment-specific version of the configuration file available in the classpath when deploying your application/servlet.