hibernate 4 里如何配置c3p0

sky-cool 发布于 2012/02/28 18:00
阅读 13K+
收藏 0

我看了hibernate 4的官方文档里面提到hibernate 4可以使用c3p0连接池,但是我配置了似乎还是不行

错是这样的:

17:05:22,969 INFO  [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-5) HHH000130: Instantiating exp
licit connection provider: org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider
17:05:22,969 INFO  [stdout] (MSC service thread 1-5) org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.ser
vice.jdbc.connections.spi.ConnectionProvider]
17:05:22,969 INFO  [stdout] (MSC service thread 1-5)    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceReg
istryImpl.java:187)
17:05:22,969 INFO  [stdout] (MSC service thread 1-5)    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServic
eRegistryImpl.java:150)
17:05:22,979 INFO  [stdout] (MSC service thread 1-5)    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegist
ryImpl.java:131)
17:05:22,979 INFO  [stdout] (MSC service thread 1-5)    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesI
mpl.java:234)
17:05:22,979 INFO  [stdout] (MSC service thread 1-5)    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:91)
17:05:22,979 INFO  [stdout] (MSC service thread 1-5)    at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardService
RegistryImpl.java:75)
17:05:22,989 INFO  [stdout] (MSC service thread 1-5)    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServic
eRegistryImpl.java:159)
17:05:22,989 INFO  [stdout] (MSC service thread 1-5)    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegist
ryImpl.java:131)
17:05:22,989 INFO  [stdout] (MSC service thread 1-5)    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:71)
17:05:22,989 INFO  [stdout] (MSC service thread 1-5)    at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2270)
17:05:22,989 INFO  [stdout] (MSC service thread 1-5)    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2266)
17:05:22,999 INFO  [stdout] (MSC service thread 1-5)    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1735)
17:05:22,999 INFO  [stdout] (MSC service thread 1-5)    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1775)
 

Caused by: org.hibernate.HibernateException: Could not instantiate connection provider [org.hibernate.service.jdbc.connections.internal.C3P0Connection
Provider]
        at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionProvider(ConnectionProviderInitiat
or.java:190) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
        at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(ConnectionProviderInitiator.java:112) [hibernat
e-core-4.0.1.Final.jar:4.0.1.Final]
        at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.initiateService(ConnectionProviderInitiator.java:54) [hibernate
-core-4.0.1.Final.jar:4.0.1.Final]
        at org.hibernate.service.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:69) [hibernate-core-4.0.1.Final
.jar:4.0.1.Final]
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:177) [hibernate-core-4.0.1.Final.
jar:4.0.1.Final]
        ... 51 more
Caused by: org.hibernate.service.classloading.spi.ClassLoadingException: Unable to load class [org.hibernate.service.jdbc.connections.internal.C3P0Con
nectionProvider]
        at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:141) [hibernate-core-4.0.1.Fina
l.jar:4.0.1.Final]
        at org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator.instantiateExplicitConnectionProvider(ConnectionProviderInitiat
or.java:187) [hibernate-core-4.0.1.Final.jar:4.0.1.Final]
        ... 55 more
Caused by: java.lang.ClassNotFoundException: Could not load requested class : org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider
        at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl$1.findClass(ClassLoaderServiceImpl.java:99) [hibernate-core-4.0.1.Final.
jar:4.0.1.Final]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306) [rt.jar:1.6.0_07]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251) [rt.jar:1.6.0_07]
        at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:138) [hibernate-core-4.0.1.Fina

我在hibernate 4的jar包里 (jboss 7下面的module里的hibernate 4 jar包)里根本搜不到
org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider

大家帮帮忙给点意见 怎么配置c3p0啊  还是hibernate 4里不能配置c3p0了?

加载中
1
星星爷
星星爷

拆到这个包里去了 hibernate-c3p0   就tm俩类 整一个包

http://maven.oschina.net/index.html#nexus-search;quick~c3p0

0
二的基本算合格
二的基本算合格
org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider不在Hibernate  Core 4中,有个单独的模块脚hibernate-c3p0,可以再JBoss的仓库找到,https://repository.jboss.org/nexus/content/groups/public/org/hibernate/hibernate-c3p0/4.1.2.Final/hibernate-c3p0-4.1.2.Final.jar
0
王政
王政
大哥这个问题的答案你得到了没有,能不能跟我说说……
返回顶部
顶部