Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

ScriptRunner Encrypted Database Connection


I am trying to create a DB Resource that connects to an external Postgres DB.  The DB connection needs to be encrypted.  Here is my connection string:


I get the following error:

com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Could not open SSL root certificate file server-ca.pem.
at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(
at com.zaxxer.hikari.pool.HikariPool.<init>(
at com.zaxxer.hikari.HikariDataSource.<init>(
at com.onresolve.scriptrunner.db.configurations.ExternalDbConfig$_createDataSource_closure1.doCall(ExternalDbConfig.groovy:45)
at com.onresolve.scriptrunner.db.configurations.ExternalDbConfig$_createDataSource_closure1.doCall(ExternalDbConfig.groovy)
at com.atlassian.plugin.util.ContextClassLoaderSwitchingUtil.runInContext(
at com.atlassian.plugin.util.ContextClassLoaderSwitchingUtil.runInContext(
at com.atlassian.plugin.util.ContextClassLoaderSwitchingUtil$ Source)
at com.onresolve.scriptrunner.db.configurations.ExternalDbConfig.createDataSource(ExternalDbConfig.groovy:24)
at com.onresolve.scriptrunner.db.configurations.ExternalDbConfig$createDataSource$ Source)
at com.onresolve.scriptrunner.db.AbstractDbConnectionManager.createDataSource(AbstractDbConnectionManager.groovy:43)
at com.onresolve.scriptrunner.db.DbConnectionManager$createDataSource$ Source)
at com.onresolve.scriptrunner.canned.db.ExternalDatabaseConnection.createOrUseExistingDataSource(ExternalDatabaseConnection.groovy:134)
at com.onresolve.scriptrunner.canned.db.ExternalDatabaseConnection$createOrUseExistingDataSource.callCurrent(Unknown Source)
at com.onresolve.scriptrunner.canned.db.ExternalDatabaseConnection.validate(ExternalDatabaseConnection.groovy:167)
at com.onresolve.scriptrunner.canned.db.ExternalDatabaseConnection.validate(ExternalDatabaseConnection.groovy)
Caused by: org.postgresql.util.PSQLException: Could not open SSL root certificate file server-ca.pem.
at org.postgresql.ssl.LibPQFactory.<init>(
at org.postgresql.core.SocketFactoryFactory.getSslSocketFactory(
at org.postgresql.ssl.MakeSSL.convert(
at org.postgresql.core.v3.ConnectionFactoryImpl.enableSSL(
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(
at org.postgresql.core.ConnectionFactory.openConnection(
at org.postgresql.jdbc.PgConnection.<init>(
at org.postgresql.Driver.makeConnection(
at org.postgresql.Driver.connect(
at com.zaxxer.hikari.util.DriverDataSource.getConnection(
at com.zaxxer.hikari.util.DriverDataSource.getConnection(
at com.zaxxer.hikari.pool.PoolBase.newConnection(
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(
... 15 more
Caused by: server-ca.pem (No such file or directory)
at org.postgresql.ssl.LibPQFactory.<init>(
... 30 more

I have tried putting the .pem files in the JIRA_HOME and script root directory to no avail.  Where should the files be located to ensure my DB connection is encrypted?

1 answer

1 accepted

0 votes
Answer accepted
Artur Moura Atlassian Team Dec 23, 2021

Hi @Irtiza Rizvi

I believe you should import the SSL certificate chain into Java truststore, then configure the JDBC to force the use of SSL.

Unable to connect to database with SSL enabled during Jira setup - you may refer to this document, which is very similar to what you are looking for.

Hope it helps.

We imported the certificates to the JVM (following this guide: and used `sslmode=require` in the DB connection string and it works!  Thank you!

Side note, if you are using sslmode=verify-ca or verify-full, ScriptRunner looks for a root.crt file in the /home/jira/.postgresql directory.  See for more info.

Like Artur Moura likes this
Artur Moura Atlassian Team Dec 30, 2021

Awesome @Irtiza Rizvi !

Glad to hear the issue is solved! Thanks for sharing the resolution steps.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Software

👋 Looking for 15-20 volunteers to test Atlassian training content

Hi everyone! Are you interested in beta testing Atlassian University’s newest (unreleased!) training course? We’re looking for 15-20 volunteers to test our newest training course, Basic reporting...

518 views 19 25
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you