Initial sessionfactory creation failed.org.hibernate.service.spi.ServiceException:
Unable to Create requested service [Org.hibernate.engine.jdbc.connections.spi.ConnectionProvider]
The configuration in the configuration file is such that,<!--c3p0 connection Pool Settings--<!--use the C3P0 connection pool to configure the vendor that the connection pool provides--<property name= "Connection.provider_class" >org.hibernate.connection.c3p0connectionprovider</property ><!--the minimum number of database connections available in the connection pool--<property name= "C3p0.min_size" >5</property><!--The maximum number of all database connections in the connection pool--<property name= "C3p0.max_size" >20</property><!--set the expiration time of the database connection, in seconds,If a database connection in the connection pool is idle for more than the timeout time, it is purged from the connection pool and<property name= "C3p0.timeout" >120</property><!--check for idle connections in all connection pools in seconds every 3,000 seconds--<property name= "C3p0.idle_test_period" >3000</property>
Comment out this line and the error is gone.<property name= "Connection.provider_class" >org.hibernate.connection.c3p0connectionprovider</ Property>
View Hibernate4.3.8 's Manual, as stated:
not Intended for use with a production system , or even for performance testing. You should use a third party pool for best performance and stability. just Replace the hibernate.connection.pool_ Size property with connection Pool specific settings. This would turn off Hibernate ' s internal pool. For example, you might like to use C3P0.
C3P0 is a open source JDBC connection pool distributed along with Hibernate in The lib
directory. Hibernate would use Its org.hibernate.connection.c3p0connectionprovider
for Connection Pooling If you sethibernate.properties and the Hibernate web site for more information.
Hibernate.connection.driver_class = Org.postgresql.Driverhibernate.connection.url = jdbc:postgresql://localhost/ Mydatabasehibernate.connection.username = Myuserhibernate.connection.password = secrethibernate.c3p0.min_size= 5hibernate.c3p0.max_size=20hibernate.c3p0.timeout=1800hibernate.c3p0.max_statements=50hibernate.dialect = Org.hibernate.dialect.PostgreSQL82Dialect
This means that you just need to
hibernate.connection.pool_size replaced by
Hibernate.c3p0.min_size=5hibernate.c3p0.max_size=20hibernate.c3p0.timeout=1800hibernate.c3p0.max_statements=50
These properties are OK, not to mention the configurationConnection.provider_classThis property.
From for notes (Wiz)
Hibernate4.3.8.final when configuring C3P0, error