页面报错如下:
root cause
type Exception reportmessagedescription The server encountered an internal error () that prevented it from fulfilling this request.exceptionorg.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Could not open connectionroot causeorg.hibernate.exception.GenericJDBCException: Could not open connection
root causejava.sql.SQLException: Connections could not be acquired from the underlying database!
root cause
com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.配置文件
<!-- 导入数据库配置文件 -->
<context:property-placeholder location="classpath:db.properties" />
<!-- 配置c3p0数据源 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${driverClass}"></property>
<property name="jdbcUrl" value="${jdbcUrl}"></property>
<property name="user" value="${username}"></property>
<property name="password" value="${password}"></property>
<property name="acquireIncrement" value="${acquireIncrement}"></property>
<property name="initialPoolSize" value="${initialPoolSize}"></property>
<property name="maxPoolSize" value="${maxPoolSize}"></property>
<property name="minPoolSize" value="${minPoolSize}"></property>
<property name="maxIdleTimeExcessConnections" value="${maxIdleTimeExcessConnections}"></property>
<property name="idleConnectionTestPeriod" value="${idleConnectionTestPeriod}"></property>
<property name="acquireRetryAttempts" value="${acquireRetryAttempts}"></property>
</bean>
<!-- 配置sessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<!-- 配置数据源属性 -->
<property name="dataSource" ref="dataSource"></property>
<!-- 配置hibernate配置文件位置 -->
<property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
<!-- 配置hibernate映射文件位置 -->
<property name="mappingLocations" value="classpath:com/jsjm/model/*.hbm.xml"></property>
</bean>
db.properties文件
#datasource info
driverClass=oracle.jdbc.driver.OracleDriver  
jdbcUrl=jdbc:oracle:thin:@127.0.0.1:1521/ORCL
username=scott
password=tiger#c3p0 connection pool
idleConnectionTestPeriod=3600
idleMaxAge=60
maxConnectionsPerPartition=30
minConnectionsPerPartition=10
partitionCount=3
acquireIncrement=5
statementsCacheSize=10
releaseHelperThreads=3
initialPoolSize=3   
maxPoolSize=115
minPoolSize=3
maxIdleTimeExcessConnections=3600
acquireRetryAttempts=3oracle帐号密码没错 Myeclipse可以连接数据库