2 Replies Latest reply on Jan 14, 2005 11:05 AM by John Vandale

    jndi-name not recognized, JBoss uses bean name for global JN

    John Vandale Newbie

      Successfully deployed my .ear. The jboss.xml has:


      <ejb-name>Foo</ejb-name>
      <jndi-name>ejb/foo/FooHome</jndi-name>


      My external client program doing the lookup does:

      Object homeObj = ctx.lookup("/ejb/foo/FooHome");

      This results in the ubiquitous exception:

      javax.naming.NameNotFoundException: ejb not bound


      By all ways I have checked (JMX Console JNDIView, JBoss Web Console bean view, Eclipse JNDI Explorer plugin) JBoss is setting the global JNDI name to Foo rather than /ejb/foo/FooHome.

      I'm sure I can get this to work by changing my program to ctx.lookup("Foo") but that's not fixing the root of the problem. For reasons specific to my application that I won't bore you with here I want client programs to use the ejb/foo/WhateverTheName for lookups.

      Why is JBoss seemingly not recognizing my specified jndi-name values in jboss.xml? I have seen tons of posts and answers related to "ejb not bound" but the cause in all cases is the person using something else in the lookup call. My pending solution is the opposite, I want to change the JBoss notion of the global JNDI name to match my lookup.

      I have tried adding:

      <local-jndi-name>ejb/foo/FooHome</local-jndi-name>

      to my jboss.xml based on what I saw in a post and it didn't fix the problem. It gives the same error. Nor did this seem like the right solution jndi-name should be sufficient. There's something else that must need to be done for JBoss to "see" it.

      Thanks,

      John

        • 1. Re: jndi-name not recognized, JBoss uses bean name for globa
          Darran Lofthouse Master

          Are you sure that your jboss.xml file is in your jar in the same location as the ejb-jar.xml?

          It looks as if JBoss is not seeing the configuration file, rather than ignoring a specific setting in the file.

          • 2. Re: jndi-name not recognized, JBoss uses bean name for globa
            John Vandale Newbie

            Yes. I just double checked that. jboss.xml and ejb-jar.xml are at the same location. For a really base test case I deployed the JBossDukesBank.ear I built using the JBoss getting started tutorial. This reveals the same problem, the names listed in the global JNDI namespace are the bean names not the names specified as jndi-name in the jboss.xml. For example:

            <ejb-name>CustomerBean</ejb-name>
            <jndi-name>MyCustomer</jndi-name>

            The JMX Console ->JNDIView ->list() under GlobalJNDI Namespace shows:

            +- local (class: org.jnp.interfaces.NamingContext)
            | +- CustomerBean (proxy: $Proxy54 implements interface com.sun.ebank.ejb.customer.CustomerHome)

            MyCustomer does not appear anywhere on that JNDIView list() page