1 Reply Latest reply on Sep 1, 2008 2:27 AM by jaikiran pai

    Can't find the SessionBean

    arres arres Newbie

      Hi all,

      I am trying to setup my first jboss application, but I have some kind of a problem.
      During the access of the Bean I get the following exception:

      javax.naming.NameNotFoundException: CalculatorBean 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:267)
      


      This is the Bean:
      @Stateless(name="CalculatorBean")
      public class CalculatorBean implements CalculatorRemote, CalculatorLocal {
      
       public int sum(int add1, int add2) {
       return add1+add2;
       }
      
       public int multiply(int mul1, int mul2) {
       return mul1*mul2;
       }
      
      }
      


      And these are the interfaces:
      @Local
      public interface CalculatorLocal extends Calculator{
      
      }
      


      @Remote
      public interface CalculatorRemote extends Calculator{
      
      }
      


      And next the Client:
       public void setUp() {
       try {
       Properties properties = new Properties();
       properties.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
       properties.put("java.naming.factory.url.pkgs", "=org.jboss.naming:org.jnp.interfaces");
       properties.put("java.naming.provider.url", "localhost:1099");
       InitialContext ctx = new InitialContext(properties);
       remote = (CalculatorRemote) ctx.lookup("CalculatorBean/remote");
       } catch (Exception e) {
       e.printStackTrace();
       }
       }
      



      I have no idea what kind of a problem this is. I also checked the JNDI-Namespace inside the jboss, but this seems to be finde:
       +- c-backend-1-SNAPSHOT (class: org.jnp.interfaces.NamingContext)
       | +- CalculatorBean (class: org.jnp.interfaces.NamingContext)
       | | +- local (proxy: $Proxy67 implements interface de.backend.bean.calculator.CalculatorLocal,interface org.jboss.ejb3.JBossProxy)
       | | +- remote (proxy: $Proxy65 implements interface de.backend.bean.calculator.CalculatorRemote,interface org.jboss.ejb3.JBossProxy)
      


      It would be very nice, if someone could help me resolving my problem :(

      Thank you,
      Arres

        • 1. Re: Can't find the SessionBean
          jaikiran pai Master

          Going by the jndi tree output, you posted, the remote bean is bound to c-backend-1-SNAPSHOT/CalculatorBean/remote and the local is bound to c-backend-1-SNAPSHOT/CalculatorBean/local. This is the default jndi naming scheme which is EARName/BeanClassName/remote or EARName/BeanClassName/local.