legacy-knowledge-base
公開されました Sep. 10, 2025

java.sql.SQLException:接続が閉じられましたエラーがログファイルに書き込まれ続けています。

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

learn-legacy-article-disclaimer-text

問題

エラー「java.sql.SQLException:Connection is closed "というエラーがログファイルに書き込まれ続けています。

Caused by: java.sql.SQLException: Connection is closed
at com.zaxxer.hikari.pool.ProxyConnection$ClosedConnection$1.invoke(ProxyConnection.java:468)
at com.sun.proxy.$Proxy7.prepareStatement(Unknown Source)
at com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:309)
at com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java)
at sun.reflect.GeneratedMethodAccessor123.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.invoke(LazyConnectionDataSourceProxy.java:370)
at com.sun.proxy.$Proxy8.prepareStatement(Unknown Source)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)

Environment

  • Liferay Portal 6.0-6.2
  • Liferay DXP 7.0-7.4

解決策

java.sql.SQLException:Connection is closed エラーは、Liferay サーバーがデータベースに接続できないときにダンプされます。

データベース接続プールで使用されるJDBCクラスは、データベースがしばらく利用できない場合にこのエラーを投げます。 通常、データベースが再び利用できるようになると消えてしまいます。

それでもログに接続エラーが表示される場合:

  1. データベースが正しく動作しているか、Liferayからデータベースサーバーへの接続に問題がないかをダブルチェックします。
  2. データベースが正常に動作している場合、Liferayサーバーを再起動することで、不健康な状態に陥っているデータベース接続の問題を解決できるはずです。

原則として、データベースが使用できなくなるような操作を行う場合は、事前にLiferayサーバーを停止しておく必要があります。 Liferayは、利用可能なデータベースがない状態で動作するように準備されていません。

did-this-article-resolve-your-issue

legacy-knowledge-base