我在做一个SSH的项目,属于功能升级:
写了一个业务逻辑的class Biz,对相关的表做了ORMAP,写了一个测试类继承Testcase
服务器用tomcat,datasource配置了连接池用测试类直接测试,一切正常,但是部署到tomcat就报错:# Exception occurred while logging on
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [null]; error code [0]; Connections could not be acquired from the underlying database!; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!
写了一个业务逻辑的class Biz,对相关的表做了ORMAP,写了一个测试类继承Testcase
服务器用tomcat,datasource配置了连接池用测试类直接测试,一切正常,但是部署到tomcat就报错:# Exception occurred while logging on
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [null]; error code [0]; Connections could not be acquired from the underlying database!; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!
http://topic.csdn.net/u/20090609/21/213a1d6b-86ee-408f-8089-b311f535961a.html
<bean id="dataSource"
class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="jdbcUrl">
<value>jdbc:oracle:thin:@10.11.100.211:1521:prswdd</value>
</property>
<property name="user">
<value>calparis</value>
</property>
<property name="password">
<value>calparis</value>
</property>
<property name="minPoolSize">
<value>3</value>
</property>
<property name="maxPoolSize">
<value>20</value>
</property>
<property name="initialPoolSize">
<value>3</value>
</property>
<property name="maxIdleTime">
<value>60</value>
</property>
<property name="maxStatements">
<value>3</value>
</property>
<property name="testConnectionOnCheckout">
<value>true</value>
</property>
</bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>这是hibernate.cfg.xml的SessionFactory的补充配置:
<session-factory>
<property name="myeclipse.connection.profile">
Cal_Paris3
</property>
<property name="dialect">
org.hibernate.dialect.Oracle9Dialect
</property>
<property name="show_sql">true</property>
<property name="hibernate.generate_statistics">true</property>
<property name="hibernate.connection.release_mode">auto</property>
...
......
</session-factory>
public String getMaxVendorId() {
log.debug("geting max vendor ID");
try {
String queryString = "select max(vendor.vendorId) from CalibVendor vendor";
List<String> li = getHibernateTemplate().find(queryString);
if(li.get(0)==null)
{
return "0";
}
else
{
return li.get(0);
}
} catch (RuntimeException re) {
log.error("geting max vendor ID failed", re);
throw re;
}
}
invwork