java: not found during Bitbucket Server startup

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。

*Fisheye および Crucible は除く

As of BitbucketServer 5.x+, no logs are written to the BITBUCKET_INSTALL directory. The contents of catalina.out will be written to BITBUCKET_HOME/log/atlassian-bitbucket.log file.

問題

Bitbucket Server fails to start and the following appears in the catalina.out:

./catalina.sh: 1: eval: /usr/lib/jvm/java-8-oracle/jre/bin/java/bin/java: not found

原因

Cause #1 - Java is not installed

Java is not installed on the server hosting Bitbucket Server, or the JAVA_HOME environment variable is not set to a valid location.

Cause #2 - Incorrect JAVA_HOME location

Bitbucket Server was installed with automated installer which creates a file containing the expected value for the JAVA_HOME variable. This file is responsible for setting the JAVA_HOME variable for Bitbucket Server itself, and will use the file's JAVA_HOME variable if there is no environmental variable set.

The JAVA_HOME location changed overtime. The variable can be found in the following file depending on the current version:

  • 5.0.0 or newer: the JAVA_HOME variable is now JRE_HOME and is set in the <Bitbucket Server installation directory>/bin/set-jre-home.sh file
  • between 4.9.0 and 5.0.0: the JAVA_HOME variable is set in the <Bitbucket Server installation directory>/bin/set-java-home.sh file
  • between 3.8.0 and 4.9.0: the JAVA_HOME variable is set in the <Bitbucket Server installation directory>/bin/setenv.sh file
  • before 3.8.0: the JAVA_HOME variable is set in the <Bitbucket Server installation directory>/bin/setenv.sh file

Cause #3 - JAVA_HOME is correct for Bitbucket, but not for Opensearch

For 7.21.0 versions or newer:

Bitbucket Server was installed with automated installer and bundled JRE, but at some point a new external Java is installed.

If you only set JAVA_HOME on <Bitbucket Server installation directory>/bin/set-jre-home.sh file, it will reflect only on Bitbucket, not on Opensearch.

Cause #4 - systemd does not recognize the system's environment variable

Bitbucket is started using systemd as per Run Bitbucket as a Linux service and the system JAVA_HOME environment variable is not recognized.

ソリューション

Resolution #1 - Java is not installed

Make sure that Java is installed on the server hosting Bitbucket Server by following the instructions on the Install Bitbucket Data Center from an archive file page in the "Check your version of Java" paragraph, and that the JAVA_HOME environment variable is set to a valid location.

Resolution #2 - Incorrect JAVA_HOME location

Update the JAVA_HOME environmental variable or update the appropriate file depending on the installed version to reflect the new Java location. The JAVA_HOME contains bin/java. This part of the path is found automatically.

Resolution #3 - Update JAVA_HOME inside Opensearch script

After updating JAVA_HOME on Bitbucket, it's necessary to access <Bitbucket Server installation directory>/opensearch/bin/opensearch script and change JAVA_HOME to update Opensearch variables.

Cause #4 - Update .service file to include JAVA_HOME

Update the Bitbucket's systemd .service file to include the JAVA_HOME:

[Service]
...
Environment=JAVA_HOME=<java home path>


最終更新日 2017 年 5 月 2 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.