Hi David,

I changed the transaction-type from Container to Bean. I wonder why the jBPM 
people have Container as transaction type in their ejb-jar.xml. With the bean 
transaction-type it works.

I have debugged also into the code, regarding the UserTransaction. The 
hibernate JTATransaction always tries to lookup a UserTransaction in its 
constructor:


        public JTATransaction(
                        InitialContext context,
                        String utName,
                        JDBCContext jdbcContext,
                        TransactionFactory.Context transactionContext
        ) {
                this.jdbcContext = jdbcContext;
                this.transactionContext = transactionContext;

                log.debug("Looking for UserTransaction under: " + utName);

                try {
                        ut = (UserTransaction) context.lookup(utName);
                }
                catch (NamingException ne) {
                        log.error("Could not find UserTransaction in JNDI", ne);
                        throw new TransactionException("Could not find 
UserTransaction in JNDI: ", ne);
                }
                if (ut==null) {
                        throw new AssertionFailure("A naming service lookup 
returned null");
                }

                log.debug("Obtained UserTransaction");
        }

So it seems to me that hibernate don't use the TxLookup, and uses instead a 
UserTransaction.

Wow, that was a long way to come to this point. David, thank you very much.

Regards
Marco


-----Ursprüngliche Nachricht-----
Von: David Blevins [mailto:[email protected]]
Gesendet: Mittwoch, 25. März 2009 04:01
An: [email protected]
Betreff: Re: AW: AW: AW: AW: AW: How to use JBPM with openEJB?


On Mar 23, 2009, at 8:49 AM, <[email protected]> 
<[email protected]  > wrote:

> Hi David,
>
> I changed the value as you suggested, and run into the next exception.
> Now the user transaction is missing.
>
> Caused by: javax.naming.NameNotFoundException: Name "java:comp/
> UserTransaction" not found.
>        at
> org
> .apache.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java:
> 172)
>        at
> org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:
> 129)
>        at javax.naming.InitialContext.lookup(InitialContext.java:351)
>        at
> org.hibernate.transaction.JTATransaction.<init>(JTATransaction.java:
> 60)
>        ... 72 more
>
> If I debug the initial context after start up I get the java:comp/
> UserTransaction. But the initial context inside hibernate, has not
> entry in its context.

That should work if the bean is using bean managed transactions 
(<transaction-type>Bean</transaction-type> in the <session> section of the 
ejb-jar.xml).

It is a little strange that Hibernate would still use a UserTransaction when 
they have a reference to the TransactionManager via the that TxLookup class 
configured in the hibernate.cfg.xml.  Do you have any context for when and 
where this is happening?

-David


Reply via email to