Using NTLM authentication with Jira 4.4

This one took me a while to find so I am going to repost it here. Unfortunately with the newer version of Jira you can not leave the username/password blank on the db configuration screen.

http://confluence.atlassian.com/pages/viewpage.action?pageId=262471708

 

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.

Unfortunately for people that rely on the fairly rare configuration outlined in this KB, the configuration 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.

 

This entry was posted in Tips, Tricks, and Troubleshooting. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>