I have created an Enterprise Project with Netbeans, so there is a project for the EJB's and a project for the web components. I have this code for the EJB:
@Stateless
public class JosContentFacade extends AbstractFacade<JosContent> {
@PersistenceContext(unitName = "com.guiatic_GuiaTIC-ejb_ejb_1.0-SNAPSHOTPU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public JosContentFacade() {
super(JosContent.class);
}
}
and this code for the ManagedBean:
@Named(value = "showRelateds")
@RequestScoped
public class showRelateds {
@EJB
private JosContentFacade josContentFacade;
private String msg;
/**
* Creates a new instance of showRelateds
*/
public showRelateds() {
}
public String getMsg() {
msg = "MENSAJE DE PRUEBAS 3!!!";
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}
If I remove this line:
@EJB
private JosContentFacade josContentFacade;
The bean works properly, but with such line, it doesn't show me any error, but the bean doesn't work.