Я пытаюсь создать локальный кеш бесконечности, и я знаю, что для этого требуется внести изменения в config.xml wildfly. Я пытался это сделать, и когда я пытаюсь получить доступ к этому кешу, он показывает, что кеш недоступен. Я не знаю, что я делаю неправильно, может кто-нибудь помочь мне в этом.
Изменения в файле config.xml
<subsystem xmlns="urn:jboss:domain:infinispan:2.0">
<cache-container name="web" aliases="standard-session-cache" default-cache="local-web" module="org.wildfly.clustering.web.infinispan">
</cache-container>
<cache-container name="hibernate" default-cache="local-query" module="org.hibernate">
</cache-container>
//This is my local cache
<cache-container name="myCache" default-cache="cachedb">
<local-cache name="cachedb"/>
</cache-container>
</subsystem>
Вот код для доступа к кешу
@Stateless
public class SimpleCache {
@Resource(lookup="java:jboss/infinispan/container/myCache")
private CacheContainer container;
private org.infinispan.Cache<String, String> cache;
@PostConstruct
public void initCache() {
this.cache = container.getCache();
}
public String get(String key) {
return this.cache.get(key);
}
public void put(String key, String value) {
this.cache.put(key, value);
}
}
Ошибка:
java:global/InfinispanTest/SimpleCache!SimpleCache
java:app/InfinispanTest/SimpleCache!SimpleCache
java:module/SimpleCache!SimpleCache
java:global/InfinispanTest/SimpleCache
java:app/InfinispanTest/SimpleCache
java:module/SimpleCache
17:05:09,721 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "InfinispanTest.war" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.InfinispanTest.InfinispanTest.env.SimpleCache.containerjboss.naming.context.java.jboss.infinispan.container.myCacheMissing[jboss.naming.context.java.module.InfinispanTest.InfinispanTest.env.SimpleCache.containerjboss.naming.context.java.jboss.infinispan.container.myCache]"]}
17:05:09,769 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment InfinispanTest.war in 45ms
17:05:09,770 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.jboss.infinispan.container.myCache (missing) dependents: [service jboss.naming.context.java.module.InfinispanTest.InfinispanTest.env.SimpleCache.container]
17:05:09,772 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.InfinispanTest.InfinispanTest.env.SimpleCache.containerjboss.naming.context.java.jboss.infinispan.container.myCacheMissing[jboss.naming.context.java.module.InfinispanTest.InfinispanTest.env.SimpleCache.containerjboss.naming.context.java.jboss.infinispan.container.myCache]"]}}}
Вы вкладываете в свой проект бесконечные зависимости?
Вставьте свой META_INF/MANIFEST.MF:
dependencies: org.infinispan export