-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: "comp/UserTransaction" not found when using Websphere
PostPosted: Mon Apr 26, 2010 2:18 am 
Newbie

Joined: Fri Apr 23, 2010 11:16 am
Posts: 2
Hi!

We get the following error when we try to create a Hibernate Session in an EJB:

[2010-04-23 16:21:02:788 CEST] 00000029 webapp E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[HibTestServlet]: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: ; nested exception is:
org.hibernate.TransactionException: Could not find UserTransaction in JNDI:
at com.ibm.CORBA.iiop.UtilDelegateImpl.mapSystemException(UtilDelegateImpl.java:235)
......
Caused by: org.hibernate.TransactionException: Could not find UserTransaction in JNDI:
... 37 more
Caused by: javax.naming.NameNotFoundException: Name "comp/UserTransaction" not found in context "java:".
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1178)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1095)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1233)
.....


It seems like Hibernate tries to look up "java:comp/UserTransaction" for some reason, despite that the EJB is configured to use container as transaction type. We only have this problem when we use Websphere(7.0.0.7). Weblogic, Oracle and JBoss works fine.

Properties used:
hibernate.transaction.manager_lookup_class=org.hibernate.transaction.WebSphereTransactionManagerLookup
hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory
hibernate.dialect=org.hibernate.dialect.SQLServerDialect



Does anyone know what causes this problem or how to get around it? We want to keep JTATransactionFactory if possible since we use Hibernate both for container managed and bean managed transactions.

Any help is welcome :)


Top
 Profile  
 
 Post subject: Re: "comp/UserTransaction" not found when using Websphere
PostPosted: Mon Apr 26, 2010 2:47 am 
Newbie

Joined: Tue Jul 04, 2006 6:18 am
Posts: 8
Try to use org.hibernate.transaction.CMTTransactionFactory instead.

E.g.
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>


Top
 Profile  
 
 Post subject: Re: "comp/UserTransaction" not found when using Websphere
PostPosted: Mon Apr 26, 2010 8:34 am 
Newbie

Joined: Fri Apr 23, 2010 11:16 am
Posts: 2
Unfortunately we get another error if we use CMTTransactionFactory instead. Hibernate says that "getNamedQuery is not valid without active transaction". The method getNamedQuery is invoked from an EJB with container managed transactions.


[2010-04-26 12:47:10:554 CEST] 0000000e LocalExceptio E CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "doCrashRecovery" on bean "BeanId(.........................., null)". Exception data: org.hibernate.HibernateException: getNamedQuery is not valid without active transaction
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:340)
at $Proxy27.getNamedQuery(Unknown Source)
....................


But as we understood it, "org.hibernate.transaction.JTATransactionFactory" should work for both container managed and bean managed transactions:

http://docs.jboss.org/hibernate/stable/ ... onstrategy


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.