0

Issue: Try to configure infinspan cache with jpa-store and hibernate OGM. I can able to access the infinispan server cache through hotrod client with simple cache store, the configuration is follows,

I have configured following in ..\infinispan-server-8.1.0.CR1\standalone\configuration\standalone.xml and run the server by command ../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>

Caused by: javax.xml.stream.XMLStreamException: WFLYCTL0198: Unexpected element '{urn:infinispan:server:core:8.1}persistence' encountered at org.jboss.as.controller.parsing.ParseUtils.unexpectedElement(ParseUtils.java:89) at org.jboss.as.clustering.infinispan.subsystem.InfinispanSubsystemXMLReader.parseCacheElement(InfinispanSubsystemXMLReader.java:971) at org.jboss.as.clustering.infinispan.subsystem.InfinispanSubsystemXMLReader.parseLocalCache(InfinispanSubsystemXMLReader.java:706) at org.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) at org.jboss.as.server.parsing.StandaloneXml_4.parseServerProfile(StandaloneXml_4.java:547) at org.jboss.as.server.parsing.StandaloneXml_4.readServerElement(StandaloneXml_4.java:244) at org.jboss.as.server.parsing.StandaloneXml_4.readElement(StandaloneXml_4.java:143) at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:69) at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:47) at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69) at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:123) ... 3 more

  1. How to auto deploy project (customized infinispan manager class(java class), persistence.xml and infinispan-config.xml) in infinispan server(Jboss)?
Sats
  • 115
  • 1
  • 3
  • 13

1 Answers1

0

The two questions are actually related:

Infinispan Server is designed as a backend data store and hence it's not designed to have applications deployed on it.

With that in mind, since you can't deployed applications onto it, you can't deploy JPA entities and hence it does not make sense to be able to configure a JPA cache store in Server mode.

You are able to deploy JPA entities on Wildfly/EAP or similar environments, where it is possible to deploy an Infinispan based application (see tutorials here) and configure a JPA store.

Cheers, Galder

Galder ZamarreƱo
  • 5,027
  • 2
  • 26
  • 34