0

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.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
user3407397
  • 59
  • 1
  • 8
  • `the bean doesn't work` What do you mean by this? – Aritz Mar 14 '16 at 21:15
  • Did you check the server log? If you happen to have sent a JSF ajax request, there's by default no feedback when an exception occurs. See also a.o. http://stackoverflow.com/q/27526753 – BalusC Mar 14 '16 at 21:15
  • 1
    Use interfaces for EJB. If you have different applications (different projects?) then use `@Remote` and inject (`@EJB`) it by interface. If you have everything in same JVM you can use `@Local` interface or `@LocalBean` without interface. – Geinmachi Mar 14 '16 at 21:31

0 Answers0