tomcat启动一段时间,运行程序出错,Could not roll back JPA transaction

a506690 2010-10-14 09:35:37
程序放在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 name="dzInter" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name = "hibernate.connection.driver_class" value = "com.informix.jdbc.IfxDriver"/>
<property name = "hibernate.connection.url" value = "jdbc:informix-sqli://192.168.254.89:8192/dzppt_srv:INFORMIXSERVER=diccyw_web"/>
<property name = "hibernate.connection.username" value = "webdba"/>
<property name = "hibernate.connection.password" value = "ywawebdba"/>
<!--连接池中保留的最小连接数-->
<property name="minPoolSize" value="1" />

<!--连接池中保留的最大连接数 Default: 15 -->
<property name="maxPoolSize" value="20" />

<!--初始化时获取的连接数,取值应在minPoolSize与maxPoolSize之间 Default: 3 -->
<property name="initialPoolSize" value="2" />

<!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃 Default: 0 -->
<property name="maxIdleTime" value="1800" />

<!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数 Default: 3 -->
<property name="acquireIncrement" value="30" />

</properties>


</persistence-unit>

</persistence>





请各位帮我看一下,是哪里的问题。
...全文
1607 12 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
aking21alinjuju 2012-12-24
  • 打赏
  • 举报
回复
怎么解决的?
a506690 2010-10-29
  • 打赏
  • 举报
回复
恩,我换了一个数据源和事物,就OK了。
bb5209027 2010-10-17
  • 打赏
  • 举报
回复
应该是你配置文件中关于事务的配置有问题
liufeng0209 2010-10-15
  • 打赏
  • 举报
回复
跟tomcat无关,应该是你代码的问题,应该是事务应用的不好,你可以把代码贴出一部分看看
马丁先生 2010-10-14
  • 打赏
  • 举报
回复
帮蓝蓝顶 嘿嘿
aeolus_boy 2010-10-14
  • 打赏
  • 举报
回复
从装tomcat
rimtd0314 2010-10-14
  • 打赏
  • 举报
回复
不懂,帮蓝蓝顶下
a506690 2010-10-14
  • 打赏
  • 举报
回复
郁闷呢,没有人帮我吗

67,549

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧