0 Replies Latest reply on May 7, 2018 6:15 AM by Nagaraju Chitimilla

    JBAS014237: Only session and message-driven beans with bean-managed transaction demarcation are allowed to access UserTransaction

    Nagaraju Chitimilla Newbie

      We are trying to migrate from jboss 4.2.3 to wildfly 8.2.1 and we are getting the following exception while using the hibernate.

       

      hibernate.cfg.xml

       

      <?xml version='1.0' encoding='utf-8'?>

      <!DOCTYPE hibernate-configuration PUBLIC

              "-//Hibernate/Hibernate Configuration DTD 3.0//EN"

              "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

       

       

      <hibernate-configuration>

          <session-factory>

              <!-- Database connection settings -->

              <property name="connection.datasource">java:/jdbc/reportsnapshot</property>

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

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

              <property name="jta.UserTransaction">java:comp/UserTransaction</property>

              <property name="current_session_context_class">jta</property>

             

          

              <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>

       

       

              <!-- Disable the second-level cache  -->

              <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

       

         </session-factory>

      </hibernate-configuration>

       

       

      stack trace:

      2018-05-07 14:48:42,160 ERROR [org.hibernate.transaction.JTATransaction] (default-threads - 14) Could not find UserTransaction in JNDI: javax.naming.NameNotFoundException: UserTransaction [Root exception is java.lang.IllegalStateException: JBAS014237: 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:140)
      at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:81)
      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:202)
      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:179)
      at org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:235)
      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:188)
      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)
      at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0_101]
      at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0_101]
      at org.hibernate.transaction.JTATransaction.(JTATransaction.java:60) [hibernate3.jar:3.2.0.ga]
      at org.hibernate.transaction.JTATransactionFactory.createTransaction(JTATransactionFactory.java:57) [hibernate3.jar:3.2.0.ga]
      at org.hibernate.jdbc.JDBCContext.getTransaction(JDBCContext.java:193) [hibernate3.jar:3.2.0.ga]
      at org.hibernate.impl.SessionImpl.getTransaction(SessionImpl.java:1315) [hibernate3.jar:3.2.0.ga]
      at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1325) [hibernate3.jar:3.2.0.ga]
      at com.ca.accesscontrol.report.dump_12_0_698.JAXBHibernateXMLToDB.insertToDB(JAXBHibernateXMLToDB.java:335) [acrptsrv.jar:14.1.0.354]
      at com.ca.accesscontrol.report.dump_12_0_698.JAXBHibernateXMLToDB.importXML(JAXBHibernateXMLToDB.java:203) [acrptsrv.jar:14.1.0.354]
      at com.ca.accesscontrol.report.mdb.SnapshotCompletedMDB.onMessage(SnapshotCompletedMDB.java:178) [acrptsrv.jar:14.1.0.354]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_101]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_101]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_101]
      at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_101]
      at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
      at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)
      at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43) [wildfly-ejb3-8.2.1.Final.jar:8.2.1.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45) [wildfly-ee-8.2.1.Final.jar:8.2.1.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
      at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51) [wildfly-ejb3-8.2.1.Final.jar:8.2.1.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:251) [wildfly-ejb3-8.2.1.Final.jar:8.2.1.Final]
      at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:342) [wildfly-ejb3-8.2.1.Final.jar:8.2.1.Final]
      at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239) [wildfly-ejb3-8.2.1.Final.jar:8.2.1.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [wildfly-ejb3-8.2.1.Final.jar:8.2.1.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43) [wildfly-ejb3-8.2.1.Final.jar:8.2.1.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:95) [wildfly-ejb3-8.2.1.Final.jar:8.2.1.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [wildfly-ejb3-8.2.1.Final.jar:8.2.1.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [wildfly-ejb3-8.2.1.Final.jar:8.2.1.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55) [wildfly-ejb3-8.2.1.Final.jar:8.2.1.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentDescription$5$1.processInvocation(MessageDrivenComponentDescription.java:211) [wildfly-ejb3-8.2.1.Final.jar:8.2.1.Final]
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326)
      at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:448)
      at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:326)
      at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
      at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:185)
      at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:182)
      at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:309)
      at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
      at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)
      at com.ca.accesscontrol.report.mdb_12_0_698.SnapshotCompletedMDB$$$view114.onMessage(Unknown Source) [acrptsrv.jar:14.1.0.354]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_101]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_101]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_101]
      at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_101]
      at org.jboss.as.ejb3.inflow.MessageEndpointInvocationHandler.doInvoke(MessageEndpointInvocationHandler.java:139) [wildfly-ejb3-8.2.1.Final.jar:8.2.1.Final]
      at org.jboss.as.ejb3.inflow.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:73) [wildfly-ejb3-8.2.1.Final.jar:8.2.1.Final]
      at com.ca.accesscontrol.report.mdb_12_0_698.SnapshotCompletedMDB$$$endpoint29.onMessage(Unknown Source) [acrptsrv.jar:14.1.0.354]
      at org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:123)
      at org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:64)
      at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:1041)
      at org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:169)
      at org.jboss.jca.core.workmanager.WorkWrapper.run(WorkWrapper.java:219)
      at org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33)
      at org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:808)
      at org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:45)
      at org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:849)
      at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_101]
      at org.jboss.threads.JBossThread.run(JBossThread.java:122)
      Caused by: java.lang.IllegalStateException: JBAS014237: 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) [wildfly-ejb3-8.2.1.Final.jar:8.2.1.Final]
      at org.jboss.as.ejb3.component.allowedmethods.AllowedMethodsInformation.checkAllowed(AllowedMethodsInformation.java:112) [wildfly-ejb3-8.2.1.Final.jar:8.2.1.Final]
      at org.jboss.as.ejb3.subsystem.EJB3UserTransactionAccessControlService$1.authorizeAccess(EJB3UserTransactionAccessControlService.java:53) [wildfly-ejb3-8.2.1.Final.jar:8.2.1.Final]
      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:131)
      ... 93 more