0 Replies Latest reply on Jul 17, 2006 2:03 PM by Ângelo Luis

    Lookup work, but @EJB annotation don't

    Ângelo Luis Newbie

      I have this in my JSF backing bean:

      private CadastroManagerLocal getCadastroManagerLocal(){
      try {
      Properties p = new Properties();
      p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      p.put(Context.PROVIDER_URL,"jnp://localhost:1099");

      InitialContext ctx = new InitialContext(p);
      Object ref = ctx.lookup("CadastroManagerBean");
      return (CadastroManagerLocal) PortableRemoteObject.narrow(ref, CadastroManagerLocal.class);
      } catch (Exception e) {
      e.printStackTrace();
      return null;
      }
      }


      and work fine, but when a try to inject with @EJB annotation i have nothing...


      @EJB(name="CadastroManagerBean")
      private CadastroManagerLocal cadastroManagerLocal;

      or

      @EJB(name="mappedName")
      private CadastroManagerLocal cadastroManagerLocal;


      I see in the documentation that the EJB work only in "java:com/env" ENC and my Bean is in global jndi namespace...

      This is the problem? how do i change from global to java:comp/env?:??