hibernate實體類反序列化異常
阿新 • • 發佈:2019-02-08
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.type.SerializationException: could not deserialize org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:965) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:844) javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129) com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77) org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:232) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
今晚搞配置springMVC+hibernate時候出現了這個錯誤,搞了半天才發現是domain類的型別導的包導錯誤了。
(本來是java.sql.Timescape,結果我導的是java.securty.Timescape),結果在取出結果的時候報反序列化異常。
一般會報這個錯誤都是hibernate實體類的型別沒有配置好,仔細檢查一下型別是否和資料庫的都對應該就可以解決了。