Legacy Knowledge Base
公開されました Jun. 30, 2025

ElasticsearchException java.net.ConnectException:アップグレード処理中に接続が拒否され、失敗しました

Written By

Jorge Diaz

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

問題

アップグレード処理中に以下のElasticsearchExceptionがスローされ、アップグレードが失敗します。

このエラーを回避するにはどうしたらいいのでしょうか?

2023-02-07 11:21:22.931 ERROR [main][ElasticsearchSearchEngine:56] bundle com.liferay.portal.search.elasticsearch7.impl:6.0.63 (687)[com.liferay.portal.search.elasticsearch7.internal.ElasticsearchSearchEngine(3560)] : The activate method has thrown an exception
java.lang.RuntimeException: org.elasticsearch.ElasticsearchException: ElasticsearchException[java.util.concurrent.ExecutionException: java.net.ConnectException: Connection refused]; nested: ExecutionException[java.net.ConnectException: Connection refused]; nested: ConnectException[Connection refused];
     at org.elasticsearch.client.RestHighLevelClient.performClientRequest(RestHighLevelClient.java:2695) ~[?:?]
     at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:2171) ~[?:?]
     at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:2137) ~[?:?]
     at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:2105) ~[?:?]
     at org.elasticsearch.client.ClusterClient.health(ClusterClient.java:151) ~[?:?]
     at com.liferay.portal.search.elasticsearch7.internal.search.engine.adapter.cluster.HealthClusterRequestExecutorImpl._getClusterHealthResponse(HealthClusterRequestExecutorImpl.java:98) ~[?:?]
     at com.liferay.portal.search.elasticsearch7.internal.search.engine.adapter.cluster.HealthClusterRequestExecutorImpl.execute(HealthClusterRequestExecutorImpl.java:49) ~[?:?]
     at com.liferay.portal.search.elasticsearch7.internal.search.engine.adapter.cluster.ElasticsearchClusterRequestExecutor.executeClusterRequest(ElasticsearchClusterRequestExecutor.java:53) ~[?:?]
     at com.liferay.portal.search.engine.adapter.cluster.HealthClusterRequest.accept(HealthClusterRequest.java:40) ~[?:?]
     at com.liferay.portal.search.engine.adapter.cluster.HealthClusterRequest.accept(HealthClusterRequest.java:22) ~[?:?]
     at com.liferay.portal.search.elasticsearch7.internal.search.engine.adapter.cluster.ElasticsearchClusterRequestExecutor.execute(ElasticsearchClusterRequestExecutor.java:46) ~[?:?]
     at com.liferay.portal.search.elasticsearch7.internal.search.engine.adapter.ElasticsearchSearchEngineAdapterImpl.execute(ElasticsearchSearchEngineAdapterImpl.java:69) ~[?:?]
     at com.liferay.portal.search.elasticsearch7.internal.ElasticsearchSearchEngine._waitForYellowStatus(ElasticsearchSearchEngine.java:396) ~[?:?]
     at com.liferay.portal.search.elasticsearch7.internal.ElasticsearchSearchEngine.initialize(ElasticsearchSearchEngine.java:134) ~[?:?]
     at com.liferay.portal.search.elasticsearch7.internal.ElasticsearchSearchEngine.activate(ElasticsearchSearchEngine.java:234) ~[?:?]
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_171]
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_171]
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_171]
     at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_171]
[...omitted...]
     at com.liferay.portal.bootstrap.ModuleFrameworkImpl._registerService(ModuleFrameworkImpl.java:1271) ~[com.liferay.portal.bootstrap.jar:?]
     at com.liferay.portal.bootstrap.ModuleFrameworkImpl.lambda$_registerApplicationContext$4(ModuleFrameworkImpl.java:1223) ~[com.liferay.portal.bootstrap.jar:?]
     at java.util.Iterator.forEachRemaining(Iterator.java:116) [?:1.8.0_171]
     at com.liferay.portal.bootstrap.ModuleFrameworkImpl._registerApplicationContext(ModuleFrameworkImpl.java:1210) [com.liferay.portal.bootstrap.jar:?]
     at com.liferay.portal.bootstrap.ModuleFrameworkImpl.registerContext(ModuleFrameworkImpl.java:256) [com.liferay.portal.bootstrap.jar:?]
     at com.liferay.portal.module.framework.ModuleFrameworkUtil.registerContext(ModuleFrameworkUtil.java:41) [portal-impl.jar:?]
     at com.liferay.portal.util.InitUtil.registerContext(InitUtil.java:301) [portal-impl.jar:?]
     at com.liferay.portal.tools.DBUpgrader.main(DBUpgrader.java:138) [portal-impl.jar:?]
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_171]
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_171]
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_171]
     at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_171]
     at com.liferay.portal.tools.db.upgrade.client.DBUpgraderLauncher.main(DBUpgraderLauncher.java:54) [com.liferay.portal.tools.db.upgrade.client.jar:?]

Environment

  • Liferay DXPのいずれかのバージョン

解決策

アップグレード処理中は、Liferayのインデックス機能が読み取り専用に切り替わるため、Elasticsearchでのインデックス操作はなく、アップグレード処理終了後に完全な再インデックス処理が必要となります。

それにもかかわらず、Elasticsearchサーバーが利用できない場合、Elasticsearchクライアントモジュールは正しく初期化できず、報告された例外を引き起こします。

この問題を回避するために、あなたは

  1. アップグレードを実行する前に、LiferayのElasticsearchクライアント構成をリモートモードからエンベデッドモードに変更してください。
  2. この記事 のように、設定ファイルを使用して行うことができます。
  3. アップグレード処理を実行する
  4. アップグレードが終了したら、ステップ1の設定変更をElasticsearch組み込みからリモートに戻す
  5. フルリインデックスを実行する

追加情報

Did this article resolve your issue ?

Legacy Knowledge Base