URGENT HELP NEEDED: EJB CMT to Spring to Hibernate > Tx E
Well, looks like I'm the first poster in this category so hopefully this will be a worthy first post! :lol:
Okay, I have CMT via an WL SLSB connecting to Hibernate DAO POJOs. All was really good in this scenario until I encountered the error below. This error only happens on some of my DAO CRUD ops and not all, could be saves or reads, doesn't matter, it will happen. It seems like the session isn't able to synchronize and thus rolls back.
Does anyone have any clues why this could be happening?
Thanks,
Lou
Code:
<Aug 12, 2004 11:49:14 PM PDT> <Error> <EJB> <BEA-010026> <Exception occurred du
ring commit of transaction Name=[EJB com.bea.wlw.runtime.core.bean.SyncDispatche
rBean.invoke(com.bea.wlw.runtime.core.request.Request)],Xid=BEA1-00C4744D618826C
12C0A(11642915),Status=Rolled back. [Reason=weblogic.transaction.internal.AppSet
RollbackOnlyException],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since b
egin=35,seconds left=60,XAServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResource
Impl]=(ServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(state=rolled
back,assigned=cgServer),xar=weblogic.jdbc.wrapper.JTSXAResourceImpl@195cba2,re-R
egistered = false),XAServerResourceInfo[JMS_cgJMSStore]=(ServerResourceInfo[JMS_
cgJMSStore]=(state=rolledback,assigned=cgServer),xar=JMS_cgJMSStore,re-Registere
d = false),SCInfo[integration+cgServer]=(state=rolledback),properties=({weblogic
.transaction.name=[EJB com.bea.wlw.runtime.core.bean.SyncDispatcherBean.invoke(c
om.bea.wlw.runtime.core.request.Request)], weblogic.jdbc=t3://172.24.171.49:7001
}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=
cgServer+172.24.171.49:7001+integration+t3+, XAResources={JMS_FileStore, integra
tion.cgServer.WebLogic DBMS Adapter Built with ADK_sampleApp.FunctionDemo.Custom
erMgmt.Default.Default, weblogic.jdbc.wrapper.JTSXAResourceImpl, JMS_cgJMSStore}
,NonXAResources={})],CoordinatorURL=cgServer+172.24.171.49:7001+integration+t3+)
: weblogic.transaction.internal.AppSetRollbackOnlyException
at weblogic.transaction.internal.TransactionImpl.setRollbackOnly(Transac
tionImpl.java:504)
at weblogic.transaction.internal.TransactionManagerImpl.setRollbackOnly(
TransactionManagerImpl.java:337)
at weblogic.transaction.internal.TransactionManagerImpl.setRollbackOnly(
TransactionManagerImpl.java:331)
at org.springframework.orm.hibernate.SessionFactoryUtils$JtaSessionSynch
ronization.beforeCompletion(SessionFactoryUtils.java:475)
at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(Serv
erSCInfo.java:1010)
at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(Se
rverSCInfo.java:115)
at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAn
dChain(ServerTransactionImpl.java:1184)
at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(
ServerTransactionImpl.java:1910)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(Se
rverTransactionImpl.java:273)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
sactionImpl.java:244)
at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:2
99)
at weblogic.ejb20.internal.StatelessEJBObject.postInvoke(StatelessEJBObj
ect.java:140)
at com.bea.wlw.runtime.core.bean.SyncDispatcher_k1mrl8_EOImpl.invoke(Syn
cDispatcher_k1mrl8_EOImpl.java:110)
at com.bea.wlw.runtime.core.dispatcher.Dispatcher.remoteDispatch(Dispatc
her.java:161)
at com.bea.wlw.runtime.core.dispatcher.Dispatcher.dispatch(Dispatcher.ja
va:49)
at com.bea.wlw.runtime.core.dispatcher.HttpServerHelper.executePostReque
st(HttpServerHelper.java:713)
at com.bea.wlw.runtime.core.dispatcher.HttpServer.doPost(HttpServer.java
:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
--------------- nested within: ------------------
weblogic.transaction.RollbackException: Unknown reason - with nested exception:
[weblogic.transaction.internal.AppSetRollbackOnlyException]
at weblogic.transaction.internal.TransactionImpl.throwRollbackException(
TransactionImpl.java:1644)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(Se
rverTransactionImpl.java:323)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
sactionImpl.java:244)
at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:2
99)
at weblogic.ejb20.internal.StatelessEJBObject.postInvoke(StatelessEJBObj
ect.java:140)
at com.bea.wlw.runtime.core.bean.SyncDispatcher_k1mrl8_EOImpl.invoke(Syn
cDispatcher_k1mrl8_EOImpl.java:110)
at com.bea.wlw.runtime.core.dispatcher.Dispatcher.remoteDispatch(Dispatc
her.java:161)
at com.bea.wlw.runtime.core.dispatcher.Dispatcher.dispatch(Dispatcher.ja
va:49)
at com.bea.wlw.runtime.core.dispatcher.HttpServerHelper.executePostReque
st(HttpServerHelper.java:713)
at com.bea.wlw.runtime.core.dispatcher.HttpServer.doPost(HttpServer.java
:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
.>
<Aug 12, 2004 11:49:14 PM PDT> <Error> <WLW> <000000> <Returning HTTP=500 due to
httpWriteFault msg=null,detail=null
javax.transaction.TransactionRolledbackException: Exception while commiting Tx :
Name=[EJB com.bea.wlw.runtime.core.bean.SyncDispatcherBean.invoke(com.bea.wlw.r
untime.core.request.Request)],Xid=BEA1-00C4744D618826C12C0A(11642915),Status=Rol
led back. [Reason=weblogic.transaction.internal.AppSetRollbackOnlyException],num
RepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=35,seconds left=60,XA
ServerResourceInfo[weblogic.jdbc.wrapper.JTSXAResourceImpl]=(ServerResourceInfo[
weblogic.jdbc.wrapper.JTSXAResourceImpl]=(state=rolledback,assigned=cgServer),xa
r=weblogic.jdbc.wrapper.JTSXAResourceImpl@195cba2,re-Registered = false),XAServe
rResourceInfo[JMS_cgJMSStore]=(ServerResourceInfo[JMS_cgJMSStore]=(state=rolledb
ack,assigned=cgServer),xar=JMS_cgJMSStore,re-Registered = false),SCInfo[integrat
ion+cgServer]=(state=rolledback),properties=({weblogic.transaction.name=[EJB com
.bea.wlw.runtime.core.bean.SyncDispatcherBean.invoke(com.bea.wlw.runtime.core.re
quest.Request)], weblogic.jdbc=t3://172.24.171.49:7001}),OwnerTransactionManager
=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=cgServer+172.24.171.49:700
1+integration+t3+, XAResources={JMS_FileStore, integration.cgServer.WebLogic DBM
S Adapter Built with ADK_sampleApp.FunctionDemo.CustomerMgmt.Default.Default, we
blogic.jdbc.wrapper.JTSXAResourceImpl, JMS_cgJMSStore},NonXAResources={})],Coord
inatorURL=cgServer+172.24.171.49:7001+integration+t3+): weblogic.transaction.int
ernal.AppSetRollbackOnlyException
at weblogic.transaction.internal.TransactionImpl.setRollbackOnly(Transac
tionImpl.java:504)
at weblogic.transaction.internal.TransactionManagerImpl.setRollbackOnly(
TransactionManagerImpl.java:337)
at weblogic.transaction.internal.TransactionManagerImpl.setRollbackOnly(
TransactionManagerImpl.java:331)
at org.springframework.orm.hibernate.SessionFactoryUtils$JtaSessionSynch
ronization.beforeCompletion(SessionFactoryUtils.java:475)
at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(Serv
erSCInfo.java:1010)
at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(Se
rverSCInfo.java:115)
at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAn
dChain(ServerTransactionImpl.java:1184)
at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(
ServerTransactionImpl.java:1910)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(Se
rverTransactionImpl.java:273)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
sactionImpl.java:244)
at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:2
99)
at weblogic.ejb20.internal.StatelessEJBObject.postInvoke(StatelessEJBObj
ect.java:140)
at com.bea.wlw.runtime.core.bean.SyncDispatcher_k1mrl8_EOImpl.invoke(Syn
cDispatcher_k1mrl8_EOImpl.java:110)
at com.bea.wlw.runtime.core.dispatcher.Dispatcher.remoteDispatch(Dispatc
her.java:161)
at com.bea.wlw.runtime.core.dispatcher.Dispatcher.dispatch(Dispatcher.ja
va:49)
at com.bea.wlw.runtime.core.dispatcher.HttpServerHelper.executePostReque
st(HttpServerHelper.java:713)
at com.bea.wlw.runtime.core.dispatcher.HttpServer.doPost(HttpServer.java
:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
; nested exception is:
weblogic.transaction.internal.AppSetRollbackOnlyException
at weblogic.ejb20.internal.EJBRuntimeUtils.throwTransactionRolledback(EJ
BRuntimeUtils.java:202)
at weblogic.ejb20.internal.EJBRuntimeUtils.throwRemoteException(EJBRunti
meUtils.java:90)
at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:3
22)
at weblogic.ejb20.internal.StatelessEJBObject.postInvoke(StatelessEJBObj
ect.java:140)
at com.bea.wlw.runtime.core.bean.SyncDispatcher_k1mrl8_EOImpl.invoke(Syn
cDispatcher_k1mrl8_EOImpl.java:110)
at com.bea.wlw.runtime.core.dispatcher.Dispatcher.remoteDispatch(Dispatc
her.java:161)
at com.bea.wlw.runtime.core.dispatcher.Dispatcher.dispatch(Dispatcher.ja
va:49)
at com.bea.wlw.runtime.core.dispatcher.HttpServerHelper.executePostReque
st(HttpServerHelper.java:713)
at com.bea.wlw.runtime.core.dispatcher.HttpServer.doPost(HttpServer.java
:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
Caused by: weblogic.transaction.internal.AppSetRollbackOnlyException
at weblogic.transaction.internal.TransactionImpl.setRollbackOnly(Transac
tionImpl.java:504)
at weblogic.transaction.internal.TransactionManagerImpl.setRollbackOnly(
TransactionManagerImpl.java:337)
at weblogic.transaction.internal.TransactionManagerImpl.setRollbackOnly(
TransactionManagerImpl.java:331)
at org.springframework.orm.hibernate.SessionFactoryUtils$JtaSessionSynch
ronization.beforeCompletion(SessionFactoryUtils.java:475)
at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(Serv
erSCInfo.java:1010)
at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(Se
rverSCInfo.java:115)
at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAn
dChain(ServerTransactionImpl.java:1184)
at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(
ServerTransactionImpl.java:1910)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(Se
rverTransactionImpl.java:273)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
sactionImpl.java:244)
at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:2
99)
... 18 more
>
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<!--
- Root application context definition for a web app that uses Hibernate.
- Does not depend on web infrastructure or any web-specific classes!
-
- Assumes running in a J2EE environment in the "myDataSource" definition, as
- it looks for a JNDI DataSource that the Hibernate
- SessionFactory will use to access the database, but that can be replaced easily
- (as noted). Such a context definition can thus be reused in test environments
- or standalone applications without any hassle.
-
- Alternatively, the simple JNDI implementation in org.springframework.jndi.support
- can be leveraged to set up a JNDI environment outside of a J2EE container,
- binding a DataSource instance like DriverManagerDataSource or a Jakarta Commons
- DBCP BasicDataSource to the expected JNDI location.
-->
<beans>
<!-- ========================= GENERAL DEFINITIONS ========================= -->
<!--
- The message source for this context, loaded from localized "messages_xx" files
- in the classpath, i.e. "/WEB-INF/classes/messages.properties" or
- "/WEB-INF/classes/messages_de.properties".
-
- "getMessage" calls to this context will use this source.
- Child contexts can have their own message sources, inheriting all messages from this
- source, being able to define new messages and override ones defined in this source.
-->
<!-- <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">-->
<!-- <property name="basename"><value>messages</value></property>-->
<!-- </bean>-->
<!-- ========================= PERSISTENCE DEFINITIONS ========================= -->
<!--
- Makes a JNDI DataSource available as bean reference, assuming a J2EE environment.
- By default, "java:comp/env/" will be prepended if not already specified.
-
- If giving this DataSource to LocalSessionFactoryBean, an alternative DataSource
- could be used here too, e.g. for non-J2EE environments (see "webapp-typical").
- Alternatively, one can omit the context-level DataSource definition, and let
- Hibernate use its own connection provider, specified via Hibernate properties.
-->
<bean id="clmDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName"><value>clmDataSource</value></property>
</bean>
<!--Below is the following that you would use when testing outside the J2EE container-->
<!--<bean id="clmDataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc:oracle:thin:@nmad.mitchell.com:1521:nmad</value>
</property>
<property name="username">
<value>clm</value>
</property>
<property name="password">
<value>clm</value>
</property>
</bean>-->
<!--
- Builds a Hibernate SessionFactory and makes it available as bean reference.
- All necessary settings get specified here, without relying on an external
- Hibernate config file like "WEB-INF/classes/hibernate.cfg.xml".
-
- The SessionFactory will use the locally defined DataSource in this context.
- This allows for convenient sharing of transactions with plain JDBC access
- code, if HibernateTransactionManager is explictly given the same DataSource.
-
- This definition could also use a JDBC DataSource specified via Hibernate
- properties. Note that to be able to share transactions with plain JDBC access
- code then, that DataSource would need to be a JNDI one that should match the
- one given to HibernateTransactionManager and data access objects.
-
- This definition can be replaced by a JndiObjectFactoryBean definition for fetching
- a JNDI-bound SessionFactory, but this only makes sense when using Hibernate's
- JCA Connector (not recommended for most types of applications).
-->
<bean id="mySessionFactory"
class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="clmDataSource"/>
</property>
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
<!--
- Defines a transaction manager for usage in business or data access objects.
- No special treatment by the context, just a bean instance available as reference
- for business objects that want to handle transactions, e.g. via TransactionTemplate.
-
- Needs a SessionFactory reference that it should handle transactions for.
- Can optionally take a DataSource reference that it should use export Hibernate
- transactions for, to be able to share transactions with plain JDBC access code
- on the same database (using the same DataSource as the Hibernate SessionFactory).
-->
<!--Below is the following that you would use when testing outside the J2EE container (no CMT)-->
<!--<bean id="myTransactionManager"
class="org.springframework.orm.hibernate.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="mySessionFactory"/>
</property>
</bean>-->
<!--
- Alternative transaction manager that accesses the container's transaction manager.
- Can be used as drop-in replacement for HibernateTransactionManager, e.g. when
- needing distributed transactions (i.e. across multiple databases).
-->
<!--<bean id="myTransactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager"/>-->
<!--Use an AOP interceptor to attach the Hibernate session to CMT for session-per-
- transaction scoping. This way one hibernate session will live with the transaction.-->
<bean id="myHibernateInterceptor"
class="org.springframework.orm.hibernate.HibernateInterceptor">
<property name="sessionFactory">
<ref bean="mySessionFactory"/>
</property>
</bean>
<bean id="clmAddressDaoTarget" singleton="false"
class="com.mitchell.services.technical.claim.dao.spring.ClmAddressHibernateDao">
<property name="sessionFactory">
<ref local="mySessionFactory"/>
</property>
</bean>
<bean id="clmAddressDao"
class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces">
<value>com.mitchell.services.technical.claim.dao.ClmAddressDao</value>
</property>
<property name="interceptorNames">
<list>
<value>myHibernateInterceptor</value>
<value>clmAddressDaoTarget</value>
</list>
</property>
</bean>
// there's more just not listed...
<bean id="claimDaoManager"
class="com.mitchell.services.technical.claim.dao.ClaimDaoMgr">
<property name="clmAddressDao">
<ref local="clmAddressDao"/>
</property>
</bean>
<!-- We don't need to do this since Spring is smart about going JTA if
- it exists, which in our case does when implementing with CMT.
- You would only need this for Spring-based CMT.
-->
<!--<bean id="myClaimService"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="myTransactionManager"/>
</property>
<property name="target">
<ref bean="claimDaoManager"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="find*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<!-#-<prop key="someOtherBusinessMethod">
PROPAGATION_MANDATORY</prop>-#->
</props>
</property>
</bean>-->
</beans>
hibernate.config.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory name="ClmSessionFactory">
<property name="dialect">net.sf.hibernate.dialect.Oracle9Dialect</property>
<property name="hibernate.max_fetch_depth">3</property>
<property name="hibernate.jdbc.batch_size">0</property>
<property name="hibernate.jdbc.use_get_generated_keys">true</property>
<property name="hibernate.jdbc.use_streams_for_binary">true</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.use_outer_join">true</property>
<property name="hibernate.cglib.use_reflection_optimizer">true</property>
<property name="hibernate.query.substitutions">true 'T', false 'F', yes 'Y', no 'N'</property>
<!--<property name="hibernate.transaction.factory_class">
net.sf.hibernate.transaction.JTATransactionFactory
</property>
<property name="jta.UserTransaction">
javax.transaction.UserTransaction
</property>-->
<property name="hibernate.transaction.manager_lookup_class">
net.sf.hibernate.transaction.WeblogicTransactionManagerLookup
</property>
<mapping
resource="com/mitchell/services/technical/claim/dao/vo/ClmAddress.hbm.xml"
/>
</session-factory>
</hibernate-configuration>
Re: URGENT HELP NEEDED: EJB CMT to Spring to Hibernate >
Definitely interesting stuff.
Looks like you are using WL Integration, which behind the scene has some JMS stuff thrown in for good measure :-) I think in this case you do want to explicitly use Spring's JtaTransactionManager in you Spring config file.
Re: URGENT HELP NEEDED: EJB CMT to Spring to Hibernate >
Thanks...almost too interesting! :cry:
Per this post (http://forum.hibernate.org/viewtopic.php?t=929516) Juergon exclaims that you wouldn't need Spring transaction management, just the WeblogicTransaction manager lookup class I have in my hibernate.cfg.xml. Despite that, I've tried several different permutations, and I still see the same error in the log. At this point, I'm not really sure what I need anymore.
My latest thought is to move the Hibernate session factory into JNDI and use the HibernateUtil that leverages LocalThread to bind the session to the SLSB method call.
Lou
Re: URGENT HELP NEEDED: EJB CMT to Spring to Hibernate >
Quote:
Originally Posted by Loumeister
I have been following the threads you started and participated at the Hibernate Architecture forum and the old Spring Help forum. I am interested in this discussion because I have an app that uses JMS/SLSB EJB in XA TX that I wanted to migrate to Spring. However, unlike your case, I want to get rid of SLSB (replace them by service POJO's) and only keep my MDB's.
Now, I have read all available materials on Spring declarative TX management (Juergen's white paper at hibernate.org, Spring User's Guide, Rod Johnson's new book), however, things are still not clear to me. My question is: if like you I want to use SLSB + DAO + Hibernate, do I even need Spring, if my TX is demarcated by the SLSB and Hibernate SessionFactory knows how to participate in a JTA transaction? I.e., does my DAO class have to extend Spring's HibernateDaoSupport class?
Quote:
Originally Posted by Loumeister
My latest thought is to move the Hibernate session factory into JNDI and use the HibernateUtil that leverages LocalThread to bind the session to the SLSB method call.
So the same question here, do you need Spring at all?
Eric
Re: URGENT HELP NEEDED: EJB CMT to Spring to Hibernate >
After re-read Section 2.3.3 of "Hibernate in Action", my believe grows stronger that with a SLSB (CMT) + DAO (Hibernate) architecture, you don't need to use Spring's declarative TX management functionality at all. The only kind of things Spring's HibernateDaoSupport/HibernateTemplate classes do for you in this case is hiding Hibernate's buildSessionFactory(), openSession(), beginTransaction(), Transaction.commit() etc. calls (of course it also wraps HibernateException into Spring's DataAcessException as well).
Re: URGENT HELP NEEDED: EJB CMT to Spring to Hibernate >
Quote:
Originally Posted by Loumeister
OK, it all makes sense now. What Juergen said is right, because Spring AOP-based TX does not add anything extra on top of what Hibernate already does in terms of supporting JTA.
So back to your original exception thrown by WL Integration - you probably want to see what happens in the JMS part (I know it is not your code). Also, you may want to take Spring completely out of the picture while debugging to eliminate the number of variables.