2012-04-07 32 views
3

Hibernate 4.1.2.FINAL、JBoss 7.1.1、およびSpring 3.1.0.RELEASEでエラーが発生しました。エラー原因:org.hibernate.HibernateException:接続プロバイダをインスタンス化できませんでした。[org.connection.C3P0ConnectionProvider]

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] 

によって引き起こさ:

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] 

と:

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] 
>>Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service 
>>Caused by: org.hibernate.HibernateException: Could not instantiate connection provider [org.connection.C3P0ConnectionProvider] 

と私の春、休止状態CON、このような造形:

<?xml version="1.0" encoding="UTF-8"?> 
<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"> 

<!-- Hibernate SessionFactory --> 
<bean class="org.springframework.orm.hibernate4.HibernateExceptionTranslator"/> 
    <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean" 
p:dataSource-ref="vehicDataSource"> 
<!-- p:lobHandler-ref="defaultLobHandler"--> 
<property name="annotatedClasses"> 
    <list> 
    <!-- Procedimientos --> 
     <value>com.reglamb.projvehimerc.domain.HabilitacionVehicular_Inscripcion</value> 
    <!-- Main Properties --> 
    <value>com.reglamb.projvehimerc.domain.Transportista</value> 
    <value>com.reglamb.projvehimerc.domain.Ubigeo</value> 
    <value>com.reglamb.projvehimerc.domain.TransportistaNatural</value> 
    <value>com.reglamb.projvehimerc.domain.TransportistaJuridico</value> 
    <value>com.reglamb.projvehimerc.domain.Conductor</value> 
    <!-- Transportista's Ubigeo --> 
    <value>com.reglamb.projvehimerc.domain.ubigeo.Departamento</value> 
    <value>com.reglamb.projvehimerc.domain.ubigeo.Distrito</value> 
    </list> 
    </property> 
<property name="hibernateProperties"> 
     <value> 
      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} 
      <!--hibernate.c3p0.validate=${hibernate.c3p0.validate}--> 
      <!--hibernate.cache.provider_class=${hibernate.cache.provider_class}--> 
      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} 
      <!-- Auto Generated Schemas and tables not good for production 
      hibernate.hbm2ddl.auto=update--> 
      <!--hibernate.cache.use_second_level_cache=true--> 
      <!--hibernate.cache.use_query_cache=true--> 
     </value> 
    </property> 
    </bean> 
<!-- Transaction Config --> 
<bean id="transactionManager" 
     class="org.springframework.orm.hibernate4.HibernateTransactionManager" 
     p:sessionFactory-ref="sessionFactory"/> 
<!-- Hibernate Template --> 
<bean id="hibernateTemplate" 
class="org.springframework.orm.hibernate3.HibernateTemplate" 
p:sessionFactory-ref ="sessionFactory"/> 

<!-- Injectores Procedimiento --> 
<bean id="inscriptransportistaDao" 
class="com.reglamb.projvehimerc.dao.hibernate.HabilitacionVehicular_InscripcionDaoHibernate" > 
<property name="hibernateTemplate" ref ="hibernateTemplate" /> 
</bean> 

<!-- Injectores Ubigeo --> 
<bean id="ubigeoDao" 
class="com.reglamb.projvehimerc.dao.hibernate.UbigeoDaoHibernate" > 
<property name="hibernateTemplate" ref ="hibernateTemplate" /> 
</bean> 
    <bean id="departamentoDao" 
class="com.reglamb.projvehimerc.dao.hibernate.ubigeo.DepartamentoDaoHibernate" > 
<property name="hibernateTemplate" ref ="hibernateTemplate" /> 
</bean> 
<bean id="distritoDao" 
class="com.reglamb.projvehimerc.dao.hibernate.ubigeo.DistritoDaoHibernate" > 
<property name="hibernateTemplate" ref ="hibernateTemplate" /> 
</bean>< 
<bean name="inscripcionHabilitacionVehicFacade" class="com.reglamb.projvehimerc.service.HabilitacionVehicular_InscripcionFacadeImpl" /> 
<tx:annotation-driven transaction-manager="transactionManager"/> 
</beans> 

エラーは何ですか? thnks。

答えて

4

hibernate.connection.provider_classorg.connection.C3P0ConnectionProviderに設定したようです。

代わりにorg.hibernate.connection.C3P0ConnectionProviderである必要があります。

+0

それを変更してください:原因:org.hibernate.service.classloading.spi.ClassLoadingException:クラス[org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider]をロードできません –

+0

おそらくあなたは持っていないでしょうクラスパス内のhibernate-c3p0 jar – axtavt

+0

私の愚かな!、thnks。 –

関連する問題