Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-7847

Bitbucket will display error message when JAVA_HOME with wrong Java version is set

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • High
    • 4.3.0
    • 3.8.0, 4.0.0, 4.0.1, 4.0.2, 4.0.3
    • None

    Description

      This is a particular pain point for our customers upgrading from Stash to Bitbucket Server with an environment which is running Java 7

      Summary

      When Bitbucket Server fails to start because the running JVM set in the env variable JAVA_HOME is not supported or is incorrect, the messaging is logged to <CATALINA_HOME>/catalina.out and the console output says it started successfully.

      Steps to Reproduce

      1. Setup a server with JAVA_HOME ( in /etc/environment or similar location) pointing to Java 7 or incorrectly set to the bin directory (i.e. /usr/lib/jvm/oracle_jdk8/bin/java)
      2. Install Stash 3.x
      3. Upgrade to Bitbucket Server
      4. Start Bitbucket using $ sudo service atlbitbucket start

      Expected Results

      • The console output informs the user that the configured JVM is not supported and they must upgrade in order to run Bitbucket Server
        OR
      • The application starts using its embedded JRE as opposed to an invalid or unsupported JAVA_HOME

      Actual Results

      Bitbucket Server tells the user the application started successfully. The messaging about the incompatible JRE is logged to catalina.out which is easy to miss for our customers producing support load.

      Output when you start Bitbucket as a service
      $ sudo service atlbitbucket start
      To run Bitbucket in the foreground, start the server with start-bitbucket.sh -fg
      Starting Atlassian Bitbucket as dedicated user atlbitbucket
      
      
      ----------------------------------------------------------------------------------
      Bitbucket is being run with a umask that contains potentially unsafe settings.
      The following issues were found with the mask "u=rwx,g=rwx,o=rx" (0002):
       - access is allowed to 'others'. It is recommended that 'others' be denied
         all access for security reasons.
       - write access is allowed to 'group'. It is recommend that 'group' be
         denied write access. Read access to a restricted group is recommended
         to allow access to the logs.
      
      The recommended umask for Bitbucket is "u=,g=w,o=rwx" (0027) and can be
      configured in setenv.sh
      ----------------------------------------------------------------------------------
      Using BITBUCKET_HOME:      /var/atlassian/application-data/stash
      Using CATALINA_BASE:   /opt/atlassian/bitbucket/4.0.0
      Using CATALINA_HOME:   /opt/atlassian/bitbucket/4.0.0
      Using CATALINA_TMPDIR: /opt/atlassian/bitbucket/4.0.0/temp
      Using JRE_HOME:        /usr/lib/jvm/jre
      Using CLASSPATH:       /opt/atlassian/bitbucket/4.0.0/bin/bitbucket-bootstrap.jar:/opt/atlassian/bitbucket/4.0.0/bin/bootstrap.jar:/opt/atlassian/bitbucket/4.0.0/bin/tomcat-juli.jar
      Using CATALINA_PID:    /opt/atlassian/bitbucket/4.0.0/work/catalina.pid
      Tomcat started.
      
      Success! You can now use Bitbucket at the following address:
      
      http://localhost:7990/
      
      If you cannot access Bitbucket at the above location within 3 minutes, or encounter any other issues starting or stopping Atlassian Bitbucket, please see the troubleshooting guide at:
      
      https://confluence.atlassian.com/display/BitbucketServerKB/Troubleshooting+Installation
      

      Error in case of incompatibility with Java 1.7:

      <Bitbucket_Install>/logs/catalina.out
       
      Atlassian Bitbucket does not support Java 1.7.0_85. Please start the product with Java 8 or greater.
      

      Error in case of Java incorrectly set:

      <Bitbucket_Install>/logs/catalina.out
       
      ./catalina.sh: 1: eval: /usr/lib/jvm/oracle_jdk8/bin/java: not found
      ./catalina.sh: 1: eval: /usr/lib/jvm/oracle_jdk8/bin/java: not found
      ./atlassian/bitbucket/bin/catalina.sh: 1: eval: /usr/lib/jvm/oracle_jdk8/bin/java: not found
      

      Possible Workaround

      Removing a globally set JAVA_HOME would resolve the issue as well as the application will fallback to the bundled JRE, however this may not be an option for some of our customers as they might have other applications using their current JAVA_HOME value.

      Solution

      Install Java 8 and set it as your JAVA_HOME. More details on how to set up your JAVA_HOME can be found on step #2 of the following document:

      Attachments

        Issue Links

          Activity

            People

              jthomas@atlassian.com Justin Thomas
              khughes@atlassian.com Kristy
              Votes:
              2 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: