Using jtds and NTLM authentication to connect to a database with JIRA 4.4+

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

  1. During startup JIRA throws a BlankStringArgumentException.
  2. 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.

(warning) 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.

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.

  1. 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>
  2. 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" />

(info) 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.

Last modified on Mar 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.