首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

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

2013-01-01 
tomcat启动一段时间,运行程序出错,Could not roll back JPA transaction本帖最后由 a506690 于 2010-10-14

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 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>





请各位帮我看一下,是哪里的问题。
[解决办法]
不懂,帮蓝蓝顶下
[解决办法]
从装tomcat
[解决办法]
该回复于2010-12-02 17:24:58被版主删除
[解决办法]
帮蓝蓝顶 嘿嘿
[解决办法]
该回复于2010-12-03 11:43:57被版主删除
[解决办法]
跟tomcat无关,应该是你代码的问题,应该是事务应用的不好,你可以把代码贴出一部分看看
[解决办法]
应该是你配置文件中关于事务的配置有问题

热点排行