[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2023) performance optimization of JTATransactionFactory.isTransactionInProgress()
Andrei Iltchenko (JIRA)
noreply at atlassian.com
Fri Aug 25 09:10:24 EDT 2006
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2023?page=comments#action_24085 ]
Andrei Iltchenko commented on HHH-2023:
---------------------------------------
I tested things more and can say that Hibernate still doesn't work correctly on WAS 6.0.2 (which I believe deserves a higher severity than Minor)
For validation perposes, after opening a new session with set the flush mode to never:
Transaction tx = null;
Session session = (Session) obtainSessionFactoryRootpackageEM().openSession();
session.setFlushMode(FlushMode.NEVER); // Postpone flushing until sucessful validation.
try {
tx = session.beginTransaction();
Then we carry out necessary modifications, validate them using an interceptor, and finally commit our work:
if (validationErrors.isEmpty()) {
// Validation went fine. Flush changes to the datasource.
session.setFlushMode(FlushMode.COMMIT); // Enable flushing.
tx.commit();
This works fine on JBoss but on WAS 6.0.2 (with CMTTransactionFactory) the attempt to change the flush mode to COMMIT causes the following exception:
[8/24/06 14:12:39:658 CEST] 0000001e ExceptionUtil E CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "setServiceAgreement" on bean "BeanId(OJ1#rootpackageEjb.jar#ServiceAgreementSvc, null)". Exception data: java.lang.NullPointerException
at oracle.jdbc.dbaccess.DBData.clearItem(DBData.java:431)
at oracle.jdbc.dbaccess.DBDataSetImpl.clearItem(DBDataSetImpl.java:3528)
at oracle.jdbc.driver.OraclePreparedStatement.clearParameters(OraclePreparedStatement.java:3401)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.resetStatement(WSJdbcConnection.java:2189)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement(WSJdbcConnection.java:1840)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement(WSJdbcConnection.java:1792)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:497)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:94)
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:87)
at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:218)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2106)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2503)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:51)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:297)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:993)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:340)
at org.hibernate.transaction.CMTTransaction.commit(CMTTransaction.java:64)
at rootpackage.application.business.logic.ServiceAgreementSvcBean.storeServiceAgreement(ServiceAgreementSvcBean.java:896)
at rootpackage.application.business.logic.ServiceAgreementSvcBean.access$300(ServiceAgreementSvcBean.java:79)
at rootpackage.application.business.logic.ServiceAgreementSvcBean$ServiceAgreementSA.setData(ServiceAgreementSvcBean.java:319)
at rootpackage.application.business.logic.ServiceAgreementSvcBean.setServiceAgreement(ServiceAgreementSvcBean.java:1327)
at rootpackage.application.business.logic.ServiceAgreementSvcBean.setServiceAgreement(ServiceAgreementSvcBean.java:1389)
at rootpackage.application.business.logic.EJSRemoteStatelessServiceAgreementSvc_10611836.setServiceAgreement(Unknown Source)
at rootpackage.application.business.logic._ServiceAgreementSvc_Stub.setServiceAgreement(_ServiceAgreementSvc_Stub.java:447)
at rootpackage.application.business.facade.ServiceAgreementSvcServiceAgreementBusinessFacade.storeMasterCollection(ServiceAgreementSvcServiceAgreementBusinessFacade.java:709)
at rootpackage.application.business.facade.ServiceAgreementSvcServiceAgreementBusinessFacade.doStore(ServiceAgreementSvcServiceAgreementBusinessFacade.java:309)
at com.compuware.alturadev.businessfacade.BusinessFacadeBase.store(BusinessFacadeBase.java:144)
at rootpackage.application.presentation.ServiceAgreementSvcStoreAction.execute(ServiceAgreementSvcStoreAction.java:81)
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.doGet(ActionServlet.java:397)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
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:1470)
> 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