1 Reply Latest reply on Sep 15, 2003 4:28 AM by Adrian Brock


    Ledyvânia Newbie


      i'm try to execute my client application
      and i always got only this message...
      "java.naming.namenotfoundexception: Adder not found"

      can anyone help me????

      here's my client
      import javax.naming.*;
      import javax.rmi.PortableRemoteObject;
      import java.util.Properties;
      import exemplo.ejb.Adder;
      import exemplo.ejb.AdderHome;

      public class BeanClient
      public static void main (String args[])
      //preparing properties for constructing an InitialContext object
      Properties properties = new Properties();
      properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      properties.put(Context.PROVIDER_URL, "localhost:1099");

      //Get an initial Context
      InitialContext jndiContext = new InitialContext(properties);
      System.out.println("Got context");

      //Get a references to the Bean
      Object ref = jndiContext.lookup("Adder");
      System.out.println("Got Refefence");

      //Get a reference from this to the Bean's Home interface
      AdderHome home = (AdderHome) PortableRemoteObject.narrow(ref, AdderHome.class);

      //Create an Adder object from the Home interface
      Adder adder = home.create();
      System.out.println("2 + 5 = " + adder.add (2, 5));
      catch (Exception e)

      here's my ejb-jar and jboss
      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN'

      My First EJB application
      <display-name>Adder Application</display-name>


      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "http://www.jboss.org/j2ee/dtd/jboss.dtd">