-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Problem with tansactions while using hibernate in websphere
PostPosted: Tue Jul 03, 2012 11:01 am 
Newbie

Joined: Tue Jul 03, 2012 10:52 am
Posts: 1
Hi all,
I'm trying to set up an EJB application in Websphere server 7 that use two XA oracle datasources. The first datasource is used by ibatis and the second one is used by hibernate 3.3.1 GA.
I have to use hibernate in order to enable the persistence in drools 5.3.1 and in JBPM 5.1.0.
I use Container Managed Transactions and the transaction manager is obtained with a jndi lookup.
In Spring's applicationContext.xml there is the definition of the Entity Manager Factory. This is the code:


Code:
<bean id="jpaVendorAdapter" class="org.springframework.
orm.jpa.vendor.HibernateJpaVendorAdapter">
        <property name="databasePlatform" value="org.hibernate.dialect.Oracle10gDialect" />
        <property name="showSql" value="false" />
    </bean>

    <bean id="jpaPostProcessor" class="mypackage.JtaPersistenceUnitPostProcessor">
        <property name="jtaDataSource" ref="dataSourceJbpm" />
    </bean>
   
    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" depends-on="txManagerLookup">
        <property name="persistenceXmlLocation" value="classpath:./META-INF/jbpm-persistence.xml" />
        <property name="persistenceUnitName" value="org.jbpm.persistence.jpa" />
        <property name="dataSource" ref="dataSourceJbpm" />
        <property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
        <property name="persistenceUnitPostProcessors">
            <list>
                <ref bean="jpaPostProcessor" />
            </list>
        </property>
        <property name="jpaProperties">
            <props>
                <prop key="hibernate.default_schema">${jbpm_database.schema}</prop>
                <prop key="hibernate.max_fetch_depth">3</prop>
                <prop key="hibernate.hbm2ddl.auto">validate</prop>
                <prop key="hibernate.generate_statistics">false</prop>
                <prop key="hibernate.transaction.manager_lookup_class">myPackage.HibernateSpringTransactionManagerLookup</prop>
                <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
            </props>
        </property>
    </bean>
   
    <bean id="txManagerLookup" class="myPackage.HibernateSpringTransactionManagerLookup" depends-on="txManager" />
    <bean id="txManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager"/>


We use jpaPostProcessor in order to ensure the the datusurce is setted as JTADataSource .
When I try to execute a transaction I have this failure:


Code:
EJBException: See nested exception; nested exception is: java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
        at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:143)
        at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.newStatefulKnowledgeSession(KnowledgeStoreServiceImpl.java:67)
        at org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:122)
        at privatepackage.bd.jbpm.JbpmSessionContainer.apriNuovaSessione(JbpmSessionContainer.java:102)
        at privatepackage.BustaVirtualeFrontOfficePojo.inserisciBustaVirtuale(BustaVirtualeFrontOfficePojo.java:410)
        at privatepackage.BustaVirtualeFrontOfficePojo.inserisciBusteVirtuali(BustaVirtualeFrontOfficePojo.java:488)
        at privatepackage.privatepackage.bean.BustaVirtualeFrontOfficeBean.inserisciBusteVirtuali(BustaVirtualeFrontOfficeBean.java:160)
        at privatepackage.privatepackage.interfaces.EJSLocal0SLBustaVirtualeFrontOfficeBean_4e6e76f9.inserisciBusteVirtuali(EJSLocal0SLBustaVirtualeFrontOfficeBean_4e6e76f9.java)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:611)
        at org.springframework.ejb.access.LocalSlsbInvokerInterceptor.invokeInContext(LocalSlsbInvokerInterceptor.java:71)
        at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.invoke(AbstractSlsbInvokerInterceptor.java:189)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy87.inserisciBusteVirtuali(Unknown Source)
        at privatepackage.myClass.myMethod(Myclass.java:169)
        at privatepackage.myClass.run(Myclass.java:55)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:611)
        at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273)
        at org.springframework.scheduling.support.MethodInvokingRunnable.run(MethodInvokingRunnable.java:65)
        at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:51)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:452)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:328)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:161)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:109)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:192)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:216)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
        at java.lang.Thread.run(Thread.java:736)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:527)
        at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:129)
        ... 34 more
Caused by: org.hibernate.AssertionFailure: Transaction MARKED_FOR_JOINED after isOpen() call
        at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:465)
        at org.hibernate.ejb.AbstractEntityManagerImpl.postInit(AbstractEntityManagerImpl.java:82)
        at org.hibernate.ejb.EntityManagerImpl.<init>(EntityManagerImpl.java:61)
        at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:39)
        at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:34)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:611)
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.invokeProxyMethod(AbstractEntityManagerFactoryBean.java:423)
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$ManagedEntityManagerFactoryInvocationHandler.invoke(AbstractEntityManagerFactoryBean.java:485)
        at $Proxy88.createEntityManager(Unknown Source)
        at org.drools.persistence.jpa.JpaPersistenceContextManager.getApplicationScopedPersistenceContext(JpaPersistenceContextManager.java:55)
        at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:143)
        ... 39 more
javax.ejb.EJBException: See nested exception; nested exception is: java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
Caused by: java.lang.IllegalStateException: java.lang.reflect.InvocationTargetException
        at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:143)
        at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.newStatefulKnowledgeSession(KnowledgeStoreServiceImpl.java:67)
        at org.drools.persistence.jpa.JPAKnowledgeService.newStatefulKnowledgeSession(JPAKnowledgeService.java:122)
        at privatepackage.bd.jbpm.JbpmSessionContainer.apriNuovaSessione(JbpmSessionContainer.java:102)
        at privatepackage.myClass.myMethod(Myclass.java:410)
        at privatepackage.myClass.myMethod(Myclass.java:488)
        at privatepackage.myClass.myMethod(Myclass.java:160)
        at privatepackage.privatepackage.interfaces.EJSLocal0SLBustaVirtualeFrontOfficeBean_4e6e76f9.inserisciBusteVirtuali(EJSLocal0SLBustaVirtualeFrontOfficeBean_4e6e76f9.java)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:611)
        at org.springframework.ejb.access.LocalSlsbInvokerInterceptor.invokeInContext(LocalSlsbInvokerInterceptor.java:71)
        at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.invoke(AbstractSlsbInvokerInterceptor.java:189)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy87.<privateMethod>(Unknown Source)
        at <private package class and method>
        at <private package class and method>
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:611)
        at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:273)
        at org.springframework.scheduling.support.MethodInvokingRunnable.run(MethodInvokingRunnable.java:65)
        at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:51)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:452)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:328)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:161)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:109)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:192)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:216)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
        at java.lang.Thread.run(Thread.java:736)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:527)
        at org.drools.persistence.jpa.KnowledgeStoreServiceImpl.buildCommandService(KnowledgeStoreServiceImpl.java:129)
        ... 34 more
Caused by: org.hibernate.AssertionFailure: Transaction MARKED_FOR_JOINED after isOpen() call
        at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:465)
        at org.hibernate.ejb.AbstractEntityManagerImpl.postInit(AbstractEntityManagerImpl.java:82)
        at org.hibernate.ejb.EntityManagerImpl.<init>(EntityManagerImpl.java:61)
        at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:39)
        at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:34)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:611)
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.invokeProxyMethod(AbstractEntityManagerFactoryBean.java:423)
        at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$ManagaedEntityManagerFactoryInvocationHandler.invoke(AbstractEntityManagerFactoryBean.java:485)
        at $Proxy88.createEntityManager(Unknown Source)
        at org.drools.persistence.jpa.JpaPersistenceContextManager.getApplicationScopedPersistenceContext(JpaPersistenceContextManager.java:55)
        at org.drools.persistence.SingleSessionCommandService.<init>(SingleSessionCommandService.java:143)
        ... 39 more



And this is the persistence.xml:


Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence version="1.0"
   xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns="http://java.sun.com/xml/ns/persistence"
   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
         http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd
         http://java.sun.com/xml/ns/persistence/orm
         http://java.sun.com/xml/ns/persistence/orm_1_0.xsd">
   <persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA">
      <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
      <class>org.drools.persistence.info.SessionInfo</class>
      <class>org.drools.persistence.info.WorkItemInfo</class>
      <class>org.jbpm.process.audit.ProcessInstanceLog</class>
      <class>org.jbpm.process.audit.NodeInstanceLog</class>
      <class>org.jbpm.process.audit.VariableInstanceLog</class>
      <properties>
         <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
      </properties>
   </persistence-unit>
</persistence>


can someone help me?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.