org.springframework.orm.hibernate4.HibernateSystemException: could not deserialize

时间:2022-09-28 20:32:51

org.springframework.orm.hibernate4.HibernateSystemException: could not deserialize; nested exception is org.hibernate.type.SerializationException: could not deserialize
at org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:218)
at org.springframework.orm.hibernate4.HibernateExceptionTranslator.convertHibernateAccessException(HibernateExceptionTranslator.java:57)
at org.springframework.orm.hibernate4.HibernateExceptionTranslator.translateExceptionIfPossible(HibernateExceptionTranslator.java:44)
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:59)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:147)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy. Proxy44.findAll(UnknownSource)atcom.boomhope.idc.service.imple.SystemServiceImpl.findSysAdminList(SystemServiceImpl.java:50)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)atjava.lang.reflect.Method.invoke(Method.java:606)atorg.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)atorg.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)atorg.springframework.transaction.interceptor.TransactionInterceptor 1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy. Proxy45.findSysAdminList(UnknownSource)atcom.boomhope.SysAdminTest.testQuerySysAdmin(SysAdminTest.java:38)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)atjava.lang.reflect.Method.invoke(Method.java:606)atorg.junit.runners.model.FrameworkMethod 1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
at org.junit.runners.ParentRunner 3.run(ParentRunner.java:238)atorg.junit.runners.ParentRunner 1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access 000(ParentRunner.java:53)atorg.junit.runners.ParentRunner 2.evaluate(ParentRunner.java:229)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.hibernate.type.SerializationException: could not deserialize
at org.hibernate.internal.util.SerializationHelper.doDeserialize(SerializationHelper.java:262)
at org.hibernate.internal.util.SerializationHelper.deserialize(SerializationHelper.java:306)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.fromBytes(SerializableTypeDescriptor.java:155)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:130)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:44)
at org.hibernate.type.descriptor.sql.VarbinaryTypeDescriptor 2.doExtract(VarbinaryTypeDescriptor.java:71)atorg.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)atorg.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:267)atorg.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:263)atorg.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:253)atorg.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:338)atorg.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2969)atorg.hibernate.loader.Loader.loadFromResultSet(Loader.java:1696)atorg.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1628)atorg.hibernate.loader.Loader.getRow(Loader.java:1515)atorg.hibernate.loader.Loader.getRowFromResultSet(Loader.java:726)atorg.hibernate.loader.Loader.processResultSet(Loader.java:953)atorg.hibernate.loader.Loader.doQuery(Loader.java:921)atorg.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:355)atorg.hibernate.loader.Loader.doList(Loader.java:2554)atorg.hibernate.loader.Loader.doList(Loader.java:2540)atorg.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2370)atorg.hibernate.loader.Loader.list(Loader.java:2365)atorg.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:497)atorg.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:387)atorg.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:236)atorg.hibernate.internal.SessionImpl.list(SessionImpl.java:1264)atorg.hibernate.internal.QueryImpl.list(QueryImpl.java:103)atcom.boomhope.idc.dao.imple.BaseDao.findList(BaseDao.java:516)atcom.boomhope.idc.dao.imple.BaseDao.findAll(BaseDao.java:419)atcom.boomhope.idc.dao.imple.BaseDao.findAll(BaseDao.java:343)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)atjava.lang.reflect.Method.invoke(Method.java:606)atorg.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)atorg.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)atorg.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)48moreCausedby:java.io.StreamCorruptedException:invalidstreamheader:6E75070Eatjava.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:804)atjava.io.ObjectInputStream.(ObjectInputStream.java:299)atorg.hibernate.internal.util.SerializationHelper CustomObjectInputStream.(SerializationHelper.java:328)
at org.hibernate.internal.util.SerializationHelper$CustomObjectInputStream.(SerializationHelper.java:318)
at org.hibernate.internal.util.SerializationHelper.doDeserialize(SerializationHelper.java:237)
… 86 more

问题描述:JUnit测试hibernate时候报错could not deserialize,检查实体映射类,实现了Serializable接口,但是有这样的
private String ordBy;
private String menuStatus;
private Serializable createDate;
private BigDecimal creater;
private Serializable updateDate;
private BigDecimal updater;

实体类使用hibernate Tool生成的,修改updateDate,createDate的类型后,能够成功运行了;

自动生成的时候,要多检查检查哦;

PS:今天程序中的数据库名称配错了,导致一直找不到某一个字段,郁闷了半天。。。