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:
 
<url>jdbc:postgresql://host.domain:port/dbname?ssl=true</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(AbstractJdbc2ResultSet.java:2683)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getString(AbstractJdbc2ResultSet.java:1860)
at org.apache.commons.dbcp2.DelegatingResultSet.getString(DelegatingResultSet.java:199)
at org.apache.commons.dbcp2.DelegatingResultSet.getString(DelegatingResultSet.java:199)
at com.atlassian.jira.database.DatabaseCollationReader.findCollation(DatabaseCollationReader.java:31)
at com.atlassian.jira.appconsistency.db.CollationCheck.isOk(CollationCheck.java:57)
at com.atlassian.jira.startup.JiraDatabaseConfigChecklist.doStartupChecks(JiraDatabaseConfigChecklist.java:74)
at com.atlassian.jira.startup.JiraDatabaseConfigChecklist.startupOK(JiraDatabaseConfigChecklist.java:64)
at com.atlassian.jira.startup.DatabaseChecklistLauncher.start(DatabaseChecklistLauncher.java:48)
at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDbLaunch$1(DefaultJiraLauncher.java:136)
at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:298)
at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseConfigured(DatabaseConfigurationManagerImpl.java:199)
at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:134)
at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$start$0(DefaultJiraLauncher.java:103)
at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:31)
at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:101)
at com.atlassian.jira.startup.LauncherContextListener.initSlowStuff(LauncherContextListener.java:149)
at java.lang.Thread.run(Unknown 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

This widget could not be displayed.

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.

Cheers,

Branden

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

264 views 1 3
Join discussion

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