[英]Wildfly 10 Infinispan TreeCache is not working
I'm migrating from Wildfly 8.2 to 10.1 Unfortunately, I'm encountering problems with Infinispan TreeCache. 我正在从Wildfly 8.2迁移到10.1,不幸的是,我在使用Infinispan TreeCache时遇到问题。
Here are several issues: 这里有几个问题:
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
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()
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)
> ...
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) (如有疑问,请查阅
docs/schema/jboss-as-infinispan_4_0.xsd
)
The last problem is that for local caches, WF automatically enables certain optimizations when it's possible. 最后一个问题是,对于本地缓存,WF在可能的情况下自动启用某些优化。 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()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.