5 Replies Latest reply on Nov 17, 2007 9:17 AM by Brian McGovern

    TransactionManager not bound

    sateesh kumar Newbie

      HI,

      I am using the JBoss-4.0.3 App Server and using Hibernate 3.0.5.

      Hibernate is unable to get the TransactionManager so i wrote a simple JSP to test whether the TransactionManager is available in the JNDI Tree..

      It is showing up in the jmx-console but when i try to get it it's thing not bound Exception !!

      When i try to get the Transaction Manager using the following code i am getting the following Exception

      
      try{
       Hashtable environment = new Hashtable();
       environment.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
       //environment.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
       environment.put(Context.PROVIDER_URL, "jnp://localhost:1099"); // remote machine IP
       InitialContext context = new InitialContext(environment);
       org.jboss.tm.TxManager mgr = (org.jboss.tm.TxManager) context.lookup("java:TransactionManager");
       out.println(" TransactionManager :"+mgr);
       }
       catch(Exception e){
       out.println("Exception ="+e);
       e.printStackTrace();
       }
      
      
      



      The Exception i am getting is :

      javax.naming.NameNotFoundException: TransactionManager not bound
      
      
      13:49:09,328 INFO [STDOUT] javax.naming.NameNotFoundException: TransactionManager not bound
      13:49:09,328 INFO [STDOUT] at org.jnp.server.NamingServer.getBinding(NamingServer.java:514)
      13:49:09,328 INFO [STDOUT] at org.jnp.server.NamingServer.getBinding(NamingServer.java:522)
      13:49:09,328 INFO [STDOUT] at org.jnp.server.NamingServer.getObject(NamingServer.java:528)
      13:49:09,328 INFO [STDOUT] at org.jnp.server.NamingServer.lookup(NamingServer.java:281)
      13:49:09,328 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
      13:49:09,328 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
      13:49:09,328 INFO [STDOUT] at javax.naming.InitialContext.lookup(InitialContext.java:351)
      13:49:09,328 INFO [STDOUT] at org.apache.jsp.dsTest_jsp._jspService(org.apache.jsp.dsTest_jsp:5
      6)
      13:49:09,328 INFO [STDOUT] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97
      )
      13:49:09,328 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      13:49:09,328 INFO [STDOUT] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWra
      pper.java:322)
      13:49:09,328 INFO [STDOUT] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.ja
      va:314)
      13:49:09,328 INFO [STDOUT] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      
      13:49:09,328 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      13:49:09,328 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
      ApplicationFilterChain.java:252)
      13:49:09,328 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicat
      ionFilterChain.java:173)
      13:49:09,328 INFO [STDOUT] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHead
      erFilter.java:81)
      13:49:09,328 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
      ApplicationFilterChain.java:202)
      13:49:09,328 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicat
      ionFilterChain.java:173)
      13:49:09,328 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrap
      perValve.java:213)
      13:49:09,328 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardCont
      extValve.java:178)
      13:49:09,328 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomP
      rincipalValve.java:39)
      13:49:09,328 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Sec
      urityAssociationValve.java:159)
      13:49:09,328 INFO [STDOUT] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContext
      Valve.java:59)
      13:49:09,328 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostVal
      ve.java:126)
      13:49:09,328 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportVal
      ve.java:105)
      13:49:09,328 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngin
      eValve.java:107)
      13:49:09,328 INFO [STDOUT] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter
      .java:148)
      13:49:09,328 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.
      java:856)
      13:49:09,328 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.p
      rocessConnection(Http11Protocol.java:744)
      13:49:09,328 INFO [STDOUT] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpE
      ndpoint.java:527)
      13:49:09,328 INFO [STDOUT] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlav
      eWorkerThread.java:112)
      13:49:09,328 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)
      
      
      
      
      But when i go to the jmx-console and to the JNDI View i see the TransactionManager in the java: Name Space..
      
      Code:
      
      java: Namespace
       +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
       +- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
       +- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
       +- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)
       +- comp (class: javax.naming.Context)
       +- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
       +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
       +- jaas (class: javax.naming.Context)
       | +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext)
       | +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext)
       | +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext)
       +- timedCacheFactory (class: javax.naming.Context)
      Failed to lookup: timedCacheFactory, errmsg=org.jboss.util.TimedCachePolicy
       +- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory
      )
       +- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
       +- Mail (class: javax.mail.Session)
       +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporte
      r)
       +- TransactionManager (class: org.jboss.tm.TxManager)
      Global JNDI Namespace
       +- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)
       +- jmx (class: org.jnp.interfaces.NamingContext)
       | +- invoker (class: org.jnp.interfaces.NamingContext)
       | | +- RMIAdaptor (proxy: $Proxy39 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,i
      nterface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
       | +- rmi (class: org.jnp.interfaces.NamingContext)
       | | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
       +- HTTPXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
       +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
       +- UserTransactionSessionFactory (proxy: $Proxy12 implements interface org.jboss.tm.usertx.interfa
      ces.UserTransactionSessionFactory)
       +- HTTPConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
       +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
       +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
       +- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
       +- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
       +- queue (class: org.jnp.interfaces.NamingContext)
       | +- A (class: org.jboss.mq.SpyQueue)
       | +- testQueue (class: org.jboss.mq.SpyQueue)
       | +- ex (class: org.jboss.mq.SpyQueue)
       | +- DLQ (class: org.jboss.mq.SpyQueue)
       | +- D (class: org.jboss.mq.SpyQueue)
       | +- C (class: org.jboss.mq.SpyQueue)
       | +- B (class: org.jboss.mq.SpyQueue)
       +- topic (class: org.jnp.interfaces.NamingContext)
       | +- testDurableTopic (class: org.jboss.mq.SpyTopic)
       | +- testTopic (class: org.jboss.mq.SpyTopic)
       | +- securedTopic (class: org.jboss.mq.SpyTopic)
       +- console (class: org.jnp.interfaces.NamingContext)
       | +- PluginManager (proxy: $Proxy40 implements interface org.jboss.console.manager.PluginManager
      MBean)
       +- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
       +- jbpmDS (class: javax.sql.DataSource)
       +- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory
      )
       +- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
       +- QueueConnectionFactory (class: org.jboss.naming.LinkRefPair)
       +- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory
      )
      
      
      


      Pls let me know how can i resolve this..

      Thanks
      Sateesh