Thread:
 Container managed JTA Session Service 
 ivelin   20 Dec 2003, 14:20 
 Re: Container managed JTA Session Service 
 Horst Dehmer   16 Feb 2004, 00:06 
 Re: Container managed JTA Session Service 
 alesj   19 Oct 2004, 10:58 
 Re: Container managed JTA Session Service 
 juice   28 Oct 2004, 19:32 
 Re: Container managed JTA Session Service 
 hengels   17 Feb 2004, 10:02 
 Synchronization problem 
 jdragon   17 Feb 2004, 23:29 
 Re: Synchronization problem 
 TransactionException   24 Apr 2007, 04:41 
 Re: Container managed JTA Session Service 
 hengels   18 Mar 2004, 13:29 
 Re: Container managed JTA Session Service 
 hengels   18 Mar 2004, 14:07 
 Re: Container managed JTA Session Service 
 clcantrell   03 Aug 2006, 08:51 

Comment
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
From: Horst Dehmer (16 Feb 2004, 00:06) Replies: 2, Views: 41552
Subject: Re: Container managed JTA Session Service
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
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
© Copyright 2006, Red Hat Middleware, LLC. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc. [Privacy Policy]