1 Reply Latest reply on Dec 12, 2006 10:39 AM by ericchile

    EJB3 on Jboss 4.0.3 SP1+ Jboss IDE 1.5 - NameNotFoundExcepti

    sweetvenkat

      Hi;

      Can anybody help me with this? I am getting javax.naming.NameNotFoundException in ejb client program.
      Here is my source code...

      I am using...Jboss IDE for Eclipse 1.5
      Jboss Application Server 4.0.3 sp1

      HelloWorld.java
      ----------------------
      package src;

      import javax.ejb.Remote;

      @Remote
      public interface HelloWorld {
      public void display();
      }


      HelloWorldBean.java
      ----------------------------
      package src;

      import javax.ejb.Stateless;
      import src.HelloWorld;

      public @Stateless class HelloWorldBean implements HelloWorld {
      public void display() {
      System.out.println("sairam");
      }
      }

      HelloClient.java
      ---------------------
      package src;
      import javax.naming.*;

      public class HelloClient {
      public static void main(String[] args) throws Exception{
      Context ct=new InitialContext();
      HelloWorld hello=(HelloWorld)ct.lookup("HelloWorldBean/remote");
      hello.display();
      }

      }

      jndi.properties
      ---------------------
      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
      java.naming.provider.url=localhost:1099

      I jar'ed the src/HelloWorld.class and src/HelloWorldBean and src/HelloClient and jndi.properties and deployed onto server.

      When I tried to run the client program, i got the following exception...

      Exception in thread "main" javax.naming.NameNotFoundException: HelloWorldBean not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:514)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:522)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:528)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:252)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
      at sun.rmi.transport.Transport$1.run(Transport.java:153)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
      at java.lang.Thread.run(Thread.java:595)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at src.HelloClient.main(HelloClient.java:11)



      Can you pls help me with the solution on how to bind to an EJB?

      Thanks in inadvance.