您好我正在使用 ViewScoped Bean 问题是当调用它时我得到 NotSerializableException。
这是我的托管 Bean 的代码:
@ManagedBean(name="demandesBean")
@ViewScoped
public class DemandesBean implements Serializable {
private static final long serialVersionUID = 1L;
@ManagedProperty(value="#{demandeService}")
private DemandeService demandeService; //A Spring Service
@ManagedProperty(value="#{loginBean}")
private LoginBean loginBean;
private DemandeVO newDemande;
@PostConstruct
public void initData() {
newDemande = new DemandeVO();
}
public void doAjouterDemande(ActionListener event) {
demandeService.createDemande(newDemande, loginBean.getUsername());
newDemande = new DemandeVO();
}
public List<DemandeVO> getListDemande() {
return demandeService.getAllDemandesByUser(loginBean.getUsername());
}
public DemandeService getDemandeService() {
return demandeService;
}
public void setDemandeService(DemandeService demandeService) {
this.demandeService = demandeService;
}
public LoginBean getLoginBean() {
return loginBean;
}
public void setLoginBean(LoginBean loginBean) {
this.loginBean = loginBean;
}
public DemandeVO getNewDemande() {
return newDemande;
}
public void setNewDemande(DemandeVO newDemande) {
this.newDemande = newDemande;
}
}
我收到以下异常:
GRAVE: Exiting serializeView - Could not serialize state: com.bull.congesJBPM.serviceImpl.DemandeServiceImpl
java.io.NotSerializableException: com.bull.congesJBPM.serviceImpl.DemandeServiceImpl
这个问题有什么解决办法吗??请帮忙 !