org.hibernate.HibernateException: Unable to locate current JTA transaction

Hibernate JIRA | Kuldeep Singh Virdi | 1 decade ago
  1. 0

    Hi, I have made a hibernate-service.xml file and deployed it under myApplication.har file The xml file contents are <?xml version="1.0"?> <server> <mbean code="org.hibernate.jmx.HibernateService" name="jboss.jca:service=HibernateFactory,name=HibernateFactory"> <!-- Required services --> <depends>jboss.jca:service=RARDeployer</depends> <!-- Bind the Hibernate service to JNDI --> <attribute name="JndiName">java:/hibernate/SessionFactory</attribute> <!-- Datasource settings --> <attribute name="Datasource">java:/jdbc/mysqlserverr</attribute> <attribute name="Dialect">org.hibernate.dialect.MySQLDialect</attribute> <!-- Transaction integration --> <attribute name="TransactionStrategy"> org.hibernate.transaction.JTATransactionFactory</attribute> <attribute name="TransactionManagerLookupStrategy"> org.hibernate.transaction.JBossTransactionManagerLookup</attribute> <attribute name="FlushBeforeCompletionEnabled">true</attribute> <attribute name="AutoCloseSessionEnabled">true</attribute> <!-- Fetching options --> <attribute name="MaximumFetchDepth">5</attribute> <!-- Second-level caching --> <attribute name="SecondLevelCacheEnabled">true</attribute> <attribute name="CacheProviderClass">org.hibernate.cache.EhCacheProvider</attribute> <attribute name="QueryCacheEnabled">true</attribute> <!-- Logging --> <attribute name="ShowSqlEnabled">true</attribute> </mbean> </server> Through my Stateless Session EJB i call a method private Session getSession() { if (sessionFactory == null) sessionFactory = // by look up } return sessionFactory.getCurrentSession(); } I get following excpetion 09:29:14,304 INFO [STDOUT] org.hibernate.HibernateException: Unable to locate current JTA transaction at org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:61) at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:604) at com.daffodilwoods.framework.datasource.ResourceManager.currentSession(ResourceManager.java:234) at com.daffodilwoods.framework.core.dataobject.server.DataObjectMetaDataLoader.getHibernateSession(DataObjectMetaD at com.daffodilwoods.framework.core.dataobject.server.DataObjectMetaDataLoader.getDefaultColumns(DataObjectMetaDat at com.daffodilwoods.framework.core.dataobject.server.DataObjectMetaDataLoader.getObject(DataObjectMetaDataLoader. at com.daffodilwoods.framework.core.view.server.metadataloader.AbsTableMetaDataUtil.loadMetadata(AbsTableMetaDataU at com.daffodilwoods.framework.table.server.TableMetaDataLoader.getObject(TableMetaDataLoader.java:87) at com.daffodilwoods.framework.table.server.TableService.createView(TableService.java:32) at com.daffodilwoods.framework.core.view.server.service.AbsViewService.init(AbsViewService.java:41) at com.daffodilwoods.framework.core.view.server.service.AbsViewService.getViewMetaDataHandler(AbsViewService.java: at com.daffodilwoods.framework.table.server.TableService.getData(TableService.java:56) at com.daffodilwoods.framework.core.view.server.service.AbsViewService.getData(AbsViewService.java:68) at com.daffodilwoods.framework.core.view.server.service.ViewService.getData(ViewService.java:71) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:299) at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:186) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) at java.lang.Thread.run(Thread.java:595) 09:29:14,304 INFO [STDOUT] org.hibernate.HibernateException: Unable to locate current JTA transaction Can u tell me wht can i do for it. I think there is not support for providing currentSessionContext attribute in this xml file also Please reply

    Hibernate JIRA | 1 decade ago | Kuldeep Singh Virdi
    org.hibernate.HibernateException: Unable to locate current JTA transaction
  2. 0

    Hi, I have made a hibernate-service.xml file and deployed it under myApplication.har file The xml file contents are <?xml version="1.0"?> <server> <mbean code="org.hibernate.jmx.HibernateService" name="jboss.jca:service=HibernateFactory,name=HibernateFactory"> <!-- Required services --> <depends>jboss.jca:service=RARDeployer</depends> <!-- Bind the Hibernate service to JNDI --> <attribute name="JndiName">java:/hibernate/SessionFactory</attribute> <!-- Datasource settings --> <attribute name="Datasource">java:/jdbc/mysqlserverr</attribute> <attribute name="Dialect">org.hibernate.dialect.MySQLDialect</attribute> <!-- Transaction integration --> <attribute name="TransactionStrategy"> org.hibernate.transaction.JTATransactionFactory</attribute> <attribute name="TransactionManagerLookupStrategy"> org.hibernate.transaction.JBossTransactionManagerLookup</attribute> <attribute name="FlushBeforeCompletionEnabled">true</attribute> <attribute name="AutoCloseSessionEnabled">true</attribute> <!-- Fetching options --> <attribute name="MaximumFetchDepth">5</attribute> <!-- Second-level caching --> <attribute name="SecondLevelCacheEnabled">true</attribute> <attribute name="CacheProviderClass">org.hibernate.cache.EhCacheProvider</attribute> <attribute name="QueryCacheEnabled">true</attribute> <!-- Logging --> <attribute name="ShowSqlEnabled">true</attribute> </mbean> </server> Through my Stateless Session EJB i call a method private Session getSession() { if (sessionFactory == null) sessionFactory = // by look up } return sessionFactory.getCurrentSession(); } I get following excpetion 09:29:14,304 INFO [STDOUT] org.hibernate.HibernateException: Unable to locate current JTA transaction at org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:61) at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:604) at com.daffodilwoods.framework.datasource.ResourceManager.currentSession(ResourceManager.java:234) at com.daffodilwoods.framework.core.dataobject.server.DataObjectMetaDataLoader.getHibernateSession(DataObjectMetaD at com.daffodilwoods.framework.core.dataobject.server.DataObjectMetaDataLoader.getDefaultColumns(DataObjectMetaDat at com.daffodilwoods.framework.core.dataobject.server.DataObjectMetaDataLoader.getObject(DataObjectMetaDataLoader. at com.daffodilwoods.framework.core.view.server.metadataloader.AbsTableMetaDataUtil.loadMetadata(AbsTableMetaDataU at com.daffodilwoods.framework.table.server.TableMetaDataLoader.getObject(TableMetaDataLoader.java:87) at com.daffodilwoods.framework.table.server.TableService.createView(TableService.java:32) at com.daffodilwoods.framework.core.view.server.service.AbsViewService.init(AbsViewService.java:41) at com.daffodilwoods.framework.core.view.server.service.AbsViewService.getViewMetaDataHandler(AbsViewService.java: at com.daffodilwoods.framework.table.server.TableService.getData(TableService.java:56) at com.daffodilwoods.framework.core.view.server.service.AbsViewService.getData(AbsViewService.java:68) at com.daffodilwoods.framework.core.view.server.service.ViewService.getData(ViewService.java:71) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:299) at com.google.gwt.user.server.rpc.RemoteServiceServlet.doPost(RemoteServiceServlet.java:186) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) at java.lang.Thread.run(Thread.java:595) 09:29:14,304 INFO [STDOUT] org.hibernate.HibernateException: Unable to locate current JTA transaction Can u tell me wht can i do for it. I think there is not support for providing currentSessionContext attribute in this xml file also Please reply

    Hibernate JIRA | 1 decade ago | Kuldeep Singh Virdi
    org.hibernate.HibernateException: Unable to locate current JTA transaction
  3. 0

    What does this error mean and how can I fix it?

    Stack Overflow | 6 years ago | Alejandro Soto
    org.hibernate.HibernateException: Unable to locate current JTA transaction
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    org.hibernate.HibernateException: Unable to locate current JTA transaction

    Stack Overflow | 3 months ago | Ildelian
    org.hibernate.HibernateException: Unable to locate current JTA transaction
  6. 0

    Deploying on jboss using getCurrentSession

    Stack Overflow | 4 years ago | Sandeep
    org.hibernate.HibernateException: Unable to locate current JTA transaction

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.HibernateException

      Unable to locate current JTA transaction

      at org.hibernate.context.JTASessionContext.currentSession()
    2. Hibernate
      JTASessionContext.currentSession
      1. org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:61)
      1 frame
    3. Hibernate
      SessionFactoryImpl.getCurrentSession
      1. org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:604)
      1 frame
    4. com.daffodilwoods.framework
      ResourceManager.currentSession
      1. com.daffodilwoods.framework.datasource.ResourceManager.currentSession(ResourceManager.java:234)
      1 frame