Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-77097

check-java.sh is not recognizing openjdk 11.0.18-ea

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Low Low
    • None
    • 8.13.15, 8.22.6
    • Environment - Java
    • None

      Issue Summary

      Jira 8.x and 9.x supports JAVA v11 however, check-java.sh is not apple to recognize Openjdk 11.0.18-ea and this causes Jira to get terminated.

      This is reproducible on Data Center: (yes)

      Steps to Reproduce

      1. Start a container using the CentOS image: quay.io/centos/centos:stream8
      docker run --rm -it quay.io/centos/centos:stream8 bash 
      1. Install Java from CentOS AppStream repository
      dnf install -y java-11-openjdk-headless 
      [root@02db19e54355 bin]# java --version openjdk 11.0.18-ea 2023-01-17 LTS OpenJDK Runtime Environment (Red_Hat-11.0.18.0.9-0.3.ea.el8) (build 11.0.18-ea+9-LTS) OpenJDK 64-Bit Server VM (Red_Hat-11.0.18.0.9-0.3.ea.el8) (build 11.0.18-ea+9-LTS, mixed mode, sharing) 
      1. Set JAVA_HOME
      JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.18.0.9-0.3.ea.el8.aarch64 export $JAVA_HOME 
      1. Copy or Curl the Jira tar zip file inside the Container and install Jira by following the Installing Jira applications on Linux from Archive File inside the container
      docker cp atlassian-jira-software-8.22.6.tar.gz <container-name>:/home 

      or

      curl -o atlassian-jira-software-8.22.6.tar.gz https://product-downloads.atlassian.com/software/jira/downloads/atlassian-jira-software-8.22.6.tar.gz
      1. Start Jira by running ./start-jira.sh

      Expected Results

      Jira should get installed.

      Actual Results

      Jira fails to install with Error message

      The below exception is thrown in the catalina.out file:

      [0.001s][warning][gc] -Xloggc is deprecated. Will use -Xlog:gc:/opt/atlassian/jira/atlassian-jira-software-8.22.6-standalone/logs/atlassian-jira-gc-%t.log instead.
      Unrecognized VM option 'UseGCLogFileRotation'
      Error: Could not create the Java Virtual Machine.
      Error: A fatal exception has occurred. Program will exit.
      

      Workaround

      A solution would be to make changes to check-java.sh file by replacing below code

      if [[ $java_raw_version = *-ea* ]]
      then
      	# early access format e.g 11-ea
          IFS='-' read -a values <<< "$java_raw_version"
          java_version=${values[0]}
      else
      	if [[ $java_raw_version = 1.* ]]
      	then
      		# old format e.g. 1.8.0_161
      	    IFS='.' read -a values <<< "$java_raw_version"
      		java_version=${values[1]}
      	else
      		# new format e.g. 10.0.1
      		IFS='.' read -a values <<< "$java_raw_version"
      		java_version=${values[0]}
      	fi
      fi
      

      with

      if [[ $java_raw_version = *-ea* ]]
      then
      # early access format e.g 11-ea or 11.0.8-ea
      IFS='-' read -ra java_raw_version <<< "$java_raw_version"
      fi
      if [[ $java_raw_version = 1.* ]]
      then
      # old format e.g. 1.8.0_161
      IFS='.' read -ra values <<< "$java_raw_version"
      java_version=${values[1]}
      else
      # new format e.g. 11 or 11.0.18
      IFS='.' read -ra values <<< "$java_raw_version"
      java_version=${values[0]}
      fi
      

      This should fix the issue.

              Unassigned Unassigned
              072fabfd41a3 Shreekesh Mohan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: