1 Reply Latest reply on Jan 13, 2006 5:39 PM by kasinath Nalla

    javax.naming.NameNotFoundException:com not bound.

    hu yidao Newbie

      After I deploy a EJB succesfull, I use the following client program to access it in jboss-3.2.3. It display :javax.naming.NameNotFoundException:com not bound. What 's the problem? Please help me.

      public static void main(String[] args) throws Exception
      {
      System.out.println("\n?????????...\n");

      try
      {
      Properties env = new Properties();
      env.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
      env.setProperty("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
      env.setProperty(InitialContext.PROVIDER_URL, "jnp://localhost:1099");


      InitialContext ctx = new InitialContext(env);

      Object objref = ctx.lookup("java:comp/env/MyFirstEJB");
      HelloHome home = (HelloHome)PortableRemoteObject.narrow(objref, HelloHome.class);
      Hello hello = home.create();
      System.out.println("I am in client. "+hello.sayHello());
      }
      catch (NamingException ne)
      {
      System.out.println("\n???????"+ne);
      System.exit(1);
      }

      System.out.println("\n?????????...\n");
      }

        • 1. Re: javax.naming.NameNotFoundException:com not bound.
          kasinath Nalla Newbie

          name of the par( example u might gavew

          persist.PAR
          ) and the name in ur persistence.xml shuld be same..

          what i mean is

          <?xml version="1.0" encoding="UTF-8"?>
          <entity-manager>
          
          
           <name>persist</name>
          
          
          
           <jta-data-source>java:/orderDataSource</jta-data-source>
           <properties>
           <property name="hibernate.hbm2ddl.auto" value="create" />
           <property name="hibernate.dialect"
           value="org.hibernate.dialect.OracleDialect" />
          
           </properties>
          </entity-manager>
          



          Both shuld be the same...

          name in persistence.xml and name of .PAR file shuld same then u dont get error
          thanks
          kasi