有状态会话Bean注入JSF错误

时间:2014-11-10 21:10:45

标签: java hibernate jsf

我正在使用JSF和Hibernate编写应用程序。

当我调用“RegisterForm”的寄存器方法时,这是我遇到的问题:

  

javax.servlet.ServletException:javax.ejb.NoSuchEJBException:可能   找不到SFSB UserFlow {{118,76,77,121,103,95,68,-127,   -113,12,-89,25,-42,103,81,-61]} javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)

以下是解决问题的三个类:

RegisterForm:

@ManagedBean(name="registerForm")
@RequestScoped
public class RegisterForm {
@ManagedProperty(value="#{userSession.uf}")
private UserFlow uf;

public String register(){
uf.register(nom, prenom, username, password1);
return "Perso";

}

userSession:

@ManagedBean(name="userSession")
@SessionScoped
public class UserSession {

    @EJB
    UserFlow uf;


    public UserSession(){       
    }


    public UserFlow getUf() {
        return uf;
    }

    public void setUf(UserFlow uf) {
        this.uf= uf;
    }

和UserFlow:

@Stateful
@LocalBean
public class UserFlow implements UserFlowRemote {


    private State state;
    private User u;


    @EJB
    GestionReleve g;

    /**
     * Default constructor. 
     */
    public UserFlow() {
        state=State.UNKNOWN;
        u=null;
    }

    public void register(String nom, String prenom, String email, String password){ 
    /* Here we register the object in the DB with em.persist(object); */
    }
    public State getState() {
        return state;
    }

    public User getU() {
        return u;
    }
    }

感谢您的帮助。

0 个答案:

没有答案