Transaction RollbackException with Hibernate

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Transaction RollbackException with Hibernate

Manish.Shukla
Getting following error some time while merging an entity . Any idea what could be issue here?
Tool used : Apache karaf, JPA hibernate with JTA, mariadb

-- Datasource configuration
osgi.jdbc.driver.name=mysql
pool=dbcp2
xa=true

-- persistence
 <persistence-unit name="order" transaction-type="JTA">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=order_mariaDB_datasource)</jta-data-source>
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
        </properties>
    </persistence-unit>
</persistence>

-- Repository source code@Transactional
@Singleton
public class GenericRepoBase<U> implements GenericRepo<U> {

    @PersistenceContext(unitName = "order")
    private EntityManager em;
    public U merge(U objectToPersist) {
        return em.merge(objectToPersist);
 }
 
 ...

-- Error logjavax.transaction.RollbackException
 at org.apache.aries.transaction.TxInterceptorImpl.postCallWithReturn(TxInterceptorImpl.java:109)
 at org.apache.aries.blueprint.proxy.Collaborator.postInvoke(Collaborator.java:98)
 at Proxy8af2e5ee_c7cb_4f0f_b75b_dacb4d121b4f.merge(Unknown Source)
 at Proxy22cba4f1_c863_4172_bb5c_72387fe65471.merge(Unknown Source)
 at com.mycompany.OrderServiceImpl.save(OrderServiceImpl.java:39)
 at Proxy7bce399e_051e_45f0_a58a_2bbec26edb59.save(Unknown Source)
 at com.mycompany.RequestOffersDispatcherImpl.dispatchOrder(RequestOffersDispatcherImpl.java:75)[11:com.mycompany.order-dispatcher-application:1.0.6]
 at com.mycompany.RequestOffersDispatcherImpl.camelDispatcherEndpoint(RequestOffersDispatcherImpl.java:42)[11:com.mycompany.order-dispatcher-application:1.0.6]
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_162]
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_162]
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_162]
 at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_162]
 at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:435)[78:org.apache.camel.camel-core:2.18.0]
 at org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:286)[78:org.apache.camel.camel-core:2.18.0]
 at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:259)[78:org.apache.camel.camel-core:2.18.0]
 at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:178)[78:org.apache.camel.camel-core:2.18.0]
 at org.apache.camel.component.bean.BeanProducer.process(BeanProducer.java:41)[78:org.apache.camel.camel-core:2.18.0]
 at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)[78:org.apache.camel.camel-core:2.18.0]
 at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[78:org.apache.camel.camel-core:2.18.0]
 at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:542)[78:org.apache.camel.camel-core:2.18.0]
 at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)[78:org.apache.camel.camel-core:2.18.0]
 at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:197)[78:org.apache.camel.camel-core:2.18.0]
 at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97)[78:org.apache.camel.camel-core:2.18.0]
 at org.apache.camel.component.sql.SqlConsumer.processBatch(SqlConsumer.java:233)[80:org.apache.camel.camel-sql:2.18.0]
 at org.apache.camel.component.sql.SqlConsumer$1.doInPreparedStatement(SqlConsumer.java:153)[80:org.apache.camel.camel-sql:2.18.0]
 at org.apache.camel.component.sql.SqlConsumer$1.doInPreparedStatement(SqlConsumer.java:112)[80:org.apache.camel.camel-sql:2.18.0]
 at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:633)[165:org.apache.servicemix.bundles.spring-jdbc:4.3.5.RELEASE_1]
 at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:662)[165:org.apache.servicemix.bundles.spring-jdbc:4.3.5.RELEASE_1]
 at org.apache.camel.component.sql.SqlConsumer.poll(SqlConsumer.java:168)[80:org.apache.camel.camel-sql:2.18.0]
 at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)[78:org.apache.camel.camel-core:2.18.0]
 at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)[78:org.apache.camel.camel-core:2.18.0]
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_162]
 at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_162]
 at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)[:1.8.0_162]
 at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[:1.8.0_162]
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)[:1.8.0_162]
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)[:1.8.0_162]
 at java.lang.Thread.run(Thread.java:748)[:1.8.0_162]