org.hibernate.TransactionException: Could not find UserTransaction in JNDI:

Hibernate JIRA | Andrei Iltchenko | 1 decade ago
  1. 0

    I am getting the following exception when I try to use Hibernate on WebSphere 6.0.2.9 in a business method of a CMT SLSB. The exception occurs when I call 'session.beginTransaction()': org.hibernate.TransactionException: Could not find UserTransaction in JNDI: at org.hibernate.transaction.JTATransaction.<init>(JTATransaction.java:64) at org.hibernate.transaction.JTATransactionFactory.createTransaction(JTATransactionFactory.java:57) at org.hibernate.jdbc.JDBCContext.getTransaction(JDBCContext.java:186) at org.hibernate.impl.SessionImpl.getTransaction(SessionImpl.java:1308) at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1318) at rootpackage.application.business.logic.ServiceAgreementSvcBean.storeServiceAgreement(ServiceAgreementSvcBean.java:832) ... 37 more Caused by: javax.naming.NameNotFoundException: Name "comp/UserTransaction" not found in context "java:". at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1094) at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:990) at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1263) at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:201) at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:142) at javax.naming.InitialContext.lookup(InitialContext.java:361) at org.hibernate.transaction.JTATransaction.<init>(JTATransaction.java:60) My SessionFactory configuration file looks as follows: <session-factory name="java:hibernate/RootpackageEntitySessionFactory"> <!-- DBMS dialect: oracle. --> <property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property> <property name="hibernate.connection.datasource">jdbc/optimalj5</property> <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property> <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.WebSphereExtendedJTATransactionLookup</property> <!-- Cache manager --> <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property> <!-- Mapping files for entity module: --> ... </session-factory> adding additional configuration options as suggested in <http://opensource.atlassian.com/projects/hibernate/browse/HHH-198> <property name="hibernate.transaction.flush_before_completion">true</property> <property name="hibernate.transaction.auto_close_session">true</property> causes the exception to be thrown at a time when I call openSession() on a SessionFactory instance: Exception data: org.hibernate.TransactionException: Unable to locate UserTransaction to check status at org.hibernate.transaction.JTATransactionFactory.isTransactionInProgress(JTATransactionFactory.java:86) at org.hibernate.jdbc.JDBCContext.isTransactionInProgress(JDBCContext.java:180) at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:158) at org.hibernate.jdbc.JDBCContext.<init>(JDBCContext.java:75) at org.hibernate.impl.SessionImpl.<init>(SessionImpl.java:215) at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:470) at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:494) at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:502) at rootpackage.application.business.logic.ServiceAgreementSvcBean.retrieveAll(ServiceAgreementSvcBean.java:1584) at rootpackage.application.business.logic.EJSRemoteStatelessServiceAgreementSvc_10611836.retrieveAll(Unknown Source) at rootpackage.application.business.logic._ServiceAgreementSvc_Stub.retrieveAll(_ServiceAgreementSvc_Stub.java:799) at rootpackage.application.business.facade.ServiceAgreementSvcServiceAgreementBusinessFacade.retrieveAll(ServiceAgreementSvcServiceAgreementBusinessFacade.java:1980) at rootpackage.application.business.facade.ServiceAgreementSvcServiceAgreementBusinessFacade.retrieveAll(ServiceAgreementSvcServiceAgreementBusinessFacade.java:1948) at rootpackage.application.presentation.ServiceAgreementSvcAction.invokeRetrieveAll(ServiceAgreementSvcAction.java:226) at rootpackage.application.presentation.ServiceAgreementSvcRetrieveAction.handleRetrieveAll(ServiceAgreementSvcRetrieveAction.java:144) at rootpackage.application.presentation.ServiceAgreementSvcRetrieveAction.retrieve(ServiceAgreementSvcRetrieveAction.java:247) at rootpackage.application.presentation.ServiceAgreementSvcRetrieveAction.execute(ServiceAgreementSvcRetrieveAction.java:87) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415) at javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1239) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:113) at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:670) at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:322) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056) at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415) at javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1239) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:136) at rootpackage.application.presentation.filters.SetCharacterEncodingFilterRootpackageWeb.doFilter(SetCharacterEncodingFilterRootpackageWeb.java:139) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:121) at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:670) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2965) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:221) at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:210) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1931) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:84) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:472) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:411) at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:101) at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566) at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619) at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952) at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code)) Forum reference: <http://forum.hibernate.org/viewtopic.php?t=963579>

    Hibernate JIRA | 1 decade ago | Andrei Iltchenko
    org.hibernate.TransactionException: Could not find UserTransaction in JNDI:
  2. 0

    I am getting the following exception when I try to use Hibernate on WebSphere 6.0.2.9 in a business method of a CMT SLSB. The exception occurs when I call 'session.beginTransaction()': org.hibernate.TransactionException: Could not find UserTransaction in JNDI: at org.hibernate.transaction.JTATransaction.<init>(JTATransaction.java:64) at org.hibernate.transaction.JTATransactionFactory.createTransaction(JTATransactionFactory.java:57) at org.hibernate.jdbc.JDBCContext.getTransaction(JDBCContext.java:186) at org.hibernate.impl.SessionImpl.getTransaction(SessionImpl.java:1308) at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1318) at rootpackage.application.business.logic.ServiceAgreementSvcBean.storeServiceAgreement(ServiceAgreementSvcBean.java:832) ... 37 more Caused by: javax.naming.NameNotFoundException: Name "comp/UserTransaction" not found in context "java:". at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1094) at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:990) at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1263) at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:201) at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:142) at javax.naming.InitialContext.lookup(InitialContext.java:361) at org.hibernate.transaction.JTATransaction.<init>(JTATransaction.java:60) My SessionFactory configuration file looks as follows: <session-factory name="java:hibernate/RootpackageEntitySessionFactory"> <!-- DBMS dialect: oracle. --> <property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property> <property name="hibernate.connection.datasource">jdbc/optimalj5</property> <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property> <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.WebSphereExtendedJTATransactionLookup</property> <!-- Cache manager --> <property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property> <!-- Mapping files for entity module: --> ... </session-factory> adding additional configuration options as suggested in <http://opensource.atlassian.com/projects/hibernate/browse/HHH-198> <property name="hibernate.transaction.flush_before_completion">true</property> <property name="hibernate.transaction.auto_close_session">true</property> causes the exception to be thrown at a time when I call openSession() on a SessionFactory instance: Exception data: org.hibernate.TransactionException: Unable to locate UserTransaction to check status at org.hibernate.transaction.JTATransactionFactory.isTransactionInProgress(JTATransactionFactory.java:86) at org.hibernate.jdbc.JDBCContext.isTransactionInProgress(JDBCContext.java:180) at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:158) at org.hibernate.jdbc.JDBCContext.<init>(JDBCContext.java:75) at org.hibernate.impl.SessionImpl.<init>(SessionImpl.java:215) at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:470) at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:494) at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:502) at rootpackage.application.business.logic.ServiceAgreementSvcBean.retrieveAll(ServiceAgreementSvcBean.java:1584) at rootpackage.application.business.logic.EJSRemoteStatelessServiceAgreementSvc_10611836.retrieveAll(Unknown Source) at rootpackage.application.business.logic._ServiceAgreementSvc_Stub.retrieveAll(_ServiceAgreementSvc_Stub.java:799) at rootpackage.application.business.facade.ServiceAgreementSvcServiceAgreementBusinessFacade.retrieveAll(ServiceAgreementSvcServiceAgreementBusinessFacade.java:1980) at rootpackage.application.business.facade.ServiceAgreementSvcServiceAgreementBusinessFacade.retrieveAll(ServiceAgreementSvcServiceAgreementBusinessFacade.java:1948) at rootpackage.application.presentation.ServiceAgreementSvcAction.invokeRetrieveAll(ServiceAgreementSvcAction.java:226) at rootpackage.application.presentation.ServiceAgreementSvcRetrieveAction.handleRetrieveAll(ServiceAgreementSvcRetrieveAction.java:144) at rootpackage.application.presentation.ServiceAgreementSvcRetrieveAction.retrieve(ServiceAgreementSvcRetrieveAction.java:247) at rootpackage.application.presentation.ServiceAgreementSvcRetrieveAction.execute(ServiceAgreementSvcRetrieveAction.java:87) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415) at javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1239) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:113) at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:670) at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:322) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056) at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415) at javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1239) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:136) at rootpackage.application.presentation.filters.SetCharacterEncodingFilterRootpackageWeb.doFilter(SetCharacterEncodingFilterRootpackageWeb.java:139) at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142) at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:121) at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:670) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2965) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:221) at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:210) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1931) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:84) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:472) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:411) at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:101) at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566) at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619) at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952) at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code)) Forum reference: <http://forum.hibernate.org/viewtopic.php?t=963579>

    Hibernate JIRA | 1 decade ago | Andrei Iltchenko
    org.hibernate.TransactionException: Could not find UserTransaction in JNDI:
  3. 0

    Hibernate Community • View topic - Websphere 6, Hibernate 3, DB2 8.2, Datasource Connection Iss

    hibernate.org | 3 months ago
    javax.naming.NameNotFoundException: Name "comp/UserTransaction" not found in context "java:".
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    WAS 6.1 ND Custom registry ConfigurationException on NameNotFoundException for comp/UserTransaction

    Google Groups | 10 years ago | hbartolin
    javax.naming.NameNotFoundException: Name "comp/UserTransaction" not found in context "java:".]

    4 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. javax.naming.NameNotFoundException

      Name "comp/UserTransaction" not found in context "java:".

      at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal()
    2. WebSphere
      javaURLContextRoot.lookup
      1. com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1094)
      2. com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:990)
      3. com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1263)
      4. com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:201)
      5. com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:142)
      5 frames
    3. Java RT
      InitialContext.lookup
      1. javax.naming.InitialContext.lookup(InitialContext.java:361)
      1 frame
    4. Hibernate
      JTATransaction.<init>
      1. org.hibernate.transaction.JTATransaction.<init>(JTATransaction.java:60)
      1 frame