3 Replies Latest reply on Nov 4, 2008 5:49 PM by denisputnam

    TravelAgentBean not bound?

    denisputnam

      Hi,

      I am getting a NameNotFoundException from the Client main method. I am running MyEclipse6.5, jdk5.0, and jboss-4.2.3.GA.

      <persistence-unit name="TitanCruisesPU" transaction-type="JTA">
      <jta-data-source>java:MySqlDS</jta-data-source>
      </persistence-unit>

      Here is the code:

      public static Context getInitialContext() throws javax.naming.NamingException
      {
      Properties p = new Properties();
      // Specify the JNDI properties specific to JBOSS
      p.put( Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory" );
      p.put( Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" );
      p.put( Context.PROVIDER_URL, "jnp://localhost:1099" );
      InitialContext initContext = new InitialContext(p);
      return initContext;
      }


      Here is the error:

      javax.naming.NameNotFoundException: TravelAgentBean not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
      org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
      ...
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at com.titan.clients.Client.main(Client.java:30)

        • 1. Re: TravelAgentBean not bound?
          jaikiran

          I guess you are using an incorrect jndi name for the bean lookup. Use the jmx-console to view the JNDI tree http://www.jboss.org/community/docs/DOC-9583 and then see to what jndi-name, your bean is bound. Then in your code use that jndi-name for lookup.

          • 2. Re: TravelAgentBean not bound?
            denisputnam

            Hi Jaikiran,

            Thank you for getting back to me. I am still having trouble connecting the dots. Below it the output of the JMX console. Given this information, what pieces to I need to apply to what files or code to get my bean to be bound? I see the "persistence.units:jar" entry and that is what is in my persistence.xml file, but the getInitialContext() method is failing. Do I need to change one of the p.put() calls?

            Global JNDI Namespace

            +- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)
            +- jmx (class: org.jnp.interfaces.NamingContext)
            | +- invoker (class: org.jnp.interfaces.NamingContext)
            | | +- RMIAdaptor (proxy: $Proxy47 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface 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: $Proxy15 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
            +- HTTPConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
            +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
            +- TransactionSynchronizationRegistry (class: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple)
            +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
            +- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
            +- TravelAgent (class: org.jnp.interfaces.NamingContext)
            | +- remote (proxy: $Proxy69 implements interface com.titan.travelagent.TravelAgentRemote,interface org.jboss.ejb3.JBossProxy)
            +- 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: $Proxy48 implements interface org.jboss.console.manager.PluginManagerMBean)
            +- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
            +- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory)
            +- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
            +- persistence.units:jar=TitanCruises.jar,unitName=TitanCruisesPU (class: org.hibernate.impl.SessionFactoryImpl)
            +- QueueConnectionFactory (class: org.jboss.naming.LinkRefPair)
            +- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory)



            • 3. Re: TravelAgentBean not bound?
              denisputnam

              Okay, I am a knuckle head. I had to change "TravelAgentBean/remote" to "TravelAgent/remote". Sometimes you just can't see things right in front of you. Now I have to go figure out what I missed in the book to end up with a TravelAgent class rather than the TravelAgentBean class.