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.  [ 6 posts ] 
Author Message
 Post subject: Unable to retrieve UserTransaction from JNDI
PostPosted: Thu Jun 24, 2004 6:49 pm 
Newbie

Joined: Thu Jun 24, 2004 6:33 pm
Posts: 2
Location: Calabasas, CA
I am trying to get Hibernate 2.1 up and running under WebSphere 5.1 (the Test Server version in WSAD). I would like to use JTA transactions. However, whenever I call one of my session EJBs, I get the following exception:

[6/24/04 15:44:47:056 PDT] 54b11b7a Helpers W NMSV0605W: A Reference object looked up from the context "localhost/nodes/localhost/servers/server1" with the name "jta/usertransaction" was sent to the JNDI Naming Manager and an exception resulted. Reference data follows:
Reference Factory Class Name: com.ibm.ejs.jts.jta.UtxJNDIFactory
Reference Factory Class Location URLs: <null>
Reference Class Name: java.lang.Object

Exception data follows:
javax.naming.ConfigurationException
at com.ibm.ejs.jts.jta.UtxJNDIFactory.getObjectInstance(UtxJNDIFactory.java:90)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:313)
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookup(Helpers.java:884)
at com.ibm.ws.naming.jndicos.CNContextImpl.processResolveResults(CNContextImpl.java:1762)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1615)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1525)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1225)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:132)
at javax.naming.InitialContext.lookup(InitialContext.java:359)
at net.sf.hibernate.transaction.JTATransaction.begin(JTATransaction.java:132)
at net.sf.hibernate.transaction.JTATransactionFactory.beginTransaction(JTATransactionFactory.java:58)
at net.sf.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:2227)
at com.sellcore.service.user.UserBean.createUserFromCredentials(UserBean.java:111)
at


and so on.

My hibernate.cfg.xml looks like this:

Code:
<hibernate-configuration>

    <!-- a SessionFactory instance listed as /jndi/name -->
    <session-factory name="hibernate/SessionFactory">

        <!-- properties -->
        <!--property name="connection.datasource">my/first/datasource</property-->
        <property name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property>
      <property name="connection.username">kkeigwin</property>
      <property name="connection.password"></property>
      <property name="connection.url">
         jdbc:microsoft:sqlserver://TEMPSERVER:1433;DatabaseName=kkeigwindb;SelectMethod=cursor
      </property>
      <property name="connection.driver_class">
         com.microsoft.jdbc.sqlserver.SQLServerDriver
      </property>
        <property name="show_sql">false</property>
        <property name="use_outer_join">true</property>
        <property name="transaction.factory_class">
            net.sf.hibernate.transaction.JTATransactionFactory
        </property>
        <property name="jta.UserTransaction">jta/usertransaction</property>
        <!--property name="transaction.manager_lookup_class">net.sf.hibernate.transaction.WebSphereTransactionManagerLookup</property-->

        <!-- mapping files -->
        <mapping resource="com/sellcore/service/user/package.hbm.xml"/>

    </session-factory>

</hibernate-configuration>


(Sorry if the formatting makes this hard to read.)

I have tried using the net.sf.hibernate.transaction.WebSphereTransactionManagerLookup class instead of specifying the jta.UserTransaction property, with the result being that the wrong JNDI name is used, so I think I am closer with the current config.

I have verified that the context name for UserTransaction in my appserver is correct (i.e. jta/usertransaction). But I do not know much about JNDI references, and would like to know if someone can explain why this exception is occurring.

Thanks in advance for any help.

_________________
Kevin Keigwin


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 24, 2004 7:00 pm 
Newbie

Joined: Thu Jun 24, 2004 6:33 pm
Posts: 2
Location: Calabasas, CA
Maybe I can answer my own question if I understand this: Do I need to configure UserTransaction if I want to use CMT?

_________________
Kevin Keigwin


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 26, 2004 5:02 am 
Newbie

Joined: Mon Dec 06, 2004 5:51 am
Posts: 8
Location: Istanbul/Turkiye
First, you're right. You have to configure for usertransaction if you want to use CMT because (if I'm not wrong) in order to hibernate to participate into container transaction it uses UserTransaction interface. Websphere says that it bound UserTransaction interface to java:comp/UserTransaction. And Hibernate looks this JNDI as default. So if you use Websphere 5.1 you don't have to configure explicitly.

But in Websphere 5.1 we also live the same problem, "comp/UserTransaction could not be found under java:" exception. But I'm already debugging in the Hibernate code and looking for what is wrong about Websphere JNDI bindings... As soon as I find I'll write it in the forum.

_________________
thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 04, 2005 2:51 pm 
Newbie

Joined: Tue Jan 11, 2005 2:26 pm
Posts: 15
I read a websphere article which said that they no longer support lookup of the JTA UserTransaction via "jta/usertransaction".

"Earlier versions of WebSphere Application Server, up to and including 3.5.x (without EJB 1.1), bind the UserTransaction interface to a JNDI location of jta/usertransaction. WebSphere Application Server Version 4, and later releases, bind the UserTransaction interface at the location defined by EJB 1.1, which is java:comp/UserTransaction. WebSphere Application Server, Version 5 no longer provides the jta/usertransaction binding within Web and EJB containers to applications at a J2EE level of 1.3 or later."

Additionally:

"A web component or enterprise bean (CMT or BMT) can get the ExtendedJTATransaction interface through a lookup of java:comp/websphere/ExtendedJTATransaction. This interface provides access to the transaction identity and a mechanism to receive notification of transaction completion."

-Ben


Top
 Profile  
 
 Post subject: it's now a Jira issue
PostPosted: Mon Feb 07, 2005 3:50 am 
Newbie

Joined: Mon Dec 06, 2004 5:51 am
Posts: 8
Location: Istanbul/Turkiye
Now there is a JIRA issue for this topic:

http://opensource.atlassian.com/projects/hibernate/browse/HB-1354

_________________
thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 5:39 pm 
Newbie

Joined: Thu Mar 30, 2006 5:01 pm
Posts: 1
Change the JNDI lookup name and it should work.

<property name="jta.UserTransaction">java:comp/UserTransaction</property>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.