0

Java spring with Microsoft SQL Server 2005 - 9.00.4035.00 (X64) Nov 24 2008 16:17:31 版权所有 (c) 1988-2005 Microsoft Corporation Standard Edition (64-bit) o​​n Windows NT 5.2 (Build 3790: Service Pack 2)

我正在使用如下的事务管理器,通常效果很好

  <tx:advice id="TxAdvice" transaction-manager="TransactionManager">
    <tx:attributes>
      <tx:method name="*" propagation="REQUIRED" rollback-for="java.lang.Throwable"/>
    </tx:attributes>
  </tx:advice>

  <aop:config>
    <aop:advisor pointcut="execution(* com.rdc.*.*Dao.*(..))" advice-ref="TxAdvice"/>
  </aop:config>

但是我在第 2 行执行以下方法时发现异常情况发生数据库锁定,并且 sqlserver 2008 生成的数据库锁定超时并且语句 1 记录变为永久而不是回滚数据?并产生异常

public void linkDao(){
insert(); // 1
update(); // 2
delete(); // 3
}


StackTrace: org.springframework.transaction.TransactionSystemException: Could not roll back JDBC transaction; nested exception is java.sql.SQLException: Invalid state, the Connection object is closed.
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doRollback(DataSourceTransactionManager.java:279)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:823)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:800)
at org.springframework.transaction.interceptor.TransactionAspectSupport.completeTransactionAfterThrowing(TransactionAspectSupport.java:339)
4

1 回答 1

0

经过大量调查后,这个问题可能是 Sqlserver 的 b/c 内存不足。

我试过这个命令来释放一些内存

DBCC FREESYSTEMCACHE (‘ALL’) WITH MARK_IN_USE_FOR_REMOVAL;
于 2013-04-04T16:50:27.390 回答