Importing from CSV results in 404 Error
Symptoms
While importing data from CSV using either External System Import (for admin) or Bulk Create (for non-admin), a 404 error page appears after specifying the CSV file and moving on to project mapping. The following messages can be found in atlassian-jira.log:
2016-04-20 11:28:28,694 http-nio-13032-exec-3 INFO <user-admin> 688x77142x3 vh2i41 158.166.145.77,158.167.134.6,10.226.15.83 /secure/admin/CsvSetupPage.jspa [jira.web.action.XsrfErrorAction] The security token is missing for '<user-admin>'. User-Agent : 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0'
and catalina.<date>.log:
Apr 20, 2016 10:51:52 AM org.apache.catalina.connector.Response sendRedirect
WARNING: Failed to redirect to [https://<base_url>/secure/admin/CsvProjectMappingsPage!default.jspa?externalSystem=com.atlassian.jira.plugins.jira-importers-plugin:csvImporter&alt_token=AM6Z-FOEK-VHM0-47I5|e369c6c814fbb743ce8ef914084ecde46d55b99a|lin]
java.lang.IllegalArgumentException: Illegal character in query at index 195: https://<base_url>/secure/admin/CsvProjectMappingsPage!default.jspa?externalSystem=com.atlassian.jira.plugins.jira-importers-plugin:csvImporter&alt_token=AM6Z-FOEK-VHM0-47I5|e369c6c814fbb743ce8ef914084ecde46d55b99a|lin
at java.net.URI.create(URI.java:852)
at org.apache.catalina.connector.Response.sendRedirect(Response.java:1384)
...
Caused by: java.net.URISyntaxException: Illegal character in query at index 195: https://<base_url>/secure/admin/CsvProjectMappingsPage!default.jspa?externalSystem=com.atlassian.jira.plugins.jira-importers-plugin:csvImporter&alt_token=AM6Z-FOEK-VHM0-47I5|e369c6c814fbb743ce8ef914084ecde46d55b99a|lin
Diagnosis
All JIRA versions using any of the following Tomcat versions are affected: 7.0.67, 7.0.68, 8.0.30, 8.0.31, 8.0.32.
- This usually happens in JIRA WAR editions where Tomcat can be upgraded separately (JIRA WAR is only available in JIRA 6.x and below)
- Early 7.x standalone versions are not affected as they do not use any of the above Tomcat versions (JIRA 7.x is bundled with Tomcat 8.x)
- JIRA 7.1.7 is the only affected version in 7.x series as it's bundled with Tomcat 8.0.32.
Cause
This is caused by a bug in Tomcat, which does not redirect a request correctly if the request URI contains blank spaces:
Resolution
For JIRA WAR, upgrade Tomcat to any of the following versions:
- 7.0.69 onwards for 7.0.x
- 8.0.33 onwards for 8.0.x
- 9.0.0.M4 onwards for 9.0.x
note that Tomcat 9.0.x is not supported by JIRA yet
For users using JIRA 7.1.7 standalone, the following bug ticket has been raised to address this: