Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: org/hibernate/service/jdbc/connections/spi/ConnectionProvider -
getting following error while trying update hibernate version 3.6.. 4.3.*
initial sessionfactory creation failed.java.lang.noclassdeffounderror: org/hibernate/service/jdbc/connections/spi/connectionprovider java.lang.noclassdeffounderror: org/hibernate/service/jdbc/connections/spi/connectionprovider @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(classloader.java:760) @ java.security.secureclassloader.defineclass(secureclassloader.java:142) @ java.net.urlclassloader.defineclass(urlclassloader.java:467) @ java.net.urlclassloader.access$100(urlclassloader.java:73) @ java.net.urlclassloader$1.run(urlclassloader.java:368) @ java.net.urlclassloader$1.run(urlclassloader.java:362) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:361) @ org.eclipse.jetty.webapp.webappclassloader.loadclass(webappclassloader.java:415) @ org.eclipse.jetty.webapp.webappclassloader.loadclass(webappclassloader.java:377) @ org.hibernate.boot.registry.classloading.internal.classloaderserviceimpl$aggregatedclassloader.findclass(classloaderserviceimpl.java:224) @ java.lang.classloader.loadclass(classloader.java:424) @ java.lang.classloader.loadclass(classloader.java:357) @ java.lang.class.forname0(native method) @ java.lang.class.forname(class.java:348) @ org.hibernate.boot.registry.classloading.internal.classloaderserviceimpl.classforname(classloaderserviceimpl.java:242) @ org.hibernate.boot.registry.selector.internal.strategyselectorimpl.selectstrategyimplementor(strategyselectorimpl.java:125) @ org.hibernate.engine.jdbc.connections.internal.connectionproviderinitiator.instantiateexplicitconnectionprovider(connectionproviderinitiator.java:194) @ org.hibernate.engine.jdbc.connections.internal.connectionproviderinitiator.initiateservice(connectionproviderinitiator.java:120) @ org.hibernate.engine.jdbc.connections.internal.connectionproviderinitiator.initiateservice(connectionproviderinitiator.java:55) @ org.hibernate.boot.registry.internal.standardserviceregistryimpl.initiateservice(standardserviceregistryimpl.java:105) @ org.hibernate.service.internal.abstractserviceregistryimpl.createservice(abstractserviceregistryimpl.java:251) @ org.hibernate.service.internal.abstractserviceregistryimpl.initializeservice(abstractserviceregistryimpl.java:225) @ org.hibernate.service.internal.abstractserviceregistryimpl.getservice(abstractserviceregistryimpl.java:206) @ org.hibernate.engine.jdbc.internal.jdbcservicesimpl.buildjdbcconnectionaccess(jdbcservicesimpl.java:260) @ org.hibernate.engine.jdbc.internal.jdbcservicesimpl.configure(jdbcservicesimpl.java:94) @ org.hibernate.boot.registry.internal.standardserviceregistryimpl.configureservice(standardserviceregistryimpl.java:111) @ org.hibernate.service.internal.abstractserviceregistryimpl.initializeservice(abstractserviceregistryimpl.java:234) @ org.hibernate.service.internal.abstractserviceregistryimpl.getservice(abstractserviceregistryimpl.java:206) @ org.hibernate.cfg.configuration.buildtyperegistrations(configuration.java:1887) @ org.hibernate.cfg.configuration.buildsessionfactory(configuration.java:1845)
my hibernate util class
private static sessionfactory buildsessionfactory() { try { sessionfactory sf = null; configuration configuration = new configuration().configure(); //from properties file serviceregistry = new standardserviceregistrybuilder().applysettings( configuration.getproperties()).build(); if (stringutils.isnotblank(config.gethibernateconfigfile())) { classloader loader = hibernateutil.class.getclassloader(); if (loader == null) loader = classloader.getsystemclassloader(); java.net.url configurl = loader.getresource(config.gethibernateconfigfile()); if (null != configurl) { log.info("configuring hibernate using " + config.gethibernateconfigfile() + " located @ " + configurl.tostring()); // sf = new configuration().configure(configurl).buildsessionfactory(); configuration = configuration.configure(configurl); serviceregistry = new standardserviceregistrybuilder().applysettings(configuration.getproperties()).build(); sf = configuration.buildsessionfactory(serviceregistry); } else log.warn("config file not found " + config.gethibernateconfigfile()); } //default hibernate.cfg.xml resource if (null == sf) { sf = configuration.buildsessionfactory(serviceregistry); } return sf; } catch (throwable ex) { // make sure log exception, might swallowed system.err.println("initial sessionfactory creation failed." + ex); ex.printstacktrace(); throw new exceptionininitializererror(ex); } }
i tried lot of ways resolve unable find it, can me on same :)
my hibernate.cfg.xml
<property name="connection.driver_class">com.mysql.jdbc.driver</property> <property name="connection.url">jdbc:mysql://localhost:3306/dummydb?uselegacydatetimecode=false</property> <property name="connection.username">bobby</property> <property name="connection.password"></property> <!-- boncecp connection pool --> <property name="hibernate.connection.provider_class">com.jolbox.bonecp.provider.bonecpconnectionprovider </property> <property name="bonecp.setidlemaxageinminutes">60</property> <property name="bonecp.setidleconnectiontestperiodinminutes">5</property> <property name="bonecp.partitioncount">3</property> <property name="bonecp.acquireincrement">2</property> <property name="bonecp.maxconnectionsperpartition">5</property> <property name="bonecp.minconnectionsperpartition">2</property> <property name="bonecp.statementscachesize">50</property> <property name="bonecp.releasehelperthreads">3</property> <property name="connection.autoreconnect">true</property> <property name="connection.autoreconnectforpools">true</property> <!--<property name="bonecp.idleconnectiontestperiodinminutes">60</property>--> <!-- sql dialect --> <property name="dialect">org.hibernate.dialect.mysql5innodbdialect</property> <property name="hibernate.dialect">org.hibernate.dialect.mysql5innodbdialect</property>
my pom.xml is
<dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-core</artifactid> <version>4.3.9.final</version> </dependency> <dependency> <groupid>com.jolbox</groupid> <artifactid>bonecp</artifactid> <version>0.8.0.release</version> </dependency> <dependency> <groupid>com.jolbox</groupid> <artifactid>bonecp-provider</artifactid> <version>0.8.0-alpha1</version> </dependency>
the problem bonecp connectionprovider, hibernate 4.3.9 needs connection provider package source moved package in bonecp-0.8.0.alpha causes problem
removed bonecp , used hibernate 4.3.* default supported hikaricp
**note: hikari default supporter hibernate 4.3*
Comments
Post a Comment