users@glassfish.java.net

Can't lookup bean

From: Gerald Holl <gerald_at_holl.co.at>
Date: Tue, 30 Oct 2007 13:34:05 +0100

Hello,

I'm trying to lookup a stateless session bean from an JSF managed bean.

The session bean has a remote interface:

@Remote
public interface MyBean { ... }


The implementing class:

@Stateless
public class MyBeanImpl extends MyBean { ... }


And the JSF managed bean where I want to access the MyBean instance:

public class JSFBean {

   private MyBean bean;

   public JSFBean() {
     InitialContext ctx = new InitialContext();
     bean = (MyBean) ctx.lookup(MyBean.class.getName());
   }

}


What is the right way to look up the bean?

cheers,
Gerald