How to prevent failure on Hikari Pool initialization if database connection fails

Viewed 6049

I have a project which uses Hikari Connection Pool. I create connection pool for all the databases one by one as new HikariDataSource(someConfig)

This works fine when all the databases are available. But if any of the database is offline the Play project gives the below error:

[RuntimeException: java.lang.ExceptionInInitializerError]

I do not want the application to crash if just a few of the databases are offline.

How can I avoid this error from crashing the application?

Note: I am using HikariCP package on its own in another subproject. I am not using play-hikari plugin.

1 Answers
Related