-->
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.  [ 2 posts ] 
Author Message
 Post subject: NameNotFound exception for java:comp/UserTransaction
PostPosted: Wed May 25, 2005 4:40 pm 
Newbie

Joined: Thu May 12, 2005 5:30 pm
Posts: 4
Appears that Hibernate is looking up a specific JNDI name for java:comp/UserTransaction but Jboss has no such name registered.
When we configure and build the settings, hibernate does the register of the JNDI name for the SessionFactory in Jboss initial context. Does it not do the same for UserTransaction? What is the best practice to manually register this USerTransaction in the JNDI tree.

Hibernate version:

3.0

Mapping documents:
Hibernate.cfg.xml:
<property name="hibernate.transaction.manager_lookup_class">
org.hibernate.transaction.JBossTransactionManagerLookup>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>
<property name="hibernate.transaction.flush_before_completion">true</property>
<property name="hibernate.transaction.auto_close_session">true</property>

Code between sessionFactory.openSession() and session.close():

My HibernateUtil is same as in the Sample app

HibernateUtil.beginTransaction();
Session session = HibernateUtil.getSession();
session.saveOrUpdate(obj);
HibernateUtil.commitTransaction();
HibernateUtil.closeSession();


Full stack trace of any exception that occurs:

16:31:55,378 DEBUG [HibernateUtil] Starting new database transaction in this thread.
16:31:55,378 DEBUG [HibernateUtil] Opening new Session for this thread.
16:31:55,378 DEBUG [SessionFactoryObjectFactory] JNDI lookup: hibernate/HibernateFactory
16:31:55,378 DEBUG [SessionFactoryObjectFactory] lookup: uid=8a9481ef04158d870104158dd7400003
16:31:55,378 DEBUG [JDBCContext] successfully registered Synchronization
16:31:55,378 DEBUG [SessionImpl] opened session at timestamp: 4575449560588288
16:31:55,388 DEBUG [JTATransaction] begin
16:31:55,388 DEBUG [JTATransaction] Looking for UserTransaction under: java:comp/UserTransaction
16:31:55,388 ERROR [JTATransaction] Could not find UserTransaction in JNDI
javax.naming.NameNotFoundException: UserTransaction not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
at org.jnp.server.NamingServer.lookup(NamingServer.java:278)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:544)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:658)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:520)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at org.hibernate.transaction.JTATransaction.begin(JTATransaction.java:57)
at org.hibernate.transaction.JTATransactionFactory.beginTransaction(JTATransactionFactory.java:52)
at org.hibernate.jdbc.JDBCContext.beginTransaction(JDBCContext.java:204)
at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1014)


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 25, 2005 5:38 pm 
Newbie

Joined: Thu May 12, 2005 5:30 pm
Posts: 4
Ok, had to change the property name to :
<property name="jta.UserTransaction">UserTransaction</property>
to get past the namenotfound exception. But now I see that nothing is getting committed. I see hibernate printing out the updating instances but no update statements whatsover:
17:30:57,150 DEBUG [HibernateUtil] Starting new database transaction in this thread.
17:30:57,150 DEBUG [HibernateUtil] Opening new Session for this thread.
17:30:57,150 DEBUG [SessionFactoryObjectFactory] JNDI lookup: hibernate/HibernateFactory
17:30:57,150 DEBUG [SessionFactoryObjectFactory] lookup: uid=8a9481ef0415c33d010415c3e6540003
17:30:57,150 DEBUG [JDBCContext] successfully registered Synchronization
17:30:57,150 DEBUG [SessionImpl] opened session at timestamp: 4575464067686400
17:30:57,160 DEBUG [JTATransaction] begin
17:30:57,160 DEBUG [JTATransaction] Looking for UserTransaction under: UserTransaction
17:30:57,160 DEBUG [JTATransaction] Obtained UserTransaction
17:30:57,180 DEBUG [Cascades] version unsaved-value strategy UNDEFINED
17:30:57,180 DEBUG [Cascades] id unsaved-value: null
17:30:57,180 DEBUG [AbstractSaveEventListener] detached instance of: com.realcleartech.model.request.blackBerry.BlackBerryRequest
17:30:57,180 DEBUG [DefaultSaveOrUpdateEventListener] updating detached instance
17:30:57,180 DEBUG [DefaultSaveOrUpdateEventListener] updating [com.realcleartech.model.request.blackBerry.BlackBerryRequest#78]
17:30:57,200 DEBUG [DefaultSaveOrUpdateEventListener] updating [com.realcleartech.model.request.blackBerry.BlackBerryRequest#78]
17:30:57,230 DEBUG [Cascades] version unsaved-value strategy UNDEFINED
17:30:57,230 DEBUG [Cascades] id unsaved-value: null
17:30:57,230 DEBUG [AbstractSaveEventListener] detached instance of: com.realcleartech.model.request.blackBerry.BlackBerryRequestExt0
17:30:57,230 DEBUG [DefaultSaveOrUpdateEventListener] updating detached instance
17:30:57,230 DEBUG [DefaultSaveOrUpdateEventListener] updating [com.realcleartech.model.request.blackBerry.BlackBerryRequestExt0#121]
17:30:57,230 DEBUG [DefaultSaveOrUpdateEventListener] updating [com.realcleartech.model.request.blackBerry.BlackBerryRequestExt0#121]
17:30:57,230 DEBUG [Cascades] version unsaved-value strategy UNDEFINED
17:30:57,230 DEBUG [Cascades] id unsaved-value: null
17:30:57,230 DEBUG [AbstractSaveEventListener] detached instance of: com.realcleartech.model.request.blackBerry.BlackBerryRequestExt1
17:30:57,230 DEBUG [DefaultSaveOrUpdateEventListener] updating detached instance
17:30:57,230 DEBUG [DefaultSaveOrUpdateEventListener] updating [com.realcleartech.model.request.blackBerry.BlackBerryRequestExt1#122]
17:30:57,251 DEBUG [DefaultSaveOrUpdateEventListener] updating [com.realcleartech.model.request.blackBerry.BlackBerryRequestExt1#122]
17:30:57,251 DEBUG [HibernateUtil] Committing database transaction of this thread.
17:30:57,251 DEBUG [JTATransaction] commit
17:30:57,251 DEBUG [HibernateUtil] Closing Session of this thread.
17:30:57,251 DEBUG [SessionImpl] closing session
17:30:57,251 DEBUG [CacheSynchronization] transaction before completion callback
17:30:57,251 DEBUG [CacheSynchronization] automatically flushing session
17:30:57,271 DEBUG [SessionImpl] automatically flushing session
17:30:57,271 DEBUG [JDBCContext] before transaction completion
17:30:57,271 DEBUG [SessionImpl] before transaction completion
17:30:57,271 DEBUG [CacheSynchronization] transaction before completion callback
17:30:57,271 DEBUG [CacheSynchronization] automatically flushing session
17:30:57,271 DEBUG [SessionImpl] automatically flushing session
17:30:57,271 DEBUG [JDBCContext] before transaction completion
17:30:57,271 DEBUG [SessionImpl] before transaction completion
17:30:57,321 DEBUG [CacheSynchronization] transaction after completion callback, status: 3
17:30:57,321 DEBUG [JDBCContext] after transaction completion
17:30:57,321 DEBUG [SessionImpl] after transaction completion
17:30:57,321 DEBUG [CacheSynchronization] transaction after completion callback, status: 3
17:30:57,321 DEBUG [JDBCContext] after transaction completion
17:30:57,321 DEBUG [SessionImpl] after transaction completion


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