我正在尝试使用 infinispan 作为我的应用程序上的分布式缓存。
我将它用作使用 spring 和 JPA 进行休眠的二级缓存。
使用此 infinispan-config.xml 将 Infinispan 配置为在分布式集群模式下工作
<?xml version="1.0" encoding="UTF-8"?>
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd"
xmlns="urn:infinispan:config:5.1">
<global>
<transport clusterName="sigmaCacheCluster">
<properties>
<property name="configurationFile" value="jgroups-tcp.xml" />
</properties>
</transport>
<globalJmxStatistics enabled="true" />
</global>
<default>
<jmxStatistics enabled="true" />
<clustering mode="replication" >
<stateRetrieval fetchInMemoryState="true" />
<sync/>
</clustering>
</default>
</infinispan>
当使用与 Infinispan 提供的 demoApp 相同的配置文件时,它可以完美运行,但是在应用程序内部和 Tomcat(7) 上运行时,我得到了流动错误(请注意,集群已启动并且 infinispan 找到其他节点):
[DEFAULT APPENDER - FROM WEB] 2013-06-13 11:53:58,248 - INFO org.infinispan.spring.AbstractEmbeddedCacheManagerFactory - Initializing SpringEmbeddedCacheManager instance ...
[DEFAULT APPENDER - FROM WEB] 2013-06-13 11:53:58,802 - INFO org.infinispan.configuration.parsing.Parser51 - ISPN000184: The stateRetrieval configuration element has been deprecated, we're assuming you meant stateTransfer. Please see XML schema for more information.
[DEFAULT APPENDER - FROM WEB] 2013-06-13 11:53:59,065 - INFO org.infinispan.spring.AbstractEmbeddedCacheManagerFactory - Successfully initialized SpringEmbeddedCacheManager instance [org.infinispan.spring.provider.SpringEmbeddedCacheManager@6ee47e99]
[DEFAULT APPENDER - FROM WEB] 2013-06-13 11:53:59,732 - INFO org.infinispan.remoting.transport.jgroups.JGroupsTransport - ISPN000078: Starting JGroups Channel
[DEFAULT APPENDER - FROM WEB] 2013-06-13 11:54:03,263 - INFO org.jgroups.protocols.UFC - UFC is not needed (and can be removed) as we're running on a TCP transport
[DEFAULT APPENDER - FROM WEB] 2013-06-13 11:54:03,581 - INFO org.infinispan.remoting.transport.jgroups.JGroupsTransport - ISPN000094: Received new cluster view: [comp-Lap-28466|5] [comp-Lap-28466, comp-Lap-1139]
[DEFAULT APPENDER - FROM WEB] 2013-06-13 11:54:03,852 - INFO org.infinispan.remoting.transport.jgroups.JGroupsTransport - ISPN000079: Cache local address is comp-Lap-1139, physical addresses are [10.0.0.106:7801]
[DEFAULT APPENDER - FROM WEB] 2013-06-13 11:54:03,858 - INFO org.infinispan.factories.GlobalComponentRegistry - ISPN000128: Infinispan version: Infinispan 'Tactical Nuclear Penguin' 5.3.0.Beta1
[DEFAULT APPENDER - FROM WEB] 2013-06-13 11:54:04,448 - INFO org.infinispan.jmx.CacheJmxRegistration - ISPN000031: MBeans were successfully registered to the platform MBean server.
[DEFAULT APPENDER - FROM WEB] 2013-06-13 11:54:07,237 - ERROR org.jgroups.blocks.RequestCorrelator - failed unmarshalling buffer into return value
java.lang.ClassCastException: org.infinispan.commons.hash.MurmurHash3 cannot be cast to java.util.List
at org.infinispan.distribution.ch.ReplicatedConsistentHash$Externalizer.readObject(ReplicatedConsistentHash.java:145)
at org.infinispan.distribution.ch.ReplicatedConsistentHash$Externalizer.readObject(ReplicatedConsistentHash.java:135)
at org.infinispan.marshall.jboss.ExternalizerTable$ExternalizerAdapter.readObject(ExternalizerTable.java:406)
at org.infinispan.marshall.jboss.ExternalizerTable.readObject(ExternalizerTable.java:226)
at org.infinispan.marshall.jboss.JBossMarshaller$ExternalizerTableProxy.readObject(JBossMarshaller.java:164)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:351)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37)
at org.infinispan.topology.CacheTopology$Externalizer.readObject(CacheTopology.java:145)
at org.infinispan.topology.CacheTopology$Externalizer.readObject(CacheTopology.java:134)
at org.infinispan.marshall.jboss.ExternalizerTable$ExternalizerAdapter.readObject(ExternalizerTable.java:406)
at org.infinispan.marshall.jboss.ExternalizerTable.readObject(ExternalizerTable.java:226)
at org.infinispan.marshall.jboss.JBossMarshaller$ExternalizerTableProxy.readObject(JBossMarshaller.java:164)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:351)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37)
at org.infinispan.remoting.responses.SuccessfulResponse$Externalizer.readObject(SuccessfulResponse.java:101)
at org.infinispan.remoting.responses.SuccessfulResponse$Externalizer.readObject(SuccessfulResponse.java:86)
at org.infinispan.marshall.jboss.ExternalizerTable$ExternalizerAdapter.readObject(ExternalizerTable.java:406)
at org.infinispan.marshall.jboss.ExternalizerTable.readObject(ExternalizerTable.java:226)
at org.infinispan.marshall.jboss.JBossMarshaller$ExternalizerTableProxy.readObject(JBossMarshaller.java:164)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:351)
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37)
at org.infinispan.marshall.jboss.AbstractJBossMarshaller.objectFromObjectStream(AbstractJBossMarshaller.java:163)
at org.infinispan.marshall.VersionAwareMarshaller.objectFromByteBuffer(VersionAwareMarshaller.java:116)
at org.infinispan.marshall.AbstractDelegatingMarshaller.objectFromByteBuffer(AbstractDelegatingMarshaller.java:104)
at org.infinispan.remoting.transport.jgroups.MarshallerAdapter.objectFromBuffer(MarshallerAdapter.java:50)
at org.jgroups.blocks.RequestCorrelator.receiveMessage(RequestCorrelator.java:390)
at org.jgroups.blocks.RequestCorrelator.receive(RequestCorrelator.java:247)
at org.jgroups.blocks.MessageDispatcher$ProtocolAdapter.up(MessageDispatcher.java:665)
at org.jgroups.JChannel.up(JChannel.java:719)
at org.jgroups.stack.ProtocolStack.up(ProtocolStack.java:1008)
at org.jgroups.protocols.RSVP.up(RSVP.java:187)
at org.jgroups.protocols.FRAG2.up(FRAG2.java:178)
at org.jgroups.protocols.FlowControl.up(FlowControl.java:404)
at org.jgroups.protocols.FlowControl.up(FlowControl.java:386)
at org.jgroups.protocols.tom.TOA.up(TOA.java:122)
at org.jgroups.protocols.SEQUENCER.up(SEQUENCER.java:251)
at org.jgroups.protocols.pbcast.GMS.up(GMS.java:893)
at org.jgroups.protocols.pbcast.STABLE.up(STABLE.java:234)
at org.jgroups.protocols.UNICAST2.handleBatchReceived(UNICAST2.java:838)
at org.jgroups.protocols.UNICAST2.up(UNICAST2.java:481)
at org.jgroups.protocols.pbcast.NAKACK2.up(NAKACK2.java:675)
at org.jgroups.stack.Protocol.up(Protocol.java:406)
at org.jgroups.protocols.FD.up(FD.java:274)
at org.jgroups.stack.Protocol.up(Protocol.java:406)
at org.jgroups.protocols.MERGE2.up(MERGE2.java:223)
at org.jgroups.stack.Protocol.up(Protocol.java:406)
at org.jgroups.protocols.TP.passBatchUp(TP.java:1383)
at org.jgroups.protocols.TP$BatchHandler.run(TP.java:1519)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
我已经烧了不止一个树天试图解决这个问题,但一无所获,我会感谢你的帮助
编辑:删除时<clustering mode="replication">
一切正常。