500 error page when logging with a JIRA administrator user after restore a backup from Cloud in a Server instance
Problem
After restoring a backup from JIRA Cloud on a Server instance and logging into JIRA as a JIRA System Administrator, the user receive a 500 error page.
The problem only affects JIRA Administrators, others users can login without seeing any error messages.
The following appears in the localhost logs:
Sep 01, 2015 2:09:06 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [action] in context with path [] threw exception [java.lang.RuntimeException: org.apache.jasper.JasperException: An exception occurred processing JSP page /includes/decorators/aui-layout/head-resources.jsp at line 13
10: HeaderFooterRendering headerAndFooter = ComponentAccessor.getComponent(HeaderFooterRendering.class);
11:
12: headerAndFooter.requireCommonResources();
13: headerAndFooter.includeResources(out);
14: %>
15: <script type="text/javascript" src="<%=headerAndFooter.getKeyboardShortCutScript(request) %>"></script>
16: <%
Stacktrace:] with root cause
java.lang.NullPointerException
at com.atlassian.analytics.client.license.JiraLicenseProvider.getLicenseCreationDate(JiraLicenseProvider.java:32)
at com.atlassian.analytics.client.service.LicenseCreationDateService.isLicenseOlderThanPolicyUpdate(LicenseCreationDateService.java:20)
at com.atlassian.analytics.client.detect.PrivacyPolicyUpdateDetector.isPolicyUpdated(PrivacyPolicyUpdateDetector.java:39)
at com.atlassian.analytics.client.conditions.urlreading.UrlReadingPolicyUpdateMessage.addToUrl(UrlReadingPolicyUpdateMessage.java:39)
...
Cause
The root cause of this error is the lack of a valid license in the JIRA database. For some yet unknown reason, JIRA will not created the appropriate records for the license in JIRA, and when an Administrator try to login, JIRA is not able to retrieve and verify the license to create the top banner used to show warnings about the license expiration dates.
Diagnosis
To diagnose the problem, you can run the follow query against your JIRA database.
select * from propertyentry where property_key like '%License20%'
If the query above do not return any results, you can proceed with the workaround below to solve the problem.
Workaround
Note: Workaround applicable only for Jira 7.0.4 and earlier versions. From Jira 7.0.5 onwards license stored in the productlicense table.
Before attempting this work around. It is recommended to import the backup on the initial instance setup wizard screen and specify the license.
The easy way to solve this issue is update the licenses details directly in the database, following the steps below:
Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
- Stop JIRA
Run the statements below, replacing the
<license_key>
value for your JIRA license key from your MyAtlassian accountINSERT INTO propertyentry VALUES ((SELECT max(id)+1 FROM propertyentry),'jira.properties',1,'License20',6);
INSERT INTO propertytext VALUES ((SELECT id FROM propertyentry WHERE property_key LIKE '%License20%'),'<license_key>');
- Start JIRA