日期:2014-05-19  浏览次数:20846 次

tomcat启动一段时间,运行程序出错,Could not roll back JPA transaction
本帖最后由 a506690 于 2010-10-14 09:38:59 编辑
程序放在tomcat,启动tomcat,运行没问题,但是过一段时间,再运行这个程序,就报错了。
异常:org.springframework.transaction.TransactionSystemException: Could not roll back
JPA transaction; nested exception is javax.persistence.PersistenceException: une
xpected error when rollbacking


框架:struts2+jpa+spring2.5

在网上查资料,说连接mysql会出现这样的情况,我连的informix,我想是不是和mysql有同样的错误。

以为是连接池小了,改了连接池,还是一样报错。

下面我贴一下我的配置文件:

applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd 
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<context:annotation-config />
<!-- *** FOLLOWING CONFIGURATION  IS BASIC LINE,DON NOT CHANGE ***-->

<!-- BeanPostProcessor that processes PersistenceUnit  and PersistenceContext annotations -->
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />

<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="persistenceUnitName" value="dzInter" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="true"></property>
<property name="database" value="INFORMIX"></property>
<property name="generateDdl" value="true"></property>
<property name="databasePlatform" value="org.hibernate.dialect.InformixDialect"></property>
</bean>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory"
ref="entityManagerFactory" />
</bean>
<tx:annotation-driven  transaction-manager="transactionManager" /></beans>




persistence.xml


<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
    http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
    
<persistence-unit nam