Search code examples
jsfcdiserializableomnifacesview-scope

Passivation capable beans must satisfy passivation capable dependencies


I'm having a little issue with OmniFaces's Viewscoped. Even with my Managedbean implementing Serializable, I'm receiving the error below:

Passivation capable beans must satisfy passivation capable dependencies.

With some research, I found some answers about the this problem but with no success. I resolved my problem serializing my other class that I'm injecting with CDI.

Is it really necessary my other classes implementing Serializable to Inject in my Managedbean?

Environment - WebSphere Application Server 8.5.5.2 - Apache MyFaces 2.0.2 - OmniFaces 1.7 - PrimeFaces 5.0

My Class:

public class AgrupamentoAcoRN{

@Inject
public TbSiglaAcoAgrupadaDAO dao;

public void insereDados(TbSiglaAcoAgrupada tbSiglaAcoAgrupada) throws BancoDeDadosException{
    dao.insereRegistro(tbSiglaAcoAgrupada);
}
}

My Bean:

@Named("agrupamentoAcoMb")
@ViewScoped
public class AgrupamentoAcoMB implements Serializable{

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

@Inject
private AgrupamentoAcoRN rn;
}

Solution

  • All fields of a Serializable java class should be serializable, hence every field in your viewScoped bean should be serializable also.

    Your problem have nothing to do with Omnifaces