简体   繁体   中英

No EJB found with interface of type when I try to inject a Bean

I try to make a simple login with JSF and Managed Beans, but when start the server returns the following error.

WFLYEJB0406: No EJB found with interface of type 'Controlador.UsuarioSessionBean' for binding Controlador.AlmacenVirtualBean/usuarioSession"}

This is the class to save the data...

@ManagedBean
@RequestScoped
public class UsuarioSessionBean implements Serializable  {

/**
 * 
 */
private static final long serialVersionUID = 1L;

@EJB
private UsuarioSessionDAO usuarioSession;

//private Usuario usuario;

private int usuarioId;
private String nick;
private String pass;

And in other Managed Bean I try to inject the first.

@ManagedBean(name="AlmacenVirtualBean")
@RequestScoped
public class AlmacenVirtualBean {

private AlmacenVirtual almacenVirtual;
private String nombre;
private int usuarioId;

public AlmacenVirtualBean(){}

@EJB
private AlmacenVirtualDAO almacenVirtualDAO;

@ManagedProperty("#{UsuarioSessionBean}")
private UsuarioSessionBean usuarioSession;

That's what I'm doing wrong?

You may get that error, if you change the AlmacenVirtualBean to have:

@EJB
private UsuarioSessionBean usuarioSession;

Your question code can't produce that error.

But you can get usuarioSession=null . You should replace #{UsuarioSessionBean} by #{usuarioSessionBean} .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM