I am porting an application from Jboss 7as to Weblogic 12c.
So far, I am able to run the application and create new records in the database.
However, I get the below 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 happens when I call javax.persistence.EntityManager.merge(Object)
inside a Stateless EJB whose transactions are container managed.
My initial thoughts were that the container is calling javax.transaction.UserTransaction.setRollbackOnly()
somewhere, so I changed the EJB's transaction management to BMT and managed the transaction myself. The same error occurred.
I suspect that my Datasource or persistence.xml have a problem.
Below is my persistence.xml's 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 assist.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…