I have an EJB (PersonManager) in the Enterprise Application modul, which injects another EJB (Person):
@Stateful
public class PersonManager implements PersonManagerLocal {
@EJB
private PersonLocal person;
@Override
public void setPersonName(String name) {
person.setName(name);
}
@Override
public String getPersonName() {
return person.getName();
}
}
I want to use the PersonManager EJB in a JSF web app. I define it in the faces-config.xml:
<managed-bean>
<managed-bean-name>personManager</managed-bean-name>
<managed-bean-class>ejb.PersonManager</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
The problem is that, the injection of the PersonLocal EJB doesn't happen. The person property is always NULL. What did I wrong?
But if I inject the PersonManager in a JSF managed bean like this:
@ManagedBean
@RequestScoped
public class Index {
@EJB
private PersonManagerLocal personManager;
....
IT WORKS. I need the first scenario, please help me :-D