0

I'm migrating from Wildfly 8.2 to 10.1 Unfortunately, I'm encountering problems with Infinispan TreeCache.

Here are several issues:

  1. Invocation batching is no longer supported in Wildfly 10 configuration

Here's my config:

<subsystem xmlns="urn:jboss:domain:infinispan:4.0">
...
  <cache-container name="my_container" default-cache="my_tree_cache" jndi-name="java:jboss/my_container">
      <transport lock-timeout="60000"/>
      <local-cache name="my_cache"/> 
      <local-cache name="my_tree_cache" batching="true"/> 
  </cache-container>
</subsystem>

Error on startup:

> Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[345,17] 
> Message: WFLYCTL0197: Unexpected attribute 'batching' encountered
  1. If I remove "batching" attribute. I get this error:
com.daiwacm.modjsf.dataaccess.DataException: getTreeCache has failed for jndi value (my_tree_cache)
Caused by: org.infinispan.commons.CacheConfigurationException: invocationBatching is not 
enabled for cache 'my_tree_cache'. Make sure this is enabled by calling configurationBuilder.invocationBatching().enable()
  1. If I set batching programmatically:
Context context = new InitialContext();
CacheContainer cacheContainer = (CacheContainer) context.lookup(jndiName);
TreeCacheFactory tcf = new TreeCacheFactory();
Cache cache = cacheContainer.getCache(cacheName);
cache.getCacheManager().defineConfiguration(cacheName, 
     new ConfigurationBuilder().read(cache.getCacheConfiguration()).invocationBatching().enable().build());
TreeCache treeCache = tcf.createTreeCache(cache);

I get this error:

> Caused by: org.infinispan.commons.CacheConfigurationException:
> ISPN000381: This configuration is not supported for simple cache
>         at org.infinispan.configuration.cache.ConfigurationBuilder.validateSimpleCacheConfiguration(ConfigurationBuilder.java:219)
> ...
>         at org.infinispan.configuration.cache.InvocationBatchingConfigurationBuilder.build(InvocationBatchingConfigurationBuilder.java:12)
> ...
jersey-city-ninja
  • 1,038
  • 11
  • 23

1 Answers1

0

Don't set the configuration programmatically; I am not sure this is a valid approach, despite it seems to ~work.

The configuration option you're looking for is

<local-cache name="my_cache"> 
    <transaction transaction-mode="BATCH" />
</local-cache>

(please consult the schema in docs/schema/jboss-as-infinispan_4_0.xsd should you have any doubts)

The last problem is that for local caches, WF automatically enables certain optimizations when it's possible. When you redefine the cache programmatically, this optimization (simple cache) is set on. So you'd have to set

new ConfigurationBuilder().read(cache.getCacheConfiguration())
    .simpleCache(false)
    .invocationBatching().enable()
Radim Vansa
  • 5,686
  • 2
  • 25
  • 40
  • Sorry, both does not work. (Note: First one should be for wildfly to start up.) I get the same errors. – jersey-city-ninja Jun 09 '17 at 17:15
  • I admit I haven't tried, but 'does not work' is not enough, please edit your question with the errors with suggested solution. – Radim Vansa Jun 12 '17 at 08:35
  • @jersey-city-ninja, Flavius is trying to help, so it'd help if you'd tell us what your outstanding errors are. For things to work, you should try to configure the cache via the standalone XML file (following the xsd) since that covers the elements that are allowed. XSD can be found [here](https://github.com/wildfly/wildfly/blob/10.x/clustering/infinispan/extension/src/main/resources/schema/jboss-as-infinispan_4_0.xsd). – Galder Zamarreño Jun 14 '17 at 12:50
  • The error is the same as before "org.infinispan.commons.CacheConfigurationException: invocationBatching is not enabled for cache 'my_tree_cache' ..." – jersey-city-ninja Jun 16 '17 at 16:34