问题:尝试使用 jpa-store 和休眠 OGM 配置 infinspan 缓存。我可以通过带有简单缓存存储的 hotrod 客户端访问 infinispan 服务器缓存,配置如下,
我在 ..\infinispan-server-8.1.0.CR1\standalone\configuration\standalone.xml 中配置了以下内容,并通过命令 ../bin>standalone.bat 运行服务器
<subsystem xmlns="urn:infinispan:server:core:8.1">
<cache-container name="local" default-cache="default" statistics="true">
...
<local-cache name="testCache">
<compatibility/>
</local-cache>
</<cache-container>
<subsystem>
In client side, accessing the cache sucessfully using hotrod client like below code.
Configuration config = new ConfigurationBuilder().addServer().host("127.0.0.1").port(11222).build();
RemoteCacheManager cacheManager = new RemoteCacheManager(config);
RemoteCache<Integer, TestEntity> cache = cacheManager.getCache("testCache");
1. How to configure jpa-store (with load from database and write into database) in standalone.xml?
I have tried with below code in standalone.xml.
<persistence passivation="false">
<jpa-store xmlns="urn:infinispan:config:store:jpa:8.0"
shared="true" preload="true"
persistence-unit="CachePersistenceUnit"
entity-class="TestEntity"
singleton="false"
batch-size="1">
</jpa-store>
</persistence>
引起:javax.xml.stream.XMLStreamException: WFLYCTL0198: 在 org.jboss.as.controller.parsing.ParseUtils.unexpectedElement(ParseUtils.java:89 遇到意外的元素'{urn:infinispan:server:core:8.1}persistence' ) 在 org.jboss.as.clustering.infinispan.subsystem.InfinispanSubsystemXMLReader.parseLocalCache(InfinispanSubsystemXMLReader.java:706) 在 org.jboss.as.clustering.infinispan.subsystem.InfinispanSubsystemXMLReader.parseCacheElement(InfinispanSubsystemXMLReader.java:971)。 jboss.as.clustering.infinispan.subsystem.InfinispanSubsystemXMLReader.parseContainer(InfinispanSubsystemXMLReader.java:247) at org.jboss.as.clustering.infinispan.subsystem.InfinispanSubsystemXMLReader.readElement(InfinispanSubsystemXMLReader.java:97) at org.jboss.as.clustering.infinispan.subsystem.InfinispanSubsystemXMLReader.readElement(InfinispanSubsystemXMLReader.java:70) at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl. java:69) 在 org.jboss.as.server.parsing.StandaloneXml_4.readServerElement(StandaloneXml_4.java:244) 在 org.jboss. .as.server.parsing.StandaloneXml_4.readElement(StandaloneXml_4.java:143) 在 org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:69) 在 org.jboss.as.server.parsing.StandaloneXml .readElement(StandaloneXml.java:47) 在 org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) 在 org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69) 在 org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java: 123) ... 还有 3 个
- 如何在 infinispan 服务器(Jboss)中自动部署项目(定制的 infinispan 管理器类(java 类)、persistence.xml 和 infinispan-config.xml)?