7 Replies Latest reply on May 19, 2005 6:59 AM by waglik

    javax.naming.NameNotFoundException: ModelEJB not bound

    waglik

      Hello I write simple client :
      public class Proba {

      private static final String JNDI_NAME = "ModelEJB";

      public static void main(String[] args) throws NamingException {

      InitialContext ctx = new InitialContext();
      Object obj = ctx.lookup(JNDI_NAME);
      }
      }

      I put EJB jar into default/deploy folder ...

      what is wrong?

        • 1. Re: javax.naming.NameNotFoundException: ModelEJB not bound
          darranl

          You are starting at the wrong point when trying to resolve this problem. A 'NameNotFoundException' usually without fail means that it is not bound.

          Remove everything that you have currently deployed
          Restart JBoss
          Deploy your jar containing the ejb
          Check the console to see if any errors are reported
          Open jmx_console and use the JNDI View MBean to list the contents of JNDI, confirm that your bean is bound and check the name.

          It is only at this point that you are ready to run a client application to access the bean.

          • 2. Re: javax.naming.NameNotFoundException: ModelEJB not bound
            waglik

            Well JNDI View do not find my bean but console do not return errors

            • 3. Re: javax.naming.NameNotFoundException: ModelEJB not bound
              darranl

              The fact your bean is not displayed in JNDI View means that your bean is not deployed.


              How do you start JBoss?

              What is displayed on the console when you deploy your jar file?

              Can you please extract your jar file and show the complete contents here.

              What does your ejb-jar.xml look like?

              • 4. Re: javax.naming.NameNotFoundException: ModelEJB not bound
                waglik

                I run Jboss by runing run.bat .
                When I copy wybory.jar into ...\server\default\deploy there is no signal on the console.

                When I unpack it I have 2 directories :
                Meta-inf
                |------Manifest.mf
                |------ejb-jar.xml
                org
                |-----ejb
                |----wybory
                |-------Model.class
                |-------ModelBean.class
                |-------ModelHome.class

                the ejb-jar.xml looks like this :
                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
                <ejb-jar>
                <enterprise-beans>

                Dane
                <display-name>Model</display-name>
                <ejb-name>ModelEJB</ejb-name>
                org.ejb.wybory.ModelHome
                org.ejb.wybory.Model
                <ejb-class>org.ejb.wybory.ModelBean</ejb-class>
                <session-type>Stateful</session-type>
                <transaction-type>Container</transaction-type>

                </enterprise-beans>
                </ejb-jar>

                I am using Jboss 4.0.1

                • 5. Re: javax.naming.NameNotFoundException: ModelEJB not bound
                  darranl

                  Is that really the name of the folder that contains the ejb-jar.xml? It should be 'META-INF'.

                  The lack of output on the console suggests that the ejb-jar.xml is not found in 'META-INF' and this is why the bean is not deploying.

                  If you have a look in server/default/log/server.log the last entries will show you if the jar was seen and what happened during deplyment. If you see a line near the end saying: -

                  DEBUG [org.jboss.deployment.JARDeployer] No xml files found

                  it confirms that the XML deployment descriptors were not found.

                  • 6. Re: javax.naming.NameNotFoundException: ModelEJB not bound
                    waglik

                    Hmm its strange or silly but when I deploy it in the minimal/deploy its looks like working at least JNDI View see thats Bean. Hmm I thougth that when I run Jboss its strart in default configuration ....
                    is it oki?

                    • 7. Re: javax.naming.NameNotFoundException: ModelEJB not bound
                      waglik

                      Hmm I have got another problem now ....
                      In my program i write :

                      InitialContext ctx = new InitialContext();
                      Object obj = ctx.lookup(JNDI_NAME);


                      ModelHome home = (ModelHome)PortableRemoteObject.narrow(obj,ModelHome.class);


                      and compilator dont know ModelHome object ... is it becouse of Jboss or did I make somethink wrong againe :(