簡體   English   中英

Hibernate C3P0ConnectionProvider 未拾取

[英]Hibernate C3P0ConnectionProvider not picked up

我正在嘗試為我的 hibernate 應用程序配置 C3P0 連接池。

我正在使用以下依賴項。

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>5.5.6.Final</version>
</dependency>
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-c3p0</artifactId>
    <version>5.5.6.Final</version>
</dependency>

我在我的hibernate.cft.xml中添加了以下配置

<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.max_size">20</property>
<property name="hibernate.c3p0.acquire_increment">5</property>
<property name="hibernate.c3p0.timeout">1800</property>

但我收到以下警告:

WARN: HHH000022: c3p0 properties were encountered, but the c3p0 provider class was not found on the classpath; these properties are going to be ignored

如果我像下面給出的那樣明確指定提供者 class ,它就可以工作。

<property name="hibernate.connection.provider_class">org.hibernate.c3p0.internal.C3P0ConnectionProvider</property>

但是上面 class 的文檔說應該默認選擇它。

使用 C3P0 連接池的連接提供程序。 如果設置了 hibernate.c3p0.* 屬性,Hibernate 將默認使用它。

為什么這不是 class 默認拾取的? 明確指定org.hibernate.c3p0.internal.C3P0ConnectionProvider是否正確? It looks like org.hibernate.connection.C3P0ConnectionProvider is the class which is picked up by default, and most of the references found in the web are regarding it, but it is not available in the above mentioned maven dependencies.

移除hibernate. 從屬性名稱來看,應該是:

<property name="connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM