On a Linux system, I need to deploy Java processes that have hostnames for external data and web server names hard-coded into the app, e.g. "mailserver" and "ftpserver". When deploying on different hosts, we can of course use /etc/hosts to allow each deploy of this app use a different remote server for its "mailserver" or "ftpserver".
Now, we'd like to consolidate several application deployments onto one host. However, each deployment still needs to point to it's own "mailserver" or "ftpserver", and this consolidated host's /etc/hosts cannot be used as it is shared by all the instances of the apps.
Is there a way to specify within a process' context a mapping of name-to-IP without using /etc/hosts or even DNS - since these are system-wide and shared by all processes?
I understand chroot would do the trick but am only willing to use that as a last resort.
Cheers, Dog