6 Replies Latest reply on Aug 29, 2006 7:04 AM by cwad0000

    EJB not bound Exception

    jyotitushir

      I have created a stateless bean and deployed it to jboss its deployed perfectly.
      but when i trying to call its method from one of my standalone application its giving me EJB not bound Exception. Please Help

      The interface code is:
      package poji;

      import java.rmi.RemoteException;

      import javax.ejb.Remote;

      @Remote
      public interface Service {

      public String loadLayout(String string) throws RemoteException;
      }

      the bean class is:package poji;

      import java.rmi.RemoteException;

      import javax.ejb.Remote;
      import javax.ejb.Stateless;

      import org.jboss.annotation.ejb.RemoteBinding;



      @Stateless
      //@Remote( { Service.class })
      //@RemoteBinding (jndiBinding="Service")
      public class ServiceBean implements Service
      {
      public String loadLayout(String alayout) throws RemoteException
      {
      return alayout;
      }
      }


      And the client is:
      package pojo;

      import javax.naming.InitialContext;

      import poji.Service;

      public class ServiceClient {

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

      InitialContext ctx = new InitialContext();
      Service service = (Service) ctx.lookup(Service.class.getName());
      for (int i = 0; i < 5; i++) {
      String returnedString = service.loadLayout("Hello" + i);
      System.out.println("The received String is: " + returnedString);
      }
      }
      }


      the exception which im getting is:

      xception in thread "main" javax.naming.NameNotFoundException: poji.Service not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
      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:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:595)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
      at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
      at sun.rmi.server.UnicastRef.invoke(Unknown Source)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at pojo.ServiceClient.main(ServiceClient.java:16)

        • 1. Re: EJB not bound Exception
          pjmunoz

          I just copied and pasted your code and tested it, and it works fine for me. Im using JBoss 4.0.3

          Maybe your jboss is not configured properly. Be sure that when you deploy your file, you can read something like this in your jboss log:

          2006-03-07 18:37:21,023 INFO [org.jboss.ejb3.ProxyDeployer] no declared remote bindings for : poji.ServiceBean
          2006-03-07 18:37:21,024 INFO [org.jboss.ejb3.ProxyDeployer] there is remote interfaces for poji.ServiceBean
          2006-03-07 18:37:21,024 INFO [org.jboss.ejb3.ProxyDeployer] default remote binding has jndiName of poji.Service
          2006-03-07 18:37:21,086 DEBUG [org.jboss.ejb.txtimer.EJBTimerServiceImpl] createTimerService: org.jboss.ejb.txtimer.TimerServiceImpl@1c210e1
          2006-03-07 18:37:21,086 DEBUG [org.jboss.ejb3.stateless.StatelessManager] Started jboss.j2ee:service=EJB3,name=poji.ServiceBean


          Hope this helps you

          • 2. Re: EJB not bound Exception
            jyotitushir

            After adding some client jars my code is running fine.
            Thanks for your support

            • 3. Re: EJB not bound Exception
              david_wilfy

               

              "jyotitushir" wrote:
              After adding some client jars my code is running fine.
              Thanks for your support


              Could u please tell me what client jars u added, coz I have the same problem

              • 4. Re: EJB not bound Exception
                jyotitushir

                i added jboss-client.jar , jboss-clientall.jar from %jbossHome%/client

                • 5. Re: EJB not bound Exception
                  sphinx88

                  can you tell me where you put these client jars???


                  • 6. Re: EJB not bound Exception
                    cwad0000

                     

                    "sphinx88" wrote:
                    can you tell me where you put these client jars???


                    just add them to the classpath