0

I am attempting to use the jdbc-store type for my session cache in Wildfly 15+.

I ran the following commands to configure my standalone-full-ha.xml configuration file:

/subsystem=infinispan/cache-container=web/invalidation-cache=jdbc/:add(mode=SYNC)
/subsystem=infinispan/cache-container=web/invalidation-cache=jdbc/store=none:remove(){allow-resource-service-restart=true}
/subsystem=infinispan/cache-container=web/invalidation-cache=jdbc/store=jdbc/:add(data-source="...",passivation=false,shared=true){allow-resource-service-restart=true}
/subsystem=infinispan/cache-container=web/invalidation-cache=jdbc/component=transaction/:add()
/subsystem=infinispan/cache-container=web/invalidation-cache=jdbc/component=transaction/:write-attribute(name=mode,value=BATCH)
/subsystem=infinispan/cache-container=web:write-attribute(name=default-cache,value=jdbc)

... which produces the following in the configuration file:

<cache-container name="web" default-cache="jdbc" module="org.wildfly.clustering.web.infinispan">
    <transport lock-timeout="60000"/>
    <invalidation-cache name="jdbc">
        <transaction mode="BATCH"/>
        <jdbc-store data-source="..." passivation="false" shared="true">
            <table/>
        </jdbc-store>
    </invalidation-cache>
    <distributed-cache name="dist">
        <locking isolation="REPEATABLE_READ"/>
        <transaction mode="BATCH"/>
        <file-store/>
    </distributed-cache>
</cache-container>

It looks like I've configured the cache correctly using JBoss CLI, but when the cluster instances start-up, the session store table is not created in the database, even though everything starts up properly.

My question is, is there something that I should be setting in the <table/> element that I'm just overlooking? Looking at the documentation, I don't see any required attributes, or anything about auto-creation.

I've looked at previous examples of how to achieve this in Wildfly 11, but the string-keyed-jdbc-store element no longer seems to be valid. I know the Infinispan documentation mentions the create-on-start attribute on the string-keyed-table element, but this configuration is so wildly different in Wildfly that it's completely unhelpful.

  • The issue here might be that [ISPN-5267](https://issues.jboss.org/browse/ISPN-5267) was not ported over to WildFly. A workaround here would be to deploy Infinispan along with your application instead of using Infinispan provided by WildFly. By doing so you'll be able to use the configuration that you linked above. – Galder Zamarreño May 13 '19 at 16:17
  • Infinispan instances defined by WildFly are primarily designed for WildFly's internal use cases. Hence why some things might be missing there, because they're not used by WildFly itself. Any gaps should be addressed by deploying your own Infinispan instances and managing lifecycle within your own app. They can still of course talk to datasources in WildFly. – Galder Zamarreño May 13 '19 at 16:18
  • @GalderZamarreño Do you mean deploying it as a standalone server, or is there a way to deploy a non-embedded copy of Infinispan to Wildfly? – Jonathan Putney May 22 '19 at 18:22
  • 1
    No need for a standalone server. Just bundle Infinispan core and commons and any other embedded dependencies with your app, set it up and do what you need to do. – Galder Zamarreño May 24 '19 at 15:27

1 Answers1

0

Add

<property name="createTableOnStart">
    true
</property>

in your jdbc-store element and make sure your web.xml is <distributable />

zunder369
  • 1
  • 1