Hi, Ivelin!
First of all, thanx for your contribution.
I downloaded/build/deployed/installed jtasession.zip. Everything's
fine. I even get a JTA hibernate session from the factory which works
well.
Now the problem: Before the end of the transaction/SLSB call, JBoss
[CachedConnectionManager] closes the session's connection before
JTASessionSynchronization gets the chance to do so...
DEBUG [JTASessionFactory] implementing transaction class:
org.jboss.tm.TransactionImpl
DEBUG [JTASessionFactory] opening a new Hibernate session for
transaction: TransactionImpl:XidImpl [FormatId=257,
GlobalId=MEDUSA//3, BranchQual=]
DEBUG [JTASessionSynchronization] ctor: tx (TransactionImpl:XidImpl
[FormatId=257, GlobalId=MEDUSA//3, BranchQual=]), sessionMap
({TransactionImpl:XidImpl [FormatId=257, G
lobalId=MEDUSA//3, BranchQual=]
=net.sf.hibernate.impl.SessionImpl@16721bd})
INFO [CachedConnectionManager] Successfully closed a connection for
you. Please close them yourself:
org.jboss.resource.adapter.jdbc.WrappedConnection@14fcd9a
java.lang.Exception: Stack Trace
at
org.jboss.resource.connectionmanager.CachedConnectionManager.closeAll
(CachedConnectionManager.java:376)
at
org.jboss.resource.connectionmanager.CachedConnectionManager.popMetaAwa
reObject(CachedConnectionManager.java:199)
at
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke
(CachedConnectionInterceptor.java:190)
at
org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke
(StatelessSessionInstanceInterceptor.java:72)
....
DEBUG [JTASessionSynchronization] called: beforeCompletion()
DEBUG [JTASessionSynchronization] called: afterCompletion(txStatus (3))
I tried with JBoss 3.2.0/3.2.2RC1 and Hibernate 2.1.1/2.1.2.
Here my simple code:
String jndiName = "java:/hibernate/JTASessionFactory";
InitialContext ctx = new InitialContext();
JTASessionFactory jtaf = (JTASessionFactory)ctx.lookup(jndiName);
Session session = jtaf.getSession();
ProductData data = (ProductData)session.load(ProductData.class, new
Integer(id));
Have I missed a point. Probably configuration problems. I deployed my
hibernate mappings as a sar/mbean with the following service
descriptor:
<mbean
code="net.sf.hibernate.jmx.HibernateService"
name="jboss.jca:service=HibernateFactory,name=NorthwindHibernateFactory
">
<!-- Make it deploy ONLY after DataSource had been started -->
<depends>jboss.jca:service=RARDeployer</depends>
<depends>jboss.jca:service=LocalTxCM,name=northwind</depends>
<attribute name="MapResources">
de/hal9000/northwind/mapping/ProductData.hbm.xml
</attribute>
<attribute
name="JndiName">java:/hibernate/NorthwindHibernateFactory</attribute>
<attribute name="Datasource">java:/northwind</attribute>
<attribute
name="Dialect">net.sf.hibernate.dialect.PostgreSQLDialect</attribute>
<attribute
name="TransactionStrategy">net.sf.hibernate.transaction.JTATransactionF
actory</attribute>
<attribute
name="TransactionManagerLookupStrategy">net.sf.hibernate.transaction.JB
ossTransactionManagerLookup</attribute>
<attribute name="UseOuterJoin">true</attribute>
<attribute name="ShowSql">false</attribute>
<attribute
name="UserTransactionName">java:/UserTransaction</attribute>
</mbean>
Any help is highly appreciated.
Thank you,
Horst |