Upgrading JIRA with the installer throws NullPointerException

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Attempting to upgrade JIRA using the installer causes NullPointerException, the follow screen is shown instead of the login screen:

Also, the following appears in the atlassian-jira.log:

2013-03-04 16:45:07,255 localhost-startStop-1 WARN      [core.entity.transaction.JNDIFactory] [ConnectionFactory.getConnection] Failed to find DataSource named java:comp/env/jdbc/JiraDS in JNDI server with name default. Trying normal database.
javax.naming.NameNotFoundException: Name [jdbc/JiraDS] is not bound in this Context. Unable to find [jdbc].
... 
2013-03-04 16:45:07,259 localhost-startStop-1 ERROR      [ofbiz.core.entity.ConnectionFactory] ******* ERROR: No database connection found for helperName "defaultDS"
2013-03-04 16:45:07,260 localhost-startStop-1 ERROR      [atlassian.jira.startup.LauncherContextListener] Unable to start JIRA.
com.atlassian.jira.exception.DataAccessException: Unable to get a database connection for the OfBiz default data source.
...
2013-03-04 16:45:27,389 http-bio-8090-exec-2 ERROR      [500ErrorPage.jsp] Exception caught in 500 page java.lang.NullPointerException
com.atlassian.util.concurrent.LazyReference$InitializationException: java.lang.NullPointerException

Diagnosis

The dbconfig.xml file, which is located into JIRA Home Directory, contains a JNDI location:

<jira-database-config>
  <name>defaultDS</name>
  <delegator-name>default</delegator-name>
  <database-type>mysql</database-type>
  <jndi-datasource>
    <jndi-name>java:comp/env/jdbc/JiraDS</jndi-name>
  </jndi-datasource>
</jira-database-config>

Cause

The database resource was located within the server.xml file, which is not copied over during the upgrade.  

Workaround

There are two possible workarounds to this issue:

Reconfigure the dbconfig.xml file and stop using JNDI Location:

  1. Shutdown JIRA
  2. Navigate to JIRA Home Directory
  3. Delete or move the current dbconfig.xml file to another folder
  4. Navigate to $JIRA_install_dir/bin and execute JIRA configuration tool
  5. Configure your database connection again
  6. Restart JIRA

Or re-add the JNDI Location:

  1. Shutdown JIRA
  2. Check the server.xml file, which is located in $JIRA_install_dir/conf, from a backup prior to the upgrade attempt

  3. Copy the JNDI Location that includes the database connection parameters, as in this example:

    <Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" maxActive="20" name="jdbc/JiraDS" password="jira" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/jira0?useUnicode=true&amp;characterEncoding=UTF8" username="jira" validationQuery="select 1"/>
    

    Do not copy the server.xml file into your new installation. Copy just the JNDI resource definition.

  4. Paste the JNDI Location in the same location (inside the <Context/> node) in the server.xml file after the upgrade

  5. Restart JIRA

Last modified on Mar 30, 2016

Was this helpful?

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