Announcement Announcement Module
Collapse
No announcement yet.
Not able to configure JTA Transaction Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Not able to configure JTA Transaction

    hi,

    Iam using JBoss 3.2.7, hibernate 2.1.6 and Spring framework 1.2.1
    I have set transaction-type as container in ejb-jar.xml.
    Here is how the transaction manager is configured in applicationContext.xml:

    <!-- Transaction manager that delegates to JTA (for a transactional JNDI DataSource) -->
    <bean id="transactionManager"
    class="org.springframework.transaction.jta.JtaTran sactionManager">
    <property name="transactionManagerName"><value>java:/TransactionManager</value></property>
    </bean>


    But I get the following exception, I have struggled almost two days before deciding to seek help. I would really appreciate your help.

    Error creating bean with name 'transactionManager' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.transaction.TransactionSystemE xception: JTA UserTransaction is not available at JNDI location [java:comp/UserTransaction]; nested exception is javax.naming.NameNotFoundException: UserTransaction not bound
    org.springframework.transaction.TransactionSystemE xception: JTA UserTransaction is not available at JNDI location [java:comp/UserTransaction]; nested exception is javax.naming.NameNotFoundException: UserTransaction not bound
    javax.naming.NameNotFoundException: UserTransaction not bound
    at org.jnp.server.NamingServer.getBinding(NamingServe r.java:490)
    at org.jnp.server.NamingServer.getBinding(NamingServe r.java:498)
    at org.jnp.server.NamingServer.getObject(NamingServer .java:504)
    at org.jnp.server.NamingServer.lookup(NamingServer.ja va:277)
    at org.jnp.interfaces.NamingContext.lookup(NamingCont ext.java:606)
    at org.jnp.interfaces.NamingContext.lookup(NamingCont ext.java:697)
    at org.jnp.interfaces.NamingContext.lookup(NamingCont ext.java:568)
    at javax.naming.InitialContext.lookup(Unknown Source)
    at org.springframework.jndi.JndiTemplate$1.doInContex t(JndiTemplate.java:123)
    at org.springframework.jndi.JndiTemplate.execute(Jndi Template.java:85)
    at org.springframework.jndi.JndiTemplate.lookup(JndiT emplate.java:121)
    at org.springframework.jndi.JndiTemplate.lookup(JndiT emplate.java:146)
    at org.springframework.transaction.jta.JtaTransaction Manager.lookupUserTransaction(JtaTransactionManage r.java:459)
    at org.springframework.transaction.jta.JtaTransaction Manager.afterPropertiesSet(JtaTransactionManager.j ava:372)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:962)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:354)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:223)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:147)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:277)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:312)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:80)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:65)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:56)
    at com.sleek.satori.persistence.dao.DAOLocator.getSpr ingReportDAO(DAOLocator.java:203)
    at com.sleek.satori.report.ejb.report.ReportMgrEJB.ge tReportById(ReportMgrEJB.java:91)
    at com.sleek.satori.report.ejb.report.ReportMgrBean.g etReportById(ReportMgrBean.java:72)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.jboss.ejb.StatelessSessionContainer$ContainerI nterceptor.invoke(StatelessSessionContainer.java:6 83)
    at org.jboss.resource.connectionmanager.CachedConnect ionInterceptor.invoke(CachedConnectionInterceptor. java:186)
    at org.jboss.ejb.plugins.StatelessSessionInstanceInte rceptor.invoke(StatelessSessionInstanceInterceptor .java:72)
    at org.jboss.ejb.plugins.AbstractTxInterceptor.invoke Next(AbstractTxInterceptor.java:84)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTran sactions(TxInterceptorCMT.java:317)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxIn terceptorCMT.java:150)
    at org.jboss.ejb.plugins.SecurityInterceptor.invoke(S ecurityInterceptor.java:111)
    at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInt erceptor.java:192)
    at org.jboss.ejb.plugins.ProxyFactoryFinderIntercepto r.invoke(ProxyFactoryFinderInterceptor.java:122)
    at org.jboss.ejb.StatelessSessionContainer.internalIn voke(StatelessSessionContainer.java:331)
    at org.jboss.ejb.Container.invoke(Container.java:709)
    at sun.reflect.GeneratedMethodAccessor113.invoke(Unkn own Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.jboss.mx.server.ReflectedDispatcher.dispatch(R eflectedDispatcher.java:60)
    at org.jboss.mx.server.Invocation.dispatch(Invocation .java:62)
    at org.jboss.mx.server.Invocation.dispatch(Invocation .java:54)
    at org.jboss.mx.server.Invocation.invoke(Invocation.j ava:82)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(Ab stractMBeanInvoker.java:198)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:473)
    at org.jboss.invocation.local.LocalInvoker.invoke(Loc alInvoker.java:97)
    at org.jboss.invocation.InvokerInterceptor.invokeLoca l(InvokerInterceptor.java:115)
    at org.jboss.invocation.InvokerInterceptor.invoke(Inv okerInterceptor.java:101)
    at org.jboss.proxy.TransactionInterceptor.invoke(Tran sactionInterceptor.java:46)
    at org.jboss.proxy.SecurityInterceptor.invoke(Securit yInterceptor.java:55)
    at org.jboss.proxy.ejb.StatelessSessionInterceptor.in voke(StatelessSessionInterceptor.java:100)
    at org.jboss.proxy.ClientContainer.invoke(ClientConta iner.java:86)
    at $Proxy198.getReportById(Unknown Source)
    at com.sleek.satori.report.ui.bd.ReportMgrBDImpl.getR eportById(ReportMgrBDImpl.java:64)
    at com.sleek.satori.report.ui.action.ReportAction.vie w(ReportAction.java:205)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.struts.actions.DispatchAction.dispatchM ethod(DispatchAction.java:280)
    at org.apache.struts.actions.DispatchAction.execute(D ispatchAction.java:216)
    at org.apache.struts.action.RequestProcessor.processA ctionPerform(RequestProcessor.java:484)
    at com.sleek.satori.common.ui.action.SatoriRequestPro cessor.processActionPerform(SatoriRequestProcessor .java:43)
    at org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
    at com.sleek.satori.common.ui.filter.LoginFilter.doFi lter(LoginFilter.java:104)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHeaderFilter.java:75)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:214)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardContextValve.invo keInternal(StandardContextValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:152)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.jboss.web.tomcat.security.CustomPrincipalValve .invoke(CustomPrincipalValve.java:66)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
    at org.jboss.web.tomcat.security.SecurityAssociationV alve.invoke(SecurityAssociationValve.java:162)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:137)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:118)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
    at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:520)
    at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:929)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:160)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:799)
    at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:705)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:577)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Unknown Source)

    Thanks,
    seema

  • #2
    The afterPropertiesSet method in JTATransaction has a sinppet like this

    if (this.userTransaction == null) {
    if (this.userTransactionName != null) {
    this.userTransaction = lookupUserTransaction(this.userTransactionName);
    }
    else {
    this.userTransaction = retrieveUserTransaction();
    }
    }

    // Fetch JTA TransactionManager from JNDI, if necessary.
    if (this.transactionManager == null) {
    if (this.transactionManagerName != null) {
    this.transactionManager = lookupTransactionManager(this.transactionManagerNa me);
    }
    else {
    this.transactionManager = retrieveTransactionManager();
    }
    }

    So the userTransactionName has to be set to null, for the global transaction to be looked up, don't know if anybody else have encountered the same problem.

    <bean id="transactionManager"
    class="org.springframework.transaction.jta.JtaTran sactionManager">
    <property name="userTransactionName"><null /></property>
    <property name="transactionManagerName"><value>java:/TransactionManager</value></property>
    </bean>

    Comment

    Working...
    X