Closed image357 closed 6 years ago
You have to add an empty persistence_db_jndi_datasource
environment variable.
The reason is that the WebApp has to choose which of the two database connections to use, the Tomcat provided datasource, or a self-connected database connection. Since the persistence_db_jndi_datasource
variable is always set from the context.xml, it will automatically choose that, unless you explicitly override the value of that variable, by setting it to empty.
I've recently updated the example docker-compose files with this empty variable.
Ah yes, now it works. I wasn't quite sure what this empty variable did. Thanks for the explanation!
Hey,
I just tried if I can override the settings of
persistence_db_url=jdbc:postgresql://database:5432/sensorthings
via environment variables in my docker-compose file.In my context.xml I have
url="jdbc:postgresql://localhost:5432/sensorthings"
for debugging and coding on my local machine. However, for the containers I want to reference the postgres/postgis container (database).Can I do that with the first line in my docker-compose file? Is it supposed to override the settings in context.xml? Currently it does not override it, I think.
My docker-compose.yml:
On the database init page i get
Failed to initialise database: Cannot create PoolableConnectionFactory (Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.)
Which is also strange because, I have the container port 5432 wired to localhost 5432 and it accepts TCP connections on it (tested via "nc -z localhost 5432").
Cheers, Marcel Köpke