我正在从通配符10迁移到通配符12,我已经创建了与在通配符10中配置的相同的本地缓存。
独立的-Ful.xml配置:
<cache-container name="DataCache" default-cache="modelcache" statistics-enabled="false">
<local-cache name="modelcache" statistics-enabled="false"/>
</cache-container>
在带有@startup注释的单例ejb中查找代码:
@Resource(lookup = "java:jboss/infinispan/container/DataCache")
private CacheContainer Container;
@PostConstruct
public void init() {
Container.start();
modelCache = Container.getCache("modelcache");
}
我在部署文件时得到了下面的异常
原因如下:
org.infinispan.commons.CacheConfigurationException: ISPN000436:已请求缓存‘模型缓存’,但没有使用该名称的缓存配置,也没有为该容器设置默认缓存。
怎么解决这个问题?
发布于 2018-07-27 00:30:24
放
<resource-ref>
<res-ref-name>infinispan/DataCache</res-ref-name>
<lookup-name>java:jboss/infinispan/cache/DataCache/modelcache</lookup-name>
</resource-ref>
在jboss-web.xml
中。当请求缓存时,这样做(请注意,name
注释属性用于指定资源):
@Resource(name = "infinispan/DataCache")
private Cache<K, V> cache;
有关更多细节,请参见此线程:https://developer.jboss.org/thread/277425
发布于 2018-07-16 12:57:43
将以下条目放入项目描述符文件(web.xml、ejb-jar.xml等)
<resource-ref>
<res-ref-name>infinispan/DataCache</res-ref-name>
<lookup-name>java:jboss/infinispan/container/DataCache</lookup-name>
</resource-ref>
发布于 2021-07-10 13:47:09
对于通配符10,您可以通过以下方式查找无穷大缓存或缓存容器
<cache-container name="myCacheContainer" default-cache="myCache" module="org.wildfly.clustering.ejb.infinispan">
<transport lock-timeout="60000"/>
<replicated-cache name="myCache">
<expiration lifespan="86400000" max-idle="3600000"/>
</replicated-cache>
</cache-container>
https://stackoverflow.com/questions/49773927
复制