Ao compilar meu código está ocorrendo este erro:
Mai 09, 2012 10:10:53 PM org.apache.catalina.core.ApplicationContext log
Informações: ContextListener: contextInitialized()
Mai 09, 2012 10:10:53 PM org.apache.catalina.core.ApplicationContext log
Informações: SessionListener: contextInitialized()
Mai 09, 2012 10:20:05 PM org.apache.catalina.core.ApplicationContext log
Informações: SessionListener: contextDestroyed()
Mai 09, 2012 10:20:05 PM org.apache.catalina.core.ApplicationContext log
Informações: ContextListener: contextDestroyed()
Mai 09, 2012 10:20:05 PM org.apache.catalina.session.StandardSession writeObject
Advertência: Cannot serialize session attribute usuarioMB for session E7E0E904D66A67BCA853339A606A7480
java.io.NotSerializableException: com.modelo.dao.UsuarioDAO
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
at org.apache.catalina.session.StandardSession.writeObject(StandardSession.java:1585)
at org.apache.catalina.session.StandardSession.writeObjectData(StandardSession.java:1015)
at org.apache.catalina.session.StandardManager.doUnload(StandardManager.java:528)
at org.apache.catalina.session.StandardManager.unload(StandardManager.java:469)
at org.apache.catalina.session.StandardManager.stop(StandardManager.java:678)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4882)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:936)
at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:1359)
at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:1330)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:326)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098)
at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1110)
at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:468)
at org.apache.catalina.core.StandardService.stop(StandardService.java:604)
at org.apache.catalina.core.StandardServer.stop(StandardServer.java:788)
at org.apache.catalina.startup.Catalina.stop(Catalina.java:662)
at org.apache.catalina.startup.Catalina.start(Catalina.java:629)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Minha classe UsuarioMB
package com.modelo.managedBean;
import com.modelo.bean.Administrador;
import com.modelo.bean.Promotor;
import com.modelo.dao.UsuarioDAO;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
@ManagedBean
@SessionScoped
public class UsuarioMB implements Serializable {
private UsuarioDAO usuarioDAO = new UsuarioDAO();
private transient Administrador administrador;
private transient Promotor promotor;
public String logOut() {
getRequest().getSession().invalidate();
return "logout";
}
public boolean isUserAdmin() {
return getRequest().isUserInRole("admin");
}
public boolean isUserPromotor() {
return getRequest().isUserInRole("promotor");
}
private HttpServletRequest getRequest() {
return (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
}
// REGRAS DE NEGOCIO
public Promotor getPromotor() {
if (promotor == null) {
ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
String login = context.getUserPrincipal().getName();
promotor = usuarioDAO.recuperarPromotor(login);
}
return promotor;
}
public Administrador getAdministrador() {
if (administrador == null) {
ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
String login = context.getUserPrincipal().getName();
administrador = usuarioDAO.recuperarAdministrador(login);
}
return administrador;
}
}
Alguém tem idéia por que isso ocorre?
Estou usando JSF+Hibernate