[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2023) performance optimization of JTATransactionFactory.isTransactionInProgress()

Joris Kuipers (JIRA) noreply at atlassian.com
Sun Oct 8 12:04:24 EDT 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2023?page=comments#action_24749 ] 

Joris Kuipers commented on HHH-2023:
------------------------------------

Regarding the original exception:
the UserTransaction is not available from inside a CMT EJB in WAS 5 and 6. See the following for an explanation by IBM:
http://publib.boulder.ibm.com/infocenter/wasinfo/v5r1/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/cjta_glotran.html

Thus, the lookup shouldn't even occur if a CMT transaction is in progress. According to their docs, this is per the EJB spec. 
I don't know if the shown exception is caused by faulty code in WAS or Hibernate, but I would very much appreciate it if the Hibernate team could find it in their hearts to overcome their understandable disgust regarding WAS's transaction semantics (that seem to depend on the phase on the moon or something) and still manage to support this application server. After all, it's a widely used application server and most people (like me) that do have to use it don't have the choice of just switching over to another brand...
BTW, I've used Hibernate 3.0 and 3.1 with both WAS 5.1 and 6.0 with great success, both with and without CMT, and never encountered any problems; I did configure it to use CMTTransactionFactory when using CMT from SLSBs, however.

> performance optimization of JTATransactionFactory.isTransactionInProgress()
> ---------------------------------------------------------------------------
>
>          Key: HHH-2023
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2023
>      Project: Hibernate3
>         Type: Improvement

>   Components: core
>     Versions: 3.2.0.cr2
>  Environment: 1) WebSphere Application Server 6.0.2.9, Base
> 2) Hibernate version: 3.2.CR2
> 3) Oracle 10g
> 4) Driver Oracle 10g XA thin driver (Managed Connection) 
> 5) SessionFacade with a transactional attribute Requires
>     Reporter: Andrei Iltchenko
>     Assignee: Steve Ebersole
>     Priority: Minor
>      Fix For: 3.2.0.cr4

>
>
> 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>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list