-
Bug
-
Resolution: Duplicate
-
Highest
-
7.1.0, 7.2.0, 7.3.0, 7.4.0
-
43
-
Severity 3 - Minor
-
1,022
-
Issue Summary
After a recent update to Elasticsearch 7 in Bitbucket 7.1.0, the default elasticsearch-env file within the directory $BITBUCKET_INSTALL/elasticsearch/bin has changed, making it so that the bundled Elasticsearch instance will not start up unless the environment variable JAVA_HOME has been set. This is because Elasticsearch's new backup Java location, if JAVA_HOME is not detected, is a bundled JDK that isn't actually present at $ES_HOME/jdk/bin/java.
Steps to Reproduce
- Install or upgrade to Bitbucket 7.1+
- Ensure that the JAVA_HOME environment variable has not been set
- Attempt to start up Bitbucket and Elasticsearch by manually executing the file $BITBUCKET_INSTALL/bin/start-bitbucket.sh
Expected Results
Both Bitbucket and Elasticsearch use the bundled JRE located at $BITBUCKET_INSTALL/jre
Actual Results
The startup script successfully launches Bitbucket, but on attempting to launch Elasticsearch the following error is thrown in the console:
could not find java in bundled jdk at /opt/app/bitbucket-7.4.0/elasticsearch/jdk/bin/java There was a problem starting bundled Elasticsearch
In previous versions of Elasticsearch, on not detecting JAVA_HOME it instead used the command which java to find an alternative Java location. However, in the later versions of this elasticsearch-env file the logic there uses a static location based on the $ES_HOME:
# now set the path to java if [ ! -z "$JAVA_HOME" ]; then JAVA="$JAVA_HOME/bin/java" JAVA_TYPE="JAVA_HOME" else if [ "$(uname -s)" = "Darwin" ]; then # macOS has a different structure JAVA="$ES_HOME/jdk.app/Contents/Home/bin/java" else JAVA="$ES_HOME/jdk/bin/java" fi JAVA_TYPE="bundled jdk" fi
Workaround
Set the environment variable JAVA_HOME to point to either the standard Bitbucket bundled JRE, or the Java home of a supported Java version.
Alternatively, it's also possible to modify the logic in the file $BITBUCKET_INSTALL/elasticsearch/bin/elasticsearch-env to use a different/correct Java location. However, it's important to note that any changes to this file will be overwritten on performing an upgrade of Bitbucket and these changes will then need to be reapplied.
- duplicates
-
BSERV-12267 Elasticsearch service fails to start
- Closed
- is caused by
-
BBSDEV-22298 Loading...
- mentioned in
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...