Hibernate fails create sessionfactory using HikariCP pool -
i seek utilize hikaricp pool connection, can't create app starts because time, null object create sesion.
this configuration:
system
hibernate 4.3.6.final mariadb v10.0 (x64)hibernateutil class
public class hibernateutil { private static sessionfactory sessionfactory; private static sessionfactory buildsessionfactory() { seek { configuration configuration = new configuration(); configuration.configure("hibernate.cfg.xml"); serviceregistry serviceregistry = new standardserviceregistrybuilder().applysettings(configuration.getproperties()).build(); sessionfactory = configuration.buildsessionfactory(serviceregistry); homecoming sessionfactory; } grab (hibernateexception ex) { throw new exceptionininitializererror(ex); } } public static sessionfactory getsessionfactory() { if (sessionfactory == null) { sessionfactory = buildsessionfactory(); } homecoming sessionfactory; } }
hibernate.cfg.xml
<?xml version="1.0" encoding="utf-8"?> <!doctype hibernate-configuration public "-//hibernate/hibernate configuration dtd 3.0//en" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <!-- datos de conexión la bd --> <property name="hibernate.dialect">org.hibernate.dialect.mysqldialect</property> <property name="hibernate.connection.driver_class">com.mysql.jdbc.driver</property> <property name="hibernate.connection.url">jdbc:mysql://localhost:3307/******?zerodatetimebehavior=converttonull</property> <property name="hibernate.connection.username">****</property> <property name="hibernate.connection.password">****</property> <property name="javax.persistence.validation.mode">none</property> <!-- configuración de sesión --> <property name="connection.release_mode">after_transaction</property> <property name="current_session_context_class">thread</property> <!-- configuración de la salida sql y estadísticas --> <property name="show_sql">true</property> <property name="format_sql">true</property> <property name="hibernate.temp.use_jdbc_metadata_defaults">false</property> <!-- pool de conexiones --> <property name="hibernate.connection.provider_class">org.mariadb.jdbc.mysqldatasource</property> <!-- enable hibernate's current session context --> <property name="hibernate.cache.use_second_level_cache">false</property> <property name="hibernate.cache.use_query_cache">false</property> <property name="cache.provider_class">org.hibernate.cache.nocacheprovider</property> </session-factory> </hibernate-configuration>
log
preparing build session mill filters : {} hhh000130: instantiating explicit connection provider: org.mariadb.jdbc.mysqldatasource exception in application start method
as brettw say, need alter provider class <prop key="hibernate.connection.provider_class">com.zaxxer.hikari.hibernate.hikariconnectionprovider</prop>
hibernate sessionfactory hikaricp
No comments:
Post a Comment