0 Replies Latest reply on Mar 20, 2007 2:39 PM by a.evoli

    NamingException with local interface

    a.evoli

      Hi all,
      I built an entity EJB with only local interface and a Session stateless EJB with remote and local interface. After these I write a Java Application that lookup to the remote home of the session bean. The problem is that the session bean doesn't lookup to the local interface of the enity beans. I think that the problem is I don't know the gloabal jndi of a local interface. That's the code:

      public int login(String idUtente, String password) {
      //TODO implement login

      AccessoBean1Local utente=null;
      AccessoBean1PK chiave = new AccessoBean1PK(idUtente,password);

      try{
      InitialContext iniCtx = new InitialContext();
      Context ejbCtx = (Context) iniCtx.lookup("java:comp/env/ejb");
      AccessoBean1LocalHome home = (AccessoBean1LocalHome) iniCtx.lookup("AccessoBean1LocalHome");
      utente=home.findByPrimaryKey(chiave);
      }
      catch(FinderException e){return 1;}
      catch(NamingException e){return 3;}
      catch(Exception e){return 2;}

      return 0;

      Infact it always return 3. Could someone help me? Thanks a lot.