title: Hibernate 4 ConnectionProvider Class not found
body: <p>I just updated Hibernate in my application to 4.3.4 (from 3.X), which caused some problems. The first was the new method of creating a sessionFactory, which I resolved.</p>
  
  <p>The next problem, which I'm finding nothing about, is that I am now getting a ClassNotFoundException on org.hibernate.connection.ConnectionProvider</p>
  
  <p>It should be noted that I'm using BoneCP (0.7.1) for my connection pool, which was working before the upgrade.</p>
  
  <p>Any help would be appreciated. I'm pretty new to hibernate (I'm working on implementing it as a POC), and I may have left out some important details from my description here as such. 
  I don't need it to be the newest version, so I can revert back, but it would be nice to have the latest and greatest :)</p>
  
  <p>Thanks!</p>
  
  <p>Hibernate.cfg.xml snippet (with sensitive info replaced):</p>
  
  <pre><code>&lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
          &lt;property name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
          &lt;property name="hibernate.connection.url"&gt;foo&lt;/property&gt;
          &lt;property name="hibernate.connection.username"&gt;bob&lt;/property&gt;
          &lt;property name="hibernate.default_schema"&gt;bar&lt;/property&gt;
          &lt;property name="hibernate.dialect"&gt;package.path.MySQLCustomDialect&lt;/property&gt;
  
          &lt;!-- Bonecp connection pool --&gt;
          &lt;property name="hibernate.connection.provider_class"&gt;com.jolbox.bonecp.provider.BoneCPConnectionProvider&lt;/property&gt;
          &lt;property name="bonecp.maxConnectionAgeInMinutes"&gt;5&lt;/property&gt;
          &lt;property name="bonecp.idleConnectionTestPeriodInMinutes"&gt;0&lt;/property&gt;
          and so on ...
  </code></pre>
  
  <p>Stack Trace:</p>
  
  <pre><code>Exception in thread "Thread-110" java.lang.NoClassDefFoundError: org/hibernate/connection/ConnectionProvider
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
      at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2895)
      at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
      at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:222)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:249)
      at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:240)
      at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:125)
      at org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionProvider(ConnectionProviderInitiator.java:194)
      at org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(ConnectionProviderInitiator.java:120)
      at org.hibernate.engine.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(ConnectionProviderInitiator.java:55)
      at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:83)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:223)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:197)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:178)
      at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:260)
      at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:94)
      at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:89)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:206)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:178)
      at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1885)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1843)
      at foo.utils.HibernateUtils.&lt;clinit&gt;(HibernateUtils.java:16)
      at foo.objects.building.BuildingHelper.getBuildingByID(BuildingHelper.java:225)
      at foo.objects.inventory.LocationInformation.&lt;init&gt;(LocationInformation.java:36)
      at foo.objects.computermanagementframework.peripheral.PeripheralHelper.readLocation(PeripheralHelper.java:154)
      at foo.objects.computermanagementframework.peripheral.PeripheralHelper.refresh(PeripheralHelper.java:556)
      at foo.server.initialization.InitializeServerThread.run(InitializeServerThread.java:298)
      at java.lang.Thread.run(Thread.java:695)
  Caused by: java.lang.ClassNotFoundException: org.hibernate.connection.ConnectionProvider
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
      at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
      ... 36 more
  </code></pre>