title: Error Caused by: org.hibernate.HibernateException: Could not instantiate connection provider [org.connection.C3P0ConnectionProvider]
body: <p>I have an error in Hibernate 4.1.2.FINAL, JBoss 7.1.1,and Spring 3.1.0.RELEASE,like this:</p>
  
  <pre><code>12:10:50,853 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-2) 
  Context initialization failed: org.springframework.beans.factory.BeanCreationException: 
  Error creating bean with name 'departamentoDao' defined in URL [vfs:/opt/jboss-as-7.1.1.Final/standalone/deployments/projvehimerc.war/WEB-INF/classes/META-INF/spring/spring-hibernate.xml]:Cannot resolve reference to bean 'hibernateTemplate' while setting bean property 'hibernateTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: 
  Error creating bean with name 'hibernateTemplate' defined in URL [vfs:/opt/jboss-as-7.1.1.Final/standalone/deployments/projvehimerc.war/WEB-INF/classes/META-INF/spring/spring-hibernate.xml]: 
  Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: 
  Error creating bean with name 'sessionFactory' defined in URL [vfs:/opt/jboss-as-7.1.1.Final/standalone/deployments/projvehimerc.war/WEB-INF/classes/META-INF/spring/spring-hibernate.xml]: 
  Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.service.jdbc.connections.spi.ConnectionProvider]
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
  </code></pre>
  
  <p>Caused by:</p>
  
  <pre><code>Caused by: org.springframework.beans.factory.BeanCreationException: 
      Error creating bean with name 'hibernateTemplate' defined in URL 
      [vfs:/opt/jboss-as-7.1.1.Final/standalone/deployments/projvehimerc.war/WEB-INF/classes/META-INF/spring/spring-hibernate.xml]: 
      Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: 
      Error creating bean with name 'sessionFactory' defined in URL 
      [vfs:/opt/jboss-as-7.1.1.Final/standalone/deployments/projvehimerc.war/WEB-INF/classes/META-INF/spring/spring-hibernate.xml]: 
      Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.service.jdbc.connections.spi.ConnectionProvider]
      at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) [spring-beans-3.1.0.RELEASE.jar:3.1.0.RELEASE]
  </code></pre>
  
  <p>and :</p>
  
  <pre><code>Caused by: org.springframework.beans.factory.BeanCreationException: 
  Error creating bean with name 'sessionFactory' defined in URL [vfs:/opt/jboss-as-7.1.1.Final/standalone/deployments/projvehimerc.war/WEB-INF/classes/META-INF/spring/spring-hibernate.xml]: Invocation of init method failed; nestwared exception is org.hibernate.service.spi.ServiceException: 
  Unable to create requested service [org.hibernate.service.jdbc.connections.spi.ConnectionProvider]
  &gt;&gt;Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service
  &gt;&gt;Caused by: org.hibernate.HibernateException: Could not instantiate connection provider [org.connection.C3P0ConnectionProvider]
  </code></pre>
  
  <p>and my spring-hibernate configuration:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:p="http://www.springframework.org/schema/p"
     xmlns:tx="http://www.springframework.org/schema/tx"
     xmlns:aop="http://www.springframework.org/schema/aop"
     xmlns:context="http://www.springframework.org/schema/context"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.springframework.org/schema/beans
                         http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
                         http://www.springframework.org/schema/context
                         http://www.springframework.org/schema/context/spring-context-3.1.xsd
                         http://www.springframework.org/schema/tx
                         http://www.springframework.org/schema/tx/spring-tx-3.1.xsd"&gt;
  
   &lt;!-- Hibernate SessionFactory --&gt;
   &lt;bean class="org.springframework.orm.hibernate4.HibernateExceptionTranslator"/&gt;
     &lt;bean id="sessionFactory"   class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
  p:dataSource-ref="vehicDataSource"&gt;
  &lt;!-- p:lobHandler-ref="defaultLobHandler"--&gt;
  &lt;property name="annotatedClasses"&gt;
      &lt;list&gt;
      &lt;!-- Procedimientos --&gt;
          &lt;value&gt;com.reglamb.projvehimerc.domain.HabilitacionVehicular_Inscripcion&lt;/value&gt;
      &lt;!-- Main Properties --&gt;
      &lt;value&gt;com.reglamb.projvehimerc.domain.Transportista&lt;/value&gt;
      &lt;value&gt;com.reglamb.projvehimerc.domain.Ubigeo&lt;/value&gt;
      &lt;value&gt;com.reglamb.projvehimerc.domain.TransportistaNatural&lt;/value&gt;
      &lt;value&gt;com.reglamb.projvehimerc.domain.TransportistaJuridico&lt;/value&gt;
      &lt;value&gt;com.reglamb.projvehimerc.domain.Conductor&lt;/value&gt;
      &lt;!-- Transportista's Ubigeo --&gt;
      &lt;value&gt;com.reglamb.projvehimerc.domain.ubigeo.Departamento&lt;/value&gt;
      &lt;value&gt;com.reglamb.projvehimerc.domain.ubigeo.Distrito&lt;/value&gt;
      &lt;/list&gt;
    &lt;/property&gt;
  &lt;property name="hibernateProperties"&gt;
          &lt;value&gt;
              hibernate.dialect=${hibernate.dialect}
              hibernate.default_schema=${hibernate.default_schema}
              hibernate.jdbc.batch_size=${hibernate.jdbc.batch_size}
              hibernate.c3p0.max_size=${hibernate.c3p0.max_size}
              hibernate.c3p0.min_size=${hibernate.c3p0.min_size}
              hibernate.c3p0.timeout=${hibernate.c3p0.timeout}
              hibernate.c3p0.max_statements=${hibernate.c3p0.max_statements}
              hibernate.c3p0.idle_test_period=${hibernate.c3p0.idle_test_period}
              hibernate.c3p0.acquire_increment=${hibernate.c3p0.acquire_increment}
              &lt;!--hibernate.c3p0.validate=${hibernate.c3p0.validate}--&gt;
              &lt;!--hibernate.cache.provider_class=${hibernate.cache.provider_class}--&gt;
              hibernate.connection.provider_class=${hibernate.connection.provider_class}
              hibernate.show_sql=${hibernate.show_sql}
              hibernate.hbm2ddl.auto=${hibernate.hbm2ddl.auto}
              hibernate.id.new_generator_mappings=${hibernate.id.new_generator_mappings}
              &lt;!-- Auto Generated Schemas and tables not good for production
              hibernate.hbm2ddl.auto=update--&gt;
              &lt;!--hibernate.cache.use_second_level_cache=true--&gt;
              &lt;!--hibernate.cache.use_query_cache=true--&gt;
           &lt;/value&gt;
      &lt;/property&gt;
    &lt;/bean&gt;
   &lt;!-- Transaction Config --&gt;
   &lt;bean id="transactionManager"
        class="org.springframework.orm.hibernate4.HibernateTransactionManager"
        p:sessionFactory-ref="sessionFactory"/&gt;   
   &lt;!-- Hibernate Template --&gt;
   &lt;bean id="hibernateTemplate" 
  class="org.springframework.orm.hibernate3.HibernateTemplate" 
  p:sessionFactory-ref ="sessionFactory"/&gt;
  
   &lt;!-- Injectores Procedimiento --&gt;
   &lt;bean id="inscriptransportistaDao" 
  class="com.reglamb.projvehimerc.dao.hibernate.HabilitacionVehicular_InscripcionDaoHibernate" &gt; 
  &lt;property name="hibernateTemplate" ref ="hibernateTemplate" /&gt;
   &lt;/bean&gt;
  
   &lt;!-- Injectores Ubigeo --&gt;
   &lt;bean id="ubigeoDao" 
  class="com.reglamb.projvehimerc.dao.hibernate.UbigeoDaoHibernate" &gt; 
  &lt;property name="hibernateTemplate" ref ="hibernateTemplate" /&gt;
   &lt;/bean&gt;
    &lt;bean id="departamentoDao" 
  class="com.reglamb.projvehimerc.dao.hibernate.ubigeo.DepartamentoDaoHibernate" &gt; 
  &lt;property name="hibernateTemplate" ref ="hibernateTemplate" /&gt;
   &lt;/bean&gt;
   &lt;bean id="distritoDao" 
  class="com.reglamb.projvehimerc.dao.hibernate.ubigeo.DistritoDaoHibernate" &gt; 
  &lt;property name="hibernateTemplate" ref ="hibernateTemplate" /&gt;
   &lt;/bean&gt;&lt;
   &lt;bean name="inscripcionHabilitacionVehicFacade" class="com.reglamb.projvehimerc.service.HabilitacionVehicular_InscripcionFacadeImpl" /&gt;
   &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt; 
   &lt;/beans&gt;
  </code></pre>
  
  <p>What's the error ? thnks.</p>