I am migrating an application from Jboss 7as to Weblogic 12c.
So far, I could run the application and create new records in the database.
However, I get the following error only when trying to update existing records;
Error committing transaction: javax.ejb.TransactionRolledbackLocalException: Error committing transaction: at weblogic.ejb.container.internal.EJBRuntimeUtils.throwTransactionRolledbackLocal(EJBRuntimeUtils.java:231) at weblogic.ejb.container.internal.EJBRuntimeUtils.throwEJBException(EJBRuntimeUtils.java:134) at weblogic.ejb.container.internal.BaseLocalObject.postInvoke1(BaseLocalObject.java:362) at weblogic.ejb.container.internal.BaseLocalObject.__WL_postInvokeTxRetry(BaseLocalObject.java:205) at weblogic.ejb.container.internal.SessionLocalMethodInvoker.invoke(SessionLocalMethodInvoker.java:46) ... Caused by: weblogic.transaction.internal.AppSetRollbackOnlyException: setRollbackOnly called on transaction
The error occurs when I call javax.persistence.EntityManager.merge(Object) inside an stateless object whose transactions are managed by the container.
My initial thoughts were that the container calls javax.transaction.UserTransaction.setRollbackOnly() somewhere, so I changed the EJB transaction management to BMT and managed the transaction myself. The same error occurred.
I suspect my Datasource or persistence.xml has problems.
Below are my persistence.xml properties
<persistence version="2.0" 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_2_0.xsd"> <persistence-unit name="myunitname" transaction-type="JTA"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>myDS</jta-data-source> <properties> <property name="hibernate.hbm2ddl.auto" value="update" /> <property name="hibernate.show_sql" value="false" /> <property name="hibernate.format_sql" value="false" /> <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" /> <property name="hibernate.max_fetch_depth" value="1"/> <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.WeblogicJtaPlatform"/> </properties>
Please, help.
source share