File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Error running Hibernate query in a distributed environment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Error running Hibernate query in a distributed environment" Watch "Error running Hibernate query in a distributed environment" New topic
Author

Error running Hibernate query in a distributed environment

Rida Abrahams
Greenhorn

Joined: Jan 25, 2004
Posts: 23
Hi,

I'm tyring to execute a hibernate query on MS SQL Server 2005. I'm running WebSphere 6.1 and using Hibernate 3.2.
The hibernate queries execute without any problems if I disable Microsoft Distributed Transaction Co ordinator(MSDTC)
I'd like to enable MSDTC so that I may run distributed transactions. Any idea on what the problem might be.
Your assistance would be highly appreciated.

Thanks in advance.

The error I'm getting is as follows:


[10/11/11 17:09:10:064 CAT] 0000003d SystemErr ... 70 more
[10/11/11 17:09:10:064 CAT] 0000003d SystemErr Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2216)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
at com.hsbc.za.hnet3.hibernate.dao.ContainerManagedHibernateDAO.getList(ContainerManagedHibernateDAO.java:296)
at com.hsbc.za.hnet3.liquidity.monitor.LiquidityDAO.getOutwardMT205SettlementInstructionsPending(LiquidityDAO.java:79)
at com.hsbc.za.hnet3.liquidity.monitor.LiquidityBean.getOutwardMT205SettlementInstructionsPending(LiquidityBean.java:72)
at com.hsbc.za.hnet3.liquidity.monitor.EJSRemoteStatelessLiquidity_8aec2f08.getOutwardMT205SettlementInstructionsPending(EJSRemoteStatelessLiquidity_8aec2f08.java:258)
at com.hsbc.za.hnet3.liquidity.monitor._Liquidity_Stub.getOutwardMT205SettlementInstructionsPending(_Liquidity_Stub.java:272)
at com.hsbc.za.hnet3web.managedbeans.LiquidityMonitoringHandler.findLiquidityData(LiquidityMonitoringHandler.java:38)
at com.hsbc.za.hnet3web.managedbeans.LiquidityMonitoringHandler.<init>(LiquidityMonitoringHandler.java:28)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1263)
at java.beans.Beans.instantiate(Beans.java:219)
at java.beans.Beans.instantiate(Beans.java:63)
at com.sun.faces.config.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:226)
at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:264)
at com.sun.faces.el.VariableResolverImpl.resolveVariable(VariableResolverImpl.java:81)
at com.ibm.faces.databind.SelectItemsVarResolver.resolveVariable(SelectItemsVarResolver.java:38)
at com.sun.faces.el.impl.NamedValue.evaluate(NamedValue.java:125)
at com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:146)
at com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:249)
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:140)
at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:123)
at javax.faces.component.UIData.getValue(UIData.java:527)
at javax.faces.component.UIData.getDataModel(UIData.java:856)
at javax.faces.component.UIData.setRowIndex(UIData.java:379)
at com.ibm.faces.renderkit.html_extended.DataTableRenderer.encodeChildren(DataTableRenderer.java:965)
at com.ibm.faces.renderkit.DefaultAjaxRenderer.encodeChildren(DefaultAjaxRenderer.java:73)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:735)
at javax.faces.webapp.UIComponentTag.encodeChildren(UIComponentTag.java:611)
at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:548)
at com.ibm.faces.taglib.html_extended.DataTableExTag.doEndTag(DataTableExTag.java:517)
at com.ibm._jsp._liquidityMonitoring._jspx_meth_hx_dataTableEx_0(_liquidityMonitoring.java:1415)
at com.ibm._jsp._liquidityMonitoring._jspx_meth_h_form_0(_liquidityMonitoring.java:3233)
at com.ibm._jsp._liquidityMonitoring._jspx_meth_hx_scriptCollector_0(_liquidityMonitoring.java:3287)
at com.ibm._jsp._liquidityMonitoring._jspx_meth_f_view_0(_liquidityMonitoring.java:3326)
at com.ibm._jsp._liquidityMonitoring._jspService(_liquidityMonitoring.java:115)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:85)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:115)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:168)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:308)
at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:325)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:249)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:220)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3129)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:93)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:274)
at com.ibm.ws.ssl.channel.impl.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:984)
at com.ibm.ws.ssl.channel.impl.SSLConnectionLink$MyReadCompletedCallback.complete(SSLConnectionLink.java:600)
at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1812)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:194)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:741)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:863)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)
Caused by: java.sql.SQLException: enlist: caught Exception
at com.ibm.ws.rsadapter.AdapterUtil.toSQLException(AdapterUtil.java:1247)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.beginTransactionIfNecessary(WSJdbcConnection.java:654)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement(WSJdbcConnection.java:2014)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement(WSJdbcConnection.java:1969)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:505)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:423)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
at org.hibernate.loader.Loader.doQuery(Loader.java:673)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2213)
... 75 more
Caused by: javax.resource.ResourceException: enlist: caught Exception
at com.ibm.ejs.j2c.XATransactionWrapper.enlist(XATransactionWrapper.java:794)
at com.ibm.ejs.j2c.ConnectionManager.lazyEnlist(ConnectionManager.java:1747)
at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.lazyEnlist(WSRdbManagedConnectionImpl.java:2112)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.beginTransactionIfNecessary(WSJdbcConnection.java:600)
... 84 more
Caused by: javax.transaction.SystemException: XAResource start association error:XAER_PROTO
at com.ibm.ws.Transaction.JTA.RegisteredResources.startRes(RegisteredResources.java:1154)
at com.ibm.ws.Transaction.JTA.RegisteredResources.enlistResource(RegisteredResources.java:525)
at com.ibm.ws.Transaction.JTA.TransactionImpl.enlistResource(TransactionImpl.java:3219)
at com.ibm.ws.Transaction.JTA.TranManagerSet.enlist(TranManagerSet.java:396)
at com.ibm.ejs.j2c.XATransactionWrapper.enlist(XATransactionWrapper.java:693)


My Hibernate config file is as follows:

<hibernate-configuration>

<session-factory name="hibernate/HibernateFactoryHNet2">

<!-- Data Source -->
<property name="connection.datasource">jdbc/ds/hnet2</property>
<property name="connection.isolation">2</property>

<!-- Database Settings -->
<property name="default_schema">dbo</property>
<property name="dialect">com.rida.za.hnet3.hibernate.dialect.SQLServer2005Dialect</property>
<property name="show_sql">false</property>

<!-- JDBC Settings -->
<property name="jdbc.use_streams_for_binary">true</property>
<property name="max_fetch_depth">1</property>

<!-- Cache settings -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>

<!-- Transaction API -->
<property name="transaction.factory_class">
org.hibernate.transaction.CMTTransactionFactory
</property>
<property name="transaction.manager_lookup_class">
org.hibernate.transaction.WebSphereExtendedJTATransactionLookup
</property>

<!-- Mapping files -->
<mapping resource="com/rida/za/hnet3/hibernate/mapping/hibernate-hnet2.hbm.xml"/>

</session-factory>

</hibernate-configuration>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Error running Hibernate query in a distributed environment
 
Similar Threads
SRVE0068E Uncaught Exception created in one of the service methods of the servlet / Cannot find bean
Connecting to WebSphere datasouce with Hibernate
Fail to enlist db connection after rollback
enlist failed while accessing MQ
error - using jsf page in portal