org.joda.time.DateTimeZone具有用于序列化的嵌套类Stub。
Somobody知道它是如何工作的?
我正在为joda-DateTime使用Hibernate UserType。当hibernate序列化我的对象时,我从Stub.readResolve()方法中获得异常。
记录
Caused by: net.sf.ehcache.CacheException: When configured copyOnRead or copyOnWrite, a Store will only accept Serializable values
at net.sf.ehcache.store.compound.SerializationCopyStrategy.copy(SerializationCopyStrategy.java:47)
at net.sf.ehcache.store.compound.Segment.potentiallyCopy(Segment.java:176)
at net.sf.ehcache.store.compound.Segment.decode(Segment.java:170)
at net.sf.ehcache.store.compound.Segment.get(Segment.java:206)
at net.sf.ehcache.store.compound.CompoundStore.get(CompoundStore.java:156)
at net.sf.ehcache.store.compound.CompoundStore.getQuiet(CompoundStore.java:163)
at net.sf.ehcache.Cache.searchInStoreWithoutStats(Cache.java:1718)
at net.sf.ehcache.Cache.get(Cache.java:1375)
at net.sf.ehcache.Cache.get(Cache.java:1335)
at com.softcomputer.softlab.persistence.cache.EhCacher.getFromCache(EhCacher.java:187)
at com.softcomputer.softlab.persistence.cache.EhCacher.getElement(EhCacher.java:110)
at com.softcomputer.softlab.persistence.cache.JpaCache$JpaLoader.getElement(JpaCache.java:85)
at com.softcomputer.softlab.persistence.cache.EntityListCache.getEntities(EntityListCache.java:147)
at com.softcomputer.softlab.repo.core.CannedMessageRepo.findById(CannedMessageRepo.java:65)
.............
... 148 more
Caused by: java.lang.IllegalArgumentException: The datetime zone id 'WET-2WET' is not recognised
at org.joda.time.DateTimeZone.forID(DateTimeZone.java:215)
at org.joda.time.DateTimeZone$Stub.readResolve(DateTimeZone.java:1207)
....
at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1131)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1779)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:365)
at org.joda.time.chrono.ISOChronology$Stub.readObject(ISOChronology.java:231)
....
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1044)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1770)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1964)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1888)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1770)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1684)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1340)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1964)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1888)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1770)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1964)
at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:494)
at net.sf.ehcache.Element.readObject(Element.java:796)
....
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1044)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1770)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:365)
at net.sf.ehcache.store.compound.SerializationCopyStrategy.copy(SerializationCopyStrategy.java:45)
... 174 more
答案 0 :(得分:0)
我为类DateTimeZone编写了自己的Provider。这很有帮助