OHDSI Home | Forums | Wiki | Github

FlywaySqlException when installing OHDSI/Broadsea

I am trying to install Atlas using the docker compose file in the OHDSI/Broadsea ( Broadsea/postgresql at master · OHDSI/Broadsea (github.com)). I am using PostgreSQL as the database with cdm5 database.
I have created the PostgreSQL container using a separate docker-compose file and thehyve/ohdsi_postgresql image has been used.

Following error is shown in the stdout log of broadsea-webtools.
UnsatisfiedDependencyException: Error creating bean with name ‘shiroFilter’ defined in class path resource [org/ohdsi
/webapi/ShiroConfiguration.class]: Unsatisfied dependency expressed through method ‘shiroFilter’ parameter 0; nested exc
eption is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘flyway’ defined in cla
ss path resource [org/ohdsi/webapi/FlywayConfig.class]: Invocation of init method failed; nested exception is org.flyway
db.core.internal.dbsupport.FlywaySqlException:
Unable to obtain Jdbc connection from DataSource
------------------------------------------------
SQL State : 08001
Error Code : 0
Message : The connection attempt failed.

My docker-compose file for broadsea is as follows.

version: ‘2’

services:

broadsea-methods-library:
image: ohdsi/broadsea-methodslibrary
ports:
- “8787:8787”
- “6311:6311”
environment:
- PASSWORD=mypass

broadsea-webtools:
image: ohdsi/broadsea-webtools
ports:
- “8080:8080”
volumes:
- .:/tmp/drivers/:ro
- …/config-local.js:/usr/local/tomcat/webapps/atlas/js/config-local.js:ro
environment:
- WEBAPI_URL=http://localhost:8080
- env=webapi-postgresql
- security_origin=*
- datasource_driverClassName=org.postgresql.Driver
- datasource_url=jdbc:postgresql://postgres:1234@localhost:5432/ohdsi
- datasource.cdm.schema=cdm5
- datasource.ohdsi.schema=ohdsi
- datasource_username=postgres
- datasource_password=1234
- spring.jpa.properties.hibernate.default_schema=ohdsi
- spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
- spring.batch.repository.tableprefix=ohdsi.BATCH_
- flyway_datasource_driverClassName=org.postgresql.Driver
- flyway_datasource_url=jdbc:postgresql://postgres:1234@localhost:5432/ohdsi
- flyway_schemas=ohdsi
- flyway.placeholders.ohdsiSchema=ohdsi
- flyway_datasource_username=postgres
- flyway_datasource_password=1234
- flyway.locations=classpath:db/migration/postgresql

When I load the Atlas dashboard it gives error “Unable to connect to an instance of the WebAPI. Please contact your administrator to resolve this issue.”

Please someone can help me to figure out what I am doing wrong here.
Thank you.

Hello @sandy,

In this context, localhost refers to the container, not to the host machine. You might want to use Docker network here to establish connection between your Atlas and DB containers. Or map ports through the host, but that’s a more fragile way.

Hello @rookie_crewkie ,
Thank you very much for your response.
Actually I am new to the docker and OHDSI as well. I am using Docker Desktop in windows 10 with WSL 2 based engine. I do not have an idea how to establish the connection. If it can be done with the docker host IP, then what would be the host machine IP and how could I find it in Windows OS.
Could you please help me to figure this out.
I am really thankful.

@sandy,

thehyve/ohdsi_postgresql image is based on bitnami/postgresql, which describes (see ‘Connecting to other containers’ section) how to create a network and connect containers. Once you define a common bridge network you can use database container name in datasource URLs, it’ll be resolved automatically.

For general understanding of bridge networks, there’s a simple 20-min hands-on tutorial on Docker website. Good luck!

Hi @rookie_crewkie ,
I was able to create bridge network between two containers and Atlas is connecting with Postgres successfully. But the FlywaySqlException looks like as follows.

UnsatisfiedDependencyException: Error creating bean with name 'shiroF
ilter’ defined in class path resource [org/ohdsi/webapi/ShiroConfiguration.class]: Unsatisfied dependency expressed through method ‘shiroFilter’ parameter 0
; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘flyway’ defined in class path resource [org/oh
dsi/webapi/FlywayConfig.class]: Invocation of init method failed; nested exception is org.flywaydb.core.internal.dbsupport.FlywaySqlException:
Unable to obtain Jdbc connection from DataSource
------------------------------------------------
SQL State : null
Error Code : 0
Message : Driver:org.postgresql.Driver@19fb89f6 returned null for URL:jdbc:postgresql://postgres:1234@postgresdb_postgres_1/ohdsi

2021-06-22 03:46:02.229 INFO main org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer - -

I have no idea what the reason is.

My docker-compose is follows now.

version: ‘2’

services:

broadsea-methods-library:
image: ohdsi/broadsea-methodslibrary
ports:
- “8787:8787”
- “6311:6311”
environment:
- PASSWORD=mypass

broadsea-webtools:
image: ohdsi/broadsea-webtools
ports:
- “8080:8080”
volumes:
- .:/tmp/drivers/:ro
- …/config-local.js:/usr/local/tomcat/webapps/atlas/js/config-local.js:ro
environment:
- WEBAPI_URL=http://localhost:8080
- env=webapi-postgresql
- security_origin=*
- datasource_driverClassName=org.postgresql.Driver
- datasource_url= jdbc:postgresql://postgres:1234@postgresdb_postgres_1/ohdsi
- datasource.cdm.schema=cdm5
- datasource.ohdsi.schema=ohdsi
- datasource_username=postgres
- datasource_password=1234
- spring.jpa.properties.hibernate.default_schema=ohdsi
- spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
- spring.batch.repository.tableprefix=ohdsi.BATCH_
- flyway_datasource_driverClassName=org.postgresql.Driver
- flyway_datasource_url=jdbc:postgresql://postgres:1234@postgresdb_postgres_1/ohdsi
- flyway_schemas=ohdsi
- flyway.placeholders.ohdsiSchema=ohdsi
- flyway_datasource_username=postgres
- flyway_datasource_password=1234
- flyway.locations=classpath:db/migration/postgresql
networks:
- ohdsi_network

networks:
ohdsi_network:
driver: bridge

t