hibernate 报 org.hibernate.type.SerializationException:could not deserialize 异常
HTTP Status 500 -
?
? --------------------------------------------
?
? type Exception report
?
? message
?
? description The server encountered an internal error () that prevented it from fulfilling this request.
?
? exception
?
? javax.servlet.ServletException: could not deserialize
? org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
? org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
? org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
? org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
? org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
? javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
? javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
?
?
? root cause
?
? org.hibernate.type.SerializationException:could?not?deserialize
? org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:211)
? org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:234)
? org.hibernate.type.SerializableType.fromBytes(SerializableType.java:78)
? org.hibernate.type.SerializableType.get(SerializableType.java:39)
? org.hibernate.type.NullableType.nullSafeGet(NullableType.java:77)
? org.hibernate.type.NullableType.nullSafeGet(NullableType.java:68)
? org.hibernate.type.AbstractType.hydrate(AbstractType.java:80)
? org.hibernate.persister.entity.BasicEntityPersister.hydrate(BasicEntityPersister.java:1690)
? org.hibernate.loader.Loader.loadFromResultSet(Loader.java:991)
? org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:942)
? org.hibernate.loader.Loader.getRow(Loader.java:855)
? org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:305)
? org.hibernate.loader.Loader.doQuery(Loader.java:412)
? org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
? org.hibernate.loader.Loader.doList(Loader.java:1593)
? org.hibernate.loader.Loader.list(Loader.java:1577)
? org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
? org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
? org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
? org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
? com.bbs.web.info.ArticleInfoBean.findByDomainId(ArticleInfoBean.java:31)
? com.bbs.struts.action.ListArticleAction.doQuery(ListArticleAction.java:51)
? com.bbs.struts.action.ListArticleAction.execute(ListArticleAction.java:44)
? org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
? org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
? org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
? org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
? javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
? javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
?
?
? note The full stack trace of the root cause is available in the Apache Tomcat/5.5.5 logs.
?
?
? --------------------------------------------
?
------解决方法--------------------
你的实体类有没有实现serializable接口?
? 对象序列化出错
? 比如
? public class BaseBusinessClass implements Serializable{
? private String id;
? private String name;
?
? public String getId(){
return id;
? }
? public void setId(String id){
? this.id=id;
? }
? public String getName(){
? return name;
? }
? .....
------解决方法--------------------
could not deserialize,不能反序列化,你看看你的hibernate配置中是否有序列化类型数据,即SerializableType,与对应的数据库数据是否相同,(数据库对应blob型),还有你是否有换过jdk,不同的jdk序列化的时候得到的结果是不同的,如果保存数据的时候用的是一个版本的jdk,而读数据(即反序列化的时候)是另一个版本的jdk那么有可能反序列化不成功。
?
?
?