-->
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.  [ 4 posts ] 
Author Message
 Post subject: TransactionException: Could not find UserTransaction in JNDI
PostPosted: Fri Oct 07, 2005 8:07 am 
Newbie

Joined: Fri Aug 05, 2005 10:38 am
Posts: 11
Hi,

i developed with 4.0.3RC1+RC2 and all works fine. Today i tried to deploy my application to 4.0.3 release and i get an exception.

In some way Hibernate TransactionFactory cannot create a Transaction because the Factory doesn´t find something via JNDI...

My jboss-service.xml looks like this:


Code:
<server>
   <mbean code="org.jboss.hibernate.jmx.Hibernate"
      name="jboss.har:service=Hibernate">
      <depends>jboss:service=Naming</depends>
      <depends>jboss:service=TransactionManager</depends>
      <depends>jboss.jca:service=DataSourceBinding,name=documentarchiv</depends>
      <attribute name="DatasourceName">java:/documentarchiv</attribute>
      <attribute name="Dialect">org.hibernate.dialect.MySQLDialect</attribute>
      <attribute name="SessionFactoryName">java:/hibernate/DocumentArchivSessionFactory</attribute>
      <attribute name="CacheProviderClass">org.hibernate.cache.NoCacheProvider</attribute>
      <attribute name="ShowSqlEnabled">true</attribute>
   </mbean>
</server>



The source looks like this:

Code:
nitialContext ctx = new InitialContext();

SessionFactory sf = (SessionFactory)ctx.lookup("java:/hibernate/DocumentArchivSessionFactory");

Session hs = sf.getCurrentSession();
Transaction tx = hs.beginTransaction();

UserHBM user = (UserHBM) hs.get(UserHBM.class, principal.getUserid());

tx.commit();
hs.close();


Perhaps someone has the same problem and can give me some hints.
Thx very much..


Regards


Peter




The Exception Stacktrace looks like this:

Code:
2005-10-06 14:10:04,015 DEBUG [org.hibernate.impl.SessionFactoryObjectFactory] JNDI lookup: hibernat
e/DocumentArchivSessionFactory
2005-10-06 14:10:04,015 DEBUG [org.hibernate.impl.SessionFactoryObjectFactory] lookup: uid=013bb3480
6c5d6350106c5d682d00001
2005-10-06 14:10:04,062 DEBUG [org.hibernate.jdbc.JDBCContext] successfully registered Synchronizati
on
2005-10-06 14:10:04,062 DEBUG [org.hibernate.impl.SessionImpl] opened session at timestamp: 11286006
040
2005-10-06 14:10:04,062 DEBUG [org.hibernate.transaction.JTATransaction] Looking for UserTransaction
under: java:comp/UserTransaction
2005-10-06 14:10:04,062 ERROR [org.hibernate.transaction.JTATransaction] Could not find UserTransact
ion in JNDI
javax.naming.NameNotFoundException: UserTransaction not bound
   at org.jnp.server.NamingServer.getBinding(NamingServer.java:514)
   at org.jnp.server.NamingServer.getBinding(NamingServer.java:522)
   at org.jnp.server.NamingServer.getObject(NamingServer.java:528)
   at org.jnp.server.NamingServer.lookup(NamingServer.java:281)
   at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
   at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:701)
   at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
   at javax.naming.InitialContext.lookup(InitialContext.java:351)
   at org.hibernate.transaction.JTATransaction.<init>(JTATransaction.java:60)
   at org.hibernate.transaction.JTATransactionFactory.createTransaction(JTATransactionFactory.java:53)

   at org.hibernate.jdbc.JDBCContext.getTransaction(JDBCContext.java:190)
   at org.hibernate.impl.SessionImpl.getTransaction(SessionImpl.java:1197)
   at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1204)
   at de.absoft.documentarchiv.ejb.LoginManager.login(LoginManager.java:217)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
   at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.ja
va:214)
   at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionIntercep
tor.java:149)
   at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterce
ptor.java:154)
   at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:54
)
   at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
   at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)
   at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
   at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
   at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:153)
   at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
   at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:12
2)
   at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
   at org.jboss.ejb.Container.invoke(Container.java:873)
   at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:415)
   at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:88)
   at $Proxy86.login(Unknown Source)
   at de.absoft.documentarchiv.util.LoginManagerUtil.login(LoginManagerUtil.java:81)
   at de.absoft.documentarchiv.web.filter.LoginFilter.doFilter(LoginFilter.java:45)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202
)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202
)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)

   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol
.java:744)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
   at java.lang.Thread.run(Thread.java:595)
2005-10-06 14:10:04,062 DEBUG [org.hibernate.transaction.CacheSynchronization] transaction after com
pletion callback, status: 4
2005-10-06 14:10:04,062 DEBUG [org.hibernate.jdbc.JDBCContext] after transaction completion
2005-10-06 14:10:04,062 DEBUG [org.hibernate.impl.SessionImpl] after transaction completion
2005-10-06 14:10:04,062 DEBUG [org.hibernate.transaction.CacheSynchronization] automatically closing
session
2005-10-06 14:10:04,062 DEBUG [org.hibernate.impl.SessionImpl] automatically closing session
2005-10-06 14:10:04,062 DEBUG [org.hibernate.impl.SessionImpl] closing session
2005-10-06 14:10:04,062 ERROR [org.jboss.ejb.plugins.LogInterceptor] RuntimeException in method: pub
lic abstract boolean de.absoft.documentarchiv.interfaces.LoginManagerLocal.login(de.absoft.documenta
rchiv.security.DAPrincipal) throws de.absoft.documentarchiv.exception.SystemException:
org.hibernate.TransactionException: Could not find UserTransaction in JNDI:
   at org.hibernate.transaction.JTATransaction.<init>(JTATransaction.java:64)
   at org.hibernate.transaction.JTATransactionFactory.createTransaction(JTATransactionFactory.java:53)

   at org.hibernate.jdbc.JDBCContext.getTransaction(JDBCContext.java:190)
   at org.hibernate.impl.SessionImpl.getTransaction(SessionImpl.java:1197)
   at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1204)
   at de.absoft.documentarchiv.ejb.LoginManager.login(LoginManager.java:217)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
   at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.ja
va:214)
   at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionIntercep
tor.java:149)
   at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterce
ptor.java:154)
   at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:54
)
   at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
   at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)
   at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
   at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
   at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:153)
   at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
   at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:12
2)
   at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
   at org.jboss.ejb.Container.invoke(Container.java:873)
   at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:415)
   at org.jboss.ejb.plugins.local.StatelessSessionProxy.invoke(StatelessSessionProxy.java:88)
   at $Proxy86.login(Unknown Source)
   at de.absoft.documentarchiv.util.LoginManagerUtil.login(LoginManagerUtil.java:81)
   at de.absoft.documentarchiv.web.filter.LoginFilter.doFilter(LoginFilter.java:45)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202
)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202
)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)

   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol
.java:744)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
   at java.lang.Thread.run(Thread.java:595)


Top
 Profile  
 
 Post subject: Having same problem
PostPosted: Wed Oct 12, 2005 2:30 am 
Newbie

Joined: Wed Oct 12, 2005 2:26 am
Posts: 1
For the record, I've got an identical situation. My JBoss/Hibernate application gets that same UserTransation error the moment we try a Hibernate beginTransaction() call. Our application runs fine on 4.0.2 and I was just trying to see if it would deploy identically on 4.0.3.

I guess not yet.

If there's any additional information I can provide, just ask.

Murray Todd Williams


Top
 Profile  
 
 Post subject: Issue resolved
PostPosted: Mon Oct 17, 2005 11:56 pm 
Newbie

Joined: Sat Oct 08, 2005 2:24 pm
Posts: 4
I was scratching my head with one as well. I've got it resolved, the JNDI is retrieved from org.hibernate.transaction.JBossTransactionManagerLookup.

Replace "java:comp/UserTransaction" with "UserTransaction" in getUserTransactionName()

I am not sure how to get this patched into main release or if this is even correct. But with the change I have JBoss 4.0.3 running with Hibernate 3.1 rc2 talking with both Hypersonic and Mysql.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 7:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Oddly enough, this was explicitly changed within the Hibernate source. I'll have a look into this:
http://opensource2.atlassian.com/projec ... e/HHH-1062

In the meantime, the easiest solution would be to appropriately set the 'jta.UserTransaction' Hibernate config property. Unfortunately, that is not exposed in the JBoss integration code.


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