struts string和hibernate 如何配置dataSource为连接池

05-11-11 devie
我组合三个框架,用tomcat作为服务器,在tomcat重配置了连接池,测试成功。然后再applicationContext中配置dataSource如下:
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java:comp/env/jdbc/Mysql</value>
</property>
</bean>

但是使用时总是出错,log4j纪录的错误信息如下:

[INFO ] 2005-11-10 22:20:36,828 method:org.springframework.orm.hibernate3.HibernateTransactionManager.doCleanupAfterCompletion(HibernateTransactionManager.java:552)
Could not access JDBC connection of Hibernate session
org.hibernate.SessionException: Session is currently disconnected
at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:134)
at org.hibernate.jdbc.JDBCContext.userConnection(JDBCContext.java:125)
at org.hibernate.impl.SessionImpl.connection(SessionImpl.java:366)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCleanupAfterCompletion(HibernateTransactionManager.java:548)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:645)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:470)
at org.springframework.transaction.interceptor.TransactionAspectSupport.doCommitTransactionAfterReturning(TransactionAspectSupport.java:258)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:67)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:174)
at $Proxy1.getByLogonName(Unknown Source)

请问那里出了问题了?我记得以前可以的

猜你喜欢