0 Replies Latest reply on May 26, 2017 2:03 AM by Presli A

    org.hibernate.service.jndi.JndiException: unable to find UserTransaction.

    Presli A Newbie

      We are migrating our application from Jboss AS7 to wildlfly 10.0.1.Final. The server was started successfully after solving some issues.While running our instance it gives the following exception\, :org.hibernate.service.jndi.JndiException: unable to find UserTransaction.

      Our application is based on Container Managed Trainsation.But somewhere it tries to access UserTransaction internally.so it shows above exception.So please give me some idea to solve this issue.

       

      My hibernate.cfg.xml ,looks like

       

      <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>

        <property name="transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>

       

      I also tried giving jta.UserTransaction property in hibernate.cfg.xml with values as java:comp/UserTransaction and java:jboss/UserTransaction. But still same exception occured.

       

       

      Full trace of the exception:

       

      org.hibernate.service.jndi.JndiException: unable to find UserTransaction

        at org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform.locateUserTransaction(JBossAppServerJtaPlatform.java:77)

        at org.hibernate.service.jta.platform.internal.AbstractJtaPlatform.retrieveUserTransaction(AbstractJtaPlatform.java:124)

        at org.hibernate.engine.transaction.internal.jta.JtaTransaction.locateUserTransaction(JtaTransaction.java:86)

        at org.hibernate.engine.transaction.internal.jta.JtaTransaction.doBegin(JtaTransaction.java:71)

        at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160)

        at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1394)

        at org.jbpm.persistence.db.DbPersistenceService.beginTransaction(DbPersistenceService.java:109)

        at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:101)

        at org.jbpm.persistence.db.DbPersistenceService.getJobSession(DbPersistenceService.java:341)

        at org.jbpm.JbpmContext.getJobSession(JbpmContext.java:630)

        at org.jbpm.ejb.impl.ExecuteJobCommand.execute(ExecuteJobCommand.java:61)

        at org.jbpm.ejb.impl.CommandServiceBean.execute(CommandServiceBean.java:156)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)

        at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:82)

        at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:93)

        at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)

        at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64)

        at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

        at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51)

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

        at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:254)

        ... 115 more

      Caused by: org.hibernate.service.jndi.JndiException: Unable to lookup JNDI name [java:jboss/UserTransaction]

        at org.hibernate.service.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:68)

        at org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform.locateUserTransaction(JBossAppServerJtaPlatform.java:70)

        ... 155 more

      Caused by: javax.naming.NameNotFoundException: UserTransaction [Root exception is java.lang.IllegalStateException: WFLYEJB0137: Only session and message-driven beans with bean-managed transaction demarcation are allowed to access UserTransaction]

        at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:153)

        at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:83)

        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)

        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)

        at org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:237)

        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)

        at javax.naming.InitialContext.lookup(InitialContext.java:421)

        at javax.naming.InitialContext.lookup(InitialContext.java:421)

        at org.hibernate.service.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:65)

        ... 156 more

      Caused by: java.lang.IllegalStateException: WFLYEJB0137: Only session and message-driven beans with bean-managed transaction demarcation are allowed to access UserTransaction

        at org.jboss.as.ejb3.component.allowedmethods.AllowedMethodsInformation.realCheckPermission(AllowedMethodsInformation.java:138)

        at org.jboss.as.ejb3.component.allowedmethods.AllowedMethodsInformation.checkAllowed(AllowedMethodsInformation.java:112)

        at org.jboss.as.ejb3.subsystem.EJB3UserTransactionAccessControlService$1.authorizeAccess(EJB3UserTransactionAccessControlService.java:53)

        at org.jboss.as.txn.service.UserTransactionAccessControlService.authorizeAccess(UserTransactionAccessControlService.java:83)

        at org.jboss.as.txn.service.UserTransactionBindingService$1.getReference(UserTransactionBindingService.java:71)

        at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:143)

        ... 164 more

       

      Thanks in advance