Using jtds and NTLM authentication to connect to a database with JIRA 4.4+
Platform Notice: Data Center Only - This article only applies to Atlassian apps on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Symptoms
During startup JIRA throws a BlankStringArgumentException.
The database connection doesn't work.
The following appears in the atlassian-jira.log:
2011-08-05 17:33:36 Commons Daemon procrun stdout initialized2011-08-05 17:33:40,314 main INFO [jira.config.database.SystemTenantDatabaseConfigurationLoader] Reading database configuration from E:\Program Files (x86)\Atlassian\Application Data\JIRA\dbconfig.xml
2011-08-05 17:33:40,673 main ERROR [atlassian.jira.startup.LauncherContextListener] Unable to start JIRA.
com.atlassian.jira.util.dbc.Assertions$NullArgumentException: username should not be null!
at com.atlassian.jira.util.dbc.Assertions.notNull(Assertions.java:26)
Diagnosis
This will only occur in the following environment:
JIRA 4.4+
jtds
NTLM authentication
Cause
In JIRA 4.4 and above we changed how the database configuration is stored to make it easier for 99% of our users to configure a database. In addition this has made it easier for the installer to perform automatic upgrades.
⚠️ Unfortunately for people that rely on the fairly rare configuration outlined in this KB, the setup of the database configuration has to be a bit more complicated.
Solution
Resolution
Since JIRA 4.4+ uses the dbconfig.xml file for database deployment and connection, we would have to use the JNDI option to cater for this environment.
In your
dbconfig.xml, use the following only:<?xml version="1.0" encoding="UTF-8"?> <jira-database-config> <name>defaultDS</name> <delegator-name>default</delegator-name> <database-type>mssql</database-type> <schema-name>YOUR_SCHEMA</schema-name> <jndi-datasource> <jndi-name>java:comp/env/jdbc/JiraDS</jndi-name> </jndi-datasource> </jira-database-config>Insert this code into your
server.xml(which should be similar to your previous 4.0 configuration):<Resource name="jdbc/JiraDS" auth="Container" type="javax.sql.DataSource" driverClassName="net.sourceforge.jtds.jdbc.Driver" url="jdbc:jtds:sqlserver://YOUR_DB_URL/DB_NAME;domain=YOURDOMAIN;instance=INSTANCE;" maxActive="20" minIdle="4" maxIdle="8" validationQuery="Select 1" />
ℹ️ This configuration is not recommended as future upgrades would be quite tedious since they would require for the datasources to be created in server.xml every time.
Was this helpful?