4 Replies Latest reply on Jul 18, 2007 3:06 PM by Taj

    forever problem! right way to create and deploy bean

    henry human Newbie

      Hi,
      i am new in Beans issue. I have a stateless Hellowrod Session bean.
      (MyBean.java, MyBeanRemote )
      and a Client, MyBeanCleint.
      With eclipse i export/deploy the Project as Jar file to Jboss 4.0.5
      (Left click project -> export-> jar file)
      So i have a created jar file MyBean.jar in Jboss.
      When i run the client i become ?Mybean not bound exception? from the
      naming server!
      ?All files? which i have in my project are (project is according to the book sample
      created as general java project):
      1-sever.MyBean.java
      2.server.MyBeanRemote.java
      3-client.MyBeanClient.java

      Here is my client code:
      //////////////////////////////////
      public class MyBeanClient {

      public static void main(String[] args) {
      try {
      Properties p = new Properties();
      p.put(Context.INITIAL_CONTEXT_FACTORY,
      "org.jnp.interfaces.NamingContextFactory");
      p.put(Context.URL_PKG_PREFIXES,
      "org.jboss.naming:org.jnp.interfaces");
      p.put(Context.PROVIDER_URL, "jnp://localhost:1099");
      Context ctx = new InitialContext(p);
      Object ref = ctx.lookup("MyBean");
      MyBeanRemote mbr = (MyBeanRemote) PortableRemoteObject
      .narrow(ref, MyBeanRemote.class);

      System.out.println( mbr.sayHello());
      } catch (NamingException e) {
      e.printStackTrace();
      }
      }
      ////////////////////////////////
      Please help me
      thanks