Jira fails to start if any newlines present in CATALINA_OPTS and/or JAVA_OPTS

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Problem

Jira fails to start if a newline is used in CATALINA_OPTS and/or JAVA_OPTS. It happens in Jira 8.9 which has been shipped with Tomcat 8.5.50.

Please see JRASERVER-70487 - Upgrade Tomcat to 8.5.50 to fix CVE-2019-17563 & CVE-2019-12418

A setting like below will cause Jira to fail to start:

1 2 3 4 5 JVM_SUPPORT_RECOMMENDED_ARGS=" -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/data/heapdumps/ ... ..."

Diagnosis

Environment

  • Jira 8.9 with Tomcat 8.5.50

Diagnostic Steps

Check the customizations in setenv.sh or setenv.bat file done by setting parameters in JVM_SUPPORT_RECOMMENDED_ARGS, JVM_GC_ARGS, or other variables.

Cause

Expansion of JAVA_OPTS in catalina.sh containing '*' stops startup on the Linux server. This problem is filed under https://bz.apache.org/bugzilla/show_bug.cgi?id=63815 and it's fixed in Tomcat 8.5.48. This bug does not allow newlines in CATALINA_OPTS and/or JAVA_OPTS.

Part of the fix is to stop the expansion by simply put the use of JAVA_OPTS in double-quotes. i.e. "$JAVA_OPTS". You can see the details in catalina.sh below:

1 2 3 4 5 6 7 8 9 # CATALINA_OPTS and/or JAVA_OPTS require quoting. See: exec "$_RUNJDB" "$LOGGING_CONFIG" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \ exec "$_RUNJDB" "$LOGGING_CONFIG" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS \ eval exec "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER "$JAVA_OPTS" "$CATALINA_OPTS" \ eval exec "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER "$JAVA_OPTS" "$CATALINA_OPTS" \ eval $_NOHUP "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER "$JAVA_OPTS" "$CATALINA_OPTS" \ eval $_NOHUP "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER "$JAVA_OPTS" "$CATALINA_OPTS" \ eval "\"$_RUNJAVA\"" $LOGGING_MANAGER "$JAVA_OPTS" \ eval "\"$_RUNJAVA\"" $LOGGING_MANAGER "$JAVA_OPTS" \

You can find more details in Tomcat 8.5 Change Log: https://tomcat.apache.org/tomcat-8.5-doc/changelog.html

Solution

Resolution

Remove newlines and set your customizations in one line:

1 JVM_SUPPORT_RECOMMENDED_ARGS="-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/data/heapdumps/......"

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.