I’m trying to parameterize the configuration of database credentials in the data-sources.xml files by including placeholders in them initial (e.g. #JDBC_URL#) and then using sed to rewrite those at container runtime using environment variables, which are defined in docker-compose.yml.
The substitution seems to be working fine, but the Tomcat app server fails to boot correctly—complaining about JDBC configuration issues—if I do the substitution. When I hardcode values in place of the placeholders, everything works fine.
I suspect that I’m doing something silly and just running into the limits of my knowledge of Docker, Java enterprise apps, and sed.
Thoughts about what might be going wrong:
Are the data-sources.xml files the ones that Tomcat is actually using during startup, or are there other data-sources.xml files that it might actually be using?
Is the substitution happening after Tomcat tries to use them?
Is there potentially a permissions issue with Tomcat not being able to view those data-sources.xml files?
To debug this, start by changing oba_entrypoint.sh's final command to something like tail -f /dev/null. That will keep Docker from stopping, but won't try to start Tomcat. You can enter the Docker environment and start Tomcat manually. Perhaps it will start fine, indicating a timing problem of some kind. If it fails, you can poke around for the root of the problem and try to restart it multiple times. Change permissions, re-type the credentials by hand, etc.
I’m trying to parameterize the configuration of database credentials in the data-sources.xml files by including placeholders in them initial (e.g.
#JDBC_URL#
) and then usingsed
to rewrite those at container runtime using environment variables, which are defined indocker-compose.yml
.The substitution seems to be working fine, but the Tomcat app server fails to boot correctly—complaining about JDBC configuration issues—if I do the substitution. When I hardcode values in place of the placeholders, everything works fine. I suspect that I’m doing something silly and just running into the limits of my knowledge of Docker, Java enterprise apps, and
sed
.Thoughts about what might be going wrong:
To debug this, start by changing
oba_entrypoint.sh
's final command to something liketail -f /dev/null
. That will keep Docker from stopping, but won't try to start Tomcat. You can enter the Docker environment and start Tomcat manually. Perhaps it will start fine, indicating a timing problem of some kind. If it fails, you can poke around for the root of the problem and try to restart it multiple times. Change permissions, re-type the credentials by hand, etc.