6 Replies Latest reply on Jun 25, 2002 10:21 PM by joelvogt

    not bound Exception

    cdmdev

      I have created my ejb-jar.xml file as follows:
      *************************************************
      <?xml version="1.0" encoding="Cp1252"?>


      <ejb-jar>
      no description
      <display-name>helloDisplay</display-name>
      <enterprise-beans>

      <display-name>helloEJBDisplay</display-name>
      <ejb-name>helloEJBDisplay</ejb-name>
      hello.HelloHome
      hello.Hello
      <ejb-class>hello.HelloEJB</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Bean</transaction-type>

      </enterprise-beans>
      </ejb-jar>
      ********************************************************
      and my jboss.xml:
      ********************************************************
      <?xml version="1.0" encoding="Cp1252"?>


      <enterprise-beans>

      <ejb-name>helloEJBDisplay</ejb-name>
      <jndi-name></jndi-name>

      </enterprise-beans>

      *********************************************************
      I have JBoss3.0 installed on my linux box. When I deploy the jar file in states that it deploys properly. It gives 2 lines the first saying that it is deploying the jar and the second stating that it was deployed successfully.

      When I run my client on a seperate machine, I have the JNDI properties set as follows:

      Hashtable env = new Hashtable();

      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");

      env.put(Context.PROVIDER_URL, "cdmdev4:1099");

      env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" );

      Context jndiContext = new InitialContext(env);


      When I do a lookup with the following line of code:

      Object ref = jndiContext.lookup("helloEJBDisplay");

      It says that 'helloEJBDisply not bound'.

      I have the JNDI documentation from JBoss, but I do not seem to know how to get JBoss to register the name with JNDI? Any help would be greatly appreciated. Thanks.

      Brent

        • 1. Re: not bound Exception
          toddhunter

          I think the problem is in your jboss.xml

          --
          <ejb-name>helloEJBDisplay</ejb-name>
          <jndi-name></jndi-name>
          --

          If you are doing

          Object ref = jndiContext.lookup("helloEJBDisplay");

          have tag,value : <jndi-name>helloEJBDisplay</jndi-name>

          The rest looks okay

          • 2. Re: not bound Exception
            cdmdev

            Thanks for the suggestion, but I have tried that as well. I also coppied a hello world ejb example straight from a book to verify that I did not mess up something in my code. I get the same not bound exception. I am at a loss as to what could be the problem. It seems that the jar file is being deployed, but it does not register the bean for some reason. We are not required to have a web.xml file right, I thought we didn't even need to have a jboss.xml file.

            Does anyone know why a bean might not be registered? But the jar deployment is successful? Thanks in advance.

            Brent

            • 3. Re: not bound Exception
              joelvogt

              mok, Can try a few more things,

              look at http://<your-server>:8082

              and make sure that your jndi name is there, should be something like

              jndiName=helloEJBDisplay

              You might also try with your initial context adding the property
              env.put("java.naming.rmi.security.manager", "yes");

              Btw, is the jndi lookup from within JBOSS (same jvm) or an external client?

              • 4. Re: not bound Exception
                cdmdev

                I am running the client from another VM, not JBoss. I am pointing it to the JBossNS though, see code:
                *******************************************************
                Hashtable env = new Hashtable();
                env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                env.put(Context.PROVIDER_URL, "localhost");
                env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" );
                env.put("java.naming.rmi.security.manager", "yes");
                Context jndiContext = new InitialContext(env);

                //System.out.println("before initContext");
                //InitialContext jndiContext = new InitialContext();
                System.out.println("before lookup");
                Object ref = jndiContext.lookup("Hello");
                System.out.println("after lookup");

                ********************************************************
                Also, I looked at 8082 on localhost, and I can not see my bean. I see the ones that JBoss deploys upon startup, but not mine.

                Could it be a problem with how I start it up? I do not see any exceptions on startup, I issue run (I have it both on Linux and Windows) and I have the same symptoms. It deploys but does not register my bean.

                I created a simple HelloWorld bean straight from the book. does anyone have a simple code that deploys in their JBoss 3.0 that they can send me, inlcuding the xml files (bvbenson@hotmail.com)? Maybe it is a configuration issue with JBoss?

                Any more ideas? Thanks for all the replys I appreciate all your help.

                Brent

                • 5. Re: not bound Exception
                  cdmdev

                  Hey guys, thanks. I found my problem...It was that I had Ejb-jar.xml and not ejb-jar.xml. For some reason windows automatically capitalizes my file names. Thanks for all your help.

                  • 6. Re: not bound Exception
                    joelvogt

                    he he, good old windows. glad your up and running