[jboss-user] [EJB 3.0] - Lookup work, but @EJB annotation don't

angelogalvao do-not-reply at jboss.com
Mon Jul 17 14:03:31 EDT 2006


I have this in my JSF backing bean:

anonymous wrote : 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...


anonymous wrote : @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?:??

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958553#3958553

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958553



More information about the jboss-user mailing list