1. java.io.NotSerializableException
94359 [EH_CACHE Async Replication Thread] ERROR n.s.e.d.jgroups.JGroupsCachePeer - Error serializing data, it will not be sent: [JGroupEventMessage [event=PUT, cacheName=cn.zno.smse.dao.PersonMapper, serializableKey=-1714939566:3462427898:cn.zno.smse.dao.PersonMapper.countByExample:0:2147483647:select count(*) from PERSON, element=[ key = -1714939566:3462427898:cn.zno.smse.dao.PersonMapper.countByExample:0:2147483647:select count(*) from PERSON, value=[3], version=1, hitCount=0, CreationTime = 1444192911449, LastAccessTime = 1444192911449 ]], JGroupEventMessage [event=PUT, cacheName=cn.zno.smse.dao.PersonMapper, serializableKey=215577894:-1204219406:cn.zno.smse.dao.PersonMapper.selectByExample:0:10:select ID, NAME, AGE, BIRTHDAY, TYPE, SEX from PERSON, element=[ key = 215577894:-1204219406:cn.zno.smse.dao.PersonMapper.selectByExample:0:10:select ID, NAME, AGE, BIRTHDAY, TYPE, SEX from PERSON, value=[Person [id=2025B6EA63ED514AE053433210AC0E08, name=小王八, age=1, birthday=1988-04-19 10:41:07, type=2, sex=null], Person [id=2039793AE2A558B5E053433210ACD4F6, name=大狗, age=11, birthday=2015-09-15 10:08:16, type=2, sex=1], Person [id=2050B7C3F8376DCBE053433210AC8375, name=小小, age=11, birthday=2015-09-23 13:59:30, type=1, sex=1]], version=1, hitCount=0, CreationTime = 1444192911543, LastAccessTime = 1444192911543 ]]]
java.io.NotSerializableException: cn.zno.smse.pojo.Person
at java.io.ObjectOutputStream.writeObject0(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectOutputStream.writeObject(Unknown Source) ~[na:1.7.0_45]
at java.util.ArrayList.writeObject(Unknown Source) ~[na:1.7.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectOutputStream.writeSerialData(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectOutputStream.writeObject0(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectOutputStream.defaultWriteObject(Unknown Source) ~[na:1.7.0_45]
at net.sf.ehcache.Element.writeObject(Element.java:835) ~[ehcache-core-2.6.11.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectOutputStream.writeSerialData(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectOutputStream.writeObject0(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectOutputStream.writeObject(Unknown Source) ~[na:1.7.0_45]
at net.sf.ehcache.distribution.LegacyEventMessage.writeObject(LegacyEventMessage.java:117) ~[ehcache-core-2.6.11.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectOutputStream.writeSerialData(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectOutputStream.writeObject0(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectOutputStream.writeObject(Unknown Source) ~[na:1.7.0_45]
at java.util.ArrayList.writeObject(Unknown Source) ~[na:1.7.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectOutputStream.writeSerialData(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectOutputStream.writeObject0(Unknown Source) ~[na:1.7.0_45]
at java.io.ObjectOutputStream.writeObject(Unknown Source) ~[na:1.7.0_45]
at org.jgroups.util.Util.objectToByteBuffer(Util.java:490) ~[jgroups-3.1.0.Final.jar:3.1.0.Final]
at net.sf.ehcache.distribution.jgroups.JGroupsCachePeer.sendData(JGroupsCachePeer.java:201) [ehcache-jgroupsreplication-1.7.jar:na]
at net.sf.ehcache.distribution.jgroups.JGroupsCachePeer.flushQueue(JGroupsCachePeer.java:244) [ehcache-jgroupsreplication-1.7.jar:na]
at net.sf.ehcache.distribution.jgroups.JGroupsCachePeer.access$200(JGroupsCachePeer.java:48) [ehcache-jgroupsreplication-1.7.jar:na]
at net.sf.ehcache.distribution.jgroups.JGroupsCachePeer$AsyncTimerTask.run(JGroupsCachePeer.java:265) [ehcache-jgroupsreplication-1.7.jar:na]
at java.util.TimerThread.mainLoop(Unknown Source) [na:1.7.0_45]
at java.util.TimerThread.run(Unknown Source) [na:1.7.0_45]
解决办法:将java bean 实现序列化接口
请留意:element 的key值和value值!