PostgreSQL SSL Configuration Causes Collation Exception on Startup

When configuing the JDBC connection for PostgreSQL in order to allow SSL communications, you have to edit the dbconfig.xml file in the JIRA_HOME directory.  The result is the following for the url:
Upon server startup the following exception is reported in the logs:
JIRA-Bootstrap WARN [c.a.j.appconsistency.db.CollationCheck]
The database collation could not be read. An unsupported collation could cause some functionality to not work
JIRA-Bootstrap INFO [c.a.j.appconsistency.db.CollationCheck] Exception when reading database collation
org.postgresql.util.PSQLException: ResultSet not positioned properly, perhaps you need to call next.
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.checkResultSet(
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getString(
at org.apache.commons.dbcp2.DelegatingResultSet.getString(
at org.apache.commons.dbcp2.DelegatingResultSet.getString(
at com.atlassian.jira.database.DatabaseCollationReader.findCollation(
at com.atlassian.jira.appconsistency.db.CollationCheck.isOk(
at com.atlassian.jira.startup.JiraDatabaseConfigChecklist.doStartupChecks(
at com.atlassian.jira.startup.JiraDatabaseConfigChecklist.startupOK(
at com.atlassian.jira.startup.DatabaseChecklistLauncher.start(
at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDbLaunch$1(
at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(
at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseConfigured(
at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(
at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$start$0(
at com.atlassian.jira.startup.DefaultJiraLauncher.start(
at com.atlassian.jira.startup.LauncherContextListener.initSlowStuff(
at Source)
After some investigation, it is found that the parseUrl function in the com.atlassian.jira.config.database.jdbcurlparser.PostgresUrlParser class incorrectly parses out the database name by not accounting for any following variables.  If there are no "//" after the driver portion it takes the rest of the string as the name, and if there are "//",  it strips them, splits the remainder on a "/" and takes the second part as the database name.  This sets the database name to "dbname?ssl=true" in the DatabaseInstance.  It then takes the database name from this class and uses it in the generateCollationQuery in the com.atlassian.jira.database.DatabaseCollationReader and setting it as a argument in the PreparedStatment causing it to look for a database with the name of "dbname?ssl=true".
The database check collation that is run after startup (within the support tools menu) works correctly.

1 answer

0 votes

Hi Thomas,

Thank you for reporting this.  There is an existing Bug that you can find at JRASERVER-46026.  Please vote on the issue to add impact and you'll be notified when this is fixed.



Suggest an answer

Log in or Sign up to answer
Community showcase
Asked Thursday in Jira Ops

I'm John Allspaw, Ask Me Anything about incident analysis and postmortems

I'm John Allspaw, co-founder of   Adaptive Capacity Labs, where we help teams use their incidents to learn and improve. We bring research-driven methods and approaches to drive effective inciden...

4,042 views 8 7
View question

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you