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

Steve Ebersole (JIRA) noreply at atlassian.com
Fri Aug 25 09:53:25 EDT 2006


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

Steve Ebersole commented on HHH-2023:
-------------------------------------

Well first, it is not the setFlushMode() call which causes this error.  Look at the stack trace.  It is the "managed flush" on the commit() call.

So the call at AbstractBatcher:497 (where it calls into the JDBC impl) is "conn.prepareStatement( sql );".  Doesn't get much simplier then that.  In fact the only way I see this causing a null pointer exception would be if you hapen to be using an interceptor which returns null for the "onPrepareStatement(String sql)" method.  But regardless, I am not sure how a NPE deep in the bowels of your JDBC provider can be construed as a Hibernate issue...

And further, I've got to be quite honest in that right now any issue relating to JTA support in WebSphere is absolutely a minor issue to me.  At this point in time I am so completely disgusted with their horse-#$#! in this area.  Two things you need to realize here:
1) TransactionFactory *is* a pluggable interface and a documented extension point;
2) Hibernate provides TransactionFactory implementations for normal transactional patterns; I no longer consider WebSphere "normal" in this regards; ok, not that I ever did, now I am just done worrying about it so much.


> 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