JBoss Community

JTS version of JBossTS with Hibernate/JPA

created by Uno Kazuya in EJB3 Development - View the full discussion

Hi,

I'm trying transaction transaction propergation between EJBs w/ JBossAS 6.

 

But when I tried JTS version of JBossTS. I got a strange error.

 

1. At first, I installed JTS version of JBossTS to JBossAS 6.

 

$ export JAVA_HOME=....

$ export JBOSS_HOME=....

$ jar xvf jboss-as-distribution-6.0.0.

Final.zip
$ cd jboss-6.0.0.Final
$ cd docs/examples/transactions
$ ant jts

 


2. edit all/deploy/transaction-jboss-beans.xml :

 

<bean name="JTSEnvironmentBean" class="com.arjuna.ats.jts.common.JTSEnvironmentBean">
   <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.jta:name=JTSEnvironmentBean",
               exposedInterface=com.arjuna.ats.jts.common.JTSEnvironmentBeanMBean.class, registerDirectly=true)
   </annotation>
   <constructor factoryClass="com.arjuna.ats.jts.common.jtsPropertyManager" factoryMethod="getJTSEnvironmentBean"/>
   <property name="alwaysPropagateContext">true</property>
</bean>

 


3. started JBossAS.

 

$ cd ../../../bin
$ ./run.sh --configuration all -b localhost

 


4. Deployed three classes bellow (as a war file).

 

===== A servlet =====

 

@WebServlet("/TestServlet")
public class TestServlet extends HttpServlet {

 

        @EJB
        private JpaService service;

 

        protected void doGet(HttpServletRequest request, HttpServletResponse response)
                throws ServletException, IOException {
                service.executeLocal();
        }
}

 

===== An EJB =====

 

@Stateless
public class JpaService {

 

        @PersistenceContext
        EntityManager em;

 

        @TransactionAttribute(TransactionAttributeType.REQUIRED)
        public void executeLocal() {
                System.out.println("executeLocal(): JPA + REQUIRED");
                Foo foo = new Foo();
                foo.setProperty("bar");
                em.persist(foo);
                em.flush();
        }
}

 

===== An entity =====

 

@Entity(name="FOO_ENTITIES")
public class Foo {

 

        @Id
        @GeneratedValue
        private Long id;

 

        @Column(name="PROPERTY")
        private String property;

 

        public String getProperty() {
                return property;
        }

 

        public void setProperty(String property) {
                this.property = property;
        }
}

 


5. I executed my TestServlet, and got a error bellow.

 

17:29:14,678 WARN  [com.arjuna.ats.jts] ARJUNA-22037 ServerTopLevelAction.registerResource caught exception: org.omg.CosTransactions.Inactive: IDL:omg.org/CosTransactions/Inactive:1.0
        at org.omg.CosTransactions.InactiveHelper.read(InactiveHelper.java:42) [:6.0.0.Final]
        at org.omg.CosTransactions._CoordinatorStub.register_resource(_CoordinatorStub.java:1130) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.ServerTopLevelAction.registerResource(ServerTopLevelAction.java:601) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.orbspecific.interposition.resources.arjuna.ServerTopLevelAction.<init>(ServerTopLevelAction.java:120) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.interposition.resources.arjuna.Interposition.createHierarchy(Interposition.java:178) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.interposition.resources.arjuna.Interposition.setupHierarchy(Interposition.java:109) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.interposition.resources.arjuna.Interposition.create(Interposition.java:68) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.interposition.resources.arjuna.InterpositionCreator.recreateLocal(InterpositionCreator.java:48) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.interposition.FactoryElement.recreateLocal(FactoryList.java:66) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.interposition.FactoryList.recreateLocal(FactoryList.java:113) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.orbspecific.TransactionFactoryImple.recreateLocal(TransactionFactoryImple.java:222) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.context.ContextManager.createHierarchy(ContextManager.java:702) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.context.ContextManager.currentPIContext(ContextManager.java:609) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.context.ContextManager.current(ContextManager.java:169) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.context.ContextManager.associate(ContextManager.java:310) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.OTSImpleManager.current(OTSImpleManager.java:79) [:6.0.0.Final]
        at com.arjuna.ats.internal.jta.transaction.jts.TransactionImple.getTransaction(TransactionImple.java:1129) [:6.0.0.Final]
        at com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple.getTransaction(TransactionManagerImple.java:69) [:6.0.0.Final]
        at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.getTransaction(BaseTransactionManagerDelegate.java:95) [:6.0.0.Final]
        at org.hibernate.ejb.transaction.JoinableCMTTransaction.isTransactionInProgress(JoinableCMTTransaction.java:53) [:3.6.0.Final]
        at org.hibernate.ejb.transaction.JoinableCMTTransactionFactory.isTransactionInProgress(JoinableCMTTransactionFactory.java:52) [:3.6.0.Final]
        at org.hibernate.jdbc.JDBCContext.isTransactionInProgress(JDBCContext.java:235) [:3.6.0.Final]
        at org.hibernate.impl.SessionImpl.isTransactionInProgress(SessionImpl.java:546) [:3.6.0.Final]
        at org.hibernate.ejb.AbstractEntityManagerImpl.isTransactionInProgress(AbstractEntityManagerImpl.java:944) [:3.6.0.Final]
        at org.hibernate.ejb.EntityManagerImpl.close(EntityManagerImpl.java:123) [:3.6.0.Final]
        at org.jboss.jpa.deployment.ManagedEntityManagerFactory$SessionSynchronization.afterCompletion(ManagedEntityManagerFactory.java:138) [:1.0.2-alpha-3]
        at com.arjuna.ats.internal.jta.resources.jts.orbspecific.SynchronizationImple.after_completion(SynchronizationImple.java:139) [:6.0.0.Final]
        at com.arjuna.ArjunaOTS.ManagedSynchronizationPOATie.after_completion(ManagedSynchronizationPOATie.java:58) [:6.0.0.Final]
        at com.arjuna.ArjunaOTS.ManagedSynchronizationPOA._invoke(ManagedSynchronizationPOA.java:53) [:6.0.0.Final]
        at org.jacorb.poa.RequestProcessor.invokeOperation(Unknown Source) [:6.0.0.Final]
        at org.jacorb.poa.RequestProcessor.process(Unknown Source) [:6.0.0.Final]
        at org.jacorb.poa.RequestProcessor.run(Unknown Source) [:6.0.0.Final]

 

17:29:14,694 WARN  [com.arjuna.ats.jts] ARJUNA-22039 ServerTopLevelAction - could not register interposed hierarchy!
17:29:14,694 WARN  [com.arjuna.ats.jts] ARJUNA-22008 ContextManager.createHierarchy caught exception: org.omg.CORBA.TRANSACTION_ROLLEDBACK:   vmcid: 0x0  minor code: 0  completed: No
        at com.arjuna.ats.internal.jts.interposition.resources.arjuna.Interposition.createHierarchy(Interposition.java:190) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.interposition.resources.arjuna.Interposition.setupHierarchy(Interposition.java:109) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.interposition.resources.arjuna.Interposition.create(Interposition.java:68) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.interposition.resources.arjuna.InterpositionCreator.recreateLocal(InterpositionCreator.java:48) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.interposition.FactoryElement.recreateLocal(FactoryList.java:66) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.interposition.FactoryList.recreateLocal(FactoryList.java:113) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.orbspecific.TransactionFactoryImple.recreateLocal(TransactionFactoryImple.java:222) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.context.ContextManager.createHierarchy(ContextManager.java:702) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.context.ContextManager.currentPIContext(ContextManager.java:609) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.context.ContextManager.current(ContextManager.java:169) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.context.ContextManager.associate(ContextManager.java:310) [:6.0.0.Final]
        at com.arjuna.ats.internal.jts.OTSImpleManager.current(OTSImpleManager.java:79) [:6.0.0.Final]
        at com.arjuna.ats.internal.jta.transaction.jts.TransactionImple.getTransaction(TransactionImple.java:1129) [:6.0.0.Final]
        at com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple.getTransaction(TransactionManagerImple.java:69) [:6.0.0.Final]
        at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.getTransaction(BaseTransactionManagerDelegate.java:95) [:6.0.0.Final]
        at org.hibernate.ejb.transaction.JoinableCMTTransaction.isTransactionInProgress(JoinableCMTTransaction.java:53) [:3.6.0.Final]
        at org.hibernate.ejb.transaction.JoinableCMTTransactionFactory.isTransactionInProgress(JoinableCMTTransactionFactory.java:52) [:3.6.0.Final]
        at org.hibernate.jdbc.JDBCContext.isTransactionInProgress(JDBCContext.java:235) [:3.6.0.Final]
        at org.hibernate.impl.SessionImpl.isTransactionInProgress(SessionImpl.java:546) [:3.6.0.Final]
        at org.hibernate.ejb.AbstractEntityManagerImpl.isTransactionInProgress(AbstractEntityManagerImpl.java:944) [:3.6.0.Final]
        at org.hibernate.ejb.EntityManagerImpl.close(EntityManagerImpl.java:123) [:3.6.0.Final]
        at org.jboss.jpa.deployment.ManagedEntityManagerFactory$SessionSynchronization.afterCompletion(ManagedEntityManagerFactory.java:138) [:1.0.2-alpha-3]
        at com.arjuna.ats.internal.jta.resources.jts.orbspecific.SynchronizationImple.after_completion(SynchronizationImple.java:139) [:6.0.0.Final]
        at com.arjuna.ArjunaOTS.ManagedSynchronizationPOATie.after_completion(ManagedSynchronizationPOATie.java:58) [:6.0.0.Final]
        at com.arjuna.ArjunaOTS.ManagedSynchronizationPOA._invoke(ManagedSynchronizationPOA.java:53) [:6.0.0.Final]
        at org.jacorb.poa.RequestProcessor.invokeOperation(Unknown Source) [:6.0.0.Final]
        at org.jacorb.poa.RequestProcessor.process(Unknown Source) [:6.0.0.Final]
        at org.jacorb.poa.RequestProcessor.run(Unknown Source) [:6.0.0.Final]

 

17:29:14,694 ERROR [STDERR] org.hibernate.TransactionException: Unable to check transaction status
17:29:14,694 ERROR [STDERR]     at org.hibernate.ejb.transaction.JoinableCMTTransaction.isTransactionInProgress(JoinableCMTTransaction.java:58)
17:29:14,694 ERROR [STDERR]     at org.hibernate.ejb.transaction.JoinableCMTTransactionFactory.isTransactionInProgress(JoinableCMTTransactionFactory.java:52)
17:29:14,694 ERROR [STDERR]     at org.hibernate.jdbc.JDBCContext.isTransactionInProgress(JDBCContext.java:235)
17:29:14,694 ERROR [STDERR]     at org.hibernate.impl.SessionImpl.isTransactionInProgress(SessionImpl.java:546)
17:29:14,694 ERROR [STDERR]     at org.hibernate.ejb.AbstractEntityManagerImpl.isTransactionInProgress(AbstractEntityManagerImpl.java:944)
17:29:14,694 ERROR [STDERR]     at org.hibernate.ejb.EntityManagerImpl.close(EntityManagerImpl.java:123)
17:29:14,694 ERROR [STDERR]     at org.jboss.jpa.deployment.ManagedEntityManagerFactory$SessionSynchronization.afterCompletion(ManagedEntityManagerFactory.java:138)
17:29:14,694 ERROR [STDERR]     at com.arjuna.ats.internal.jta.resources.jts.orbspecific.SynchronizationImple.after_completion(SynchronizationImple.java:139)
17:29:14,694 ERROR [STDERR]     at com.arjuna.ArjunaOTS.ManagedSynchronizationPOATie.after_completion(ManagedSynchronizationPOATie.java:58)
17:29:14,694 ERROR [STDERR]     at com.arjuna.ArjunaOTS.ManagedSynchronizationPOA._invoke(ManagedSynchronizationPOA.java:53)
17:29:14,694 ERROR [STDERR]     at org.jacorb.poa.RequestProcessor.invokeOperation(Unknown Source)
17:29:14,694 ERROR [STDERR]     at org.jacorb.poa.RequestProcessor.process(Unknown Source)
17:29:14,694 ERROR [STDERR]     at org.jacorb.poa.RequestProcessor.run(Unknown Source)
17:29:14,694 ERROR [STDERR] Caused by: javax.transaction.SystemException: org.omg.CORBA.TRANSACTION_ROLLEDBACK:   vmcid: 0x0  minor code: 0  completed: No
17:29:14,694 ERROR [STDERR]     at com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple.getTransaction(TransactionManagerImple.java:77)
17:29:14,694 ERROR [STDERR]     at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.getTransaction(BaseTransactionManagerDelegate.java:95)
17:29:14,694 ERROR [STDERR]     at org.hibernate.ejb.transaction.JoinableCMTTransaction.isTransactionInProgress(JoinableCMTTransaction.java:53)
17:29:14,694 ERROR [STDERR]     ... 12 more
17:29:14,694 ERROR [STDERR] Caused by: org.omg.CORBA.TRANSACTION_ROLLEDBACK:   vmcid: 0x0  minor code: 0  completed: No
17:29:14,694 ERROR [STDERR]     at com.arjuna.ats.internal.jts.interposition.resources.arjuna.Interposition.createHierarchy(Interposition.java:190)
17:29:14,694 ERROR [STDERR]     at com.arjuna.ats.internal.jts.interposition.resources.arjuna.Interposition.setupHierarchy(Interposition.java:109)
17:29:14,694 ERROR [STDERR]     at com.arjuna.ats.internal.jts.interposition.resources.arjuna.Interposition.create(Interposition.java:68)
17:29:14,694 ERROR [STDERR]     at com.arjuna.ats.internal.jts.interposition.resources.arjuna.InterpositionCreator.recreateLocal(InterpositionCreator.java:48)
17:29:14,694 ERROR [STDERR]     at com.arjuna.ats.internal.jts.interposition.FactoryElement.recreateLocal(FactoryList.java:66)
17:29:14,694 ERROR [STDERR]     at com.arjuna.ats.internal.jts.interposition.FactoryList.recreateLocal(FactoryList.java:113)
17:29:14,694 ERROR [STDERR]     at com.arjuna.ats.internal.jts.orbspecific.TransactionFactoryImple.recreateLocal(TransactionFactoryImple.java:222)
17:29:14,694 ERROR [STDERR]     at com.arjuna.ats.internal.jts.context.ContextManager.createHierarchy(ContextManager.java:702)
17:29:14,694 ERROR [STDERR]     at com.arjuna.ats.internal.jts.context.ContextManager.currentPIContext(ContextManager.java:609)
17:29:14,694 ERROR [STDERR]     at com.arjuna.ats.internal.jts.context.ContextManager.current(ContextManager.java:169)
17:29:14,694 ERROR [STDERR]     at com.arjuna.ats.internal.jts.context.ContextManager.associate(ContextManager.java:310)
17:29:14,694 ERROR [STDERR]     at com.arjuna.ats.internal.jts.OTSImpleManager.current(OTSImpleManager.java:79)
17:29:14,694 ERROR [STDERR]     at com.arjuna.ats.internal.jta.transaction.jts.TransactionImple.getTransaction(TransactionImple.java:1129)
17:29:14,694 ERROR [STDERR]     at com.arjuna.ats.internal.jta.transaction.jts.TransactionManagerImple.getTransaction(TransactionManagerImple.java:69)
17:29:14,694 ERROR [STDERR]     ... 14 more

 

But when tried with default (non-JTS) configuration, these three classes works fine.
So, what's wrong?

Reply to this message by going to Community

Start a new discussion in EJB3 Development at Community