您好我使用来自wildfly 10的infnispan subsytem来进行缓存配置。 使用本地缓存它工作正常。 现在我有一个在服务器之间集群缓存的方案。 这是我的subssytem配置
<cache-container name="myCache" default-cache="default">
<transport lock-timeout="60000" stack="tcp"/>
<replicated-cache name="default" mode="SYNC">
<locking isolation="REPEATABLE_READ"/>
</replicated-cache>
</cache-container>
这是我在standalone-ha.xml中的jgroups子系统配置
<subsystem xmlns="urn:jboss:domain:jgroups:4.0">
<channels default="ee">
<channel name="ee" stack="udp"/>
</channels>
<stacks>
<stack name="udp">
<transport type="UDP" socket-binding="jgroups-udp"/>
<protocol type="PING"/>
<protocol type="MERGE3"/>
<protocol type="FD_SOCK" socket-binding="jgroups-udp-fd"/>
<protocol type="FD_ALL"/>
<protocol type="VERIFY_SUSPECT"/>
<protocol type="pbcast.NAKACK2"/>
<protocol type="UNICAST3"/>
<protocol type="pbcast.STABLE"/>
<protocol type="pbcast.GMS"/>
<protocol type="UFC"/>
<protocol type="MFC"/>
<protocol type="FRAG2"/>
</stack>
<stack name="tcp">
<transport type="TCP" socket-binding="jgroups-tcp"/>
<protocol type="MPING" socket-binding="jgroups-mping"/>
<protocol type="MERGE3"/>
<protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/>
<protocol type="FD"/>
<protocol type="VERIFY_SUSPECT"/>
<protocol type="pbcast.NAKACK2"/>
<protocol type="UNICAST3"/>
<protocol type="pbcast.STABLE"/>
<protocol type="pbcast.GMS"/>
<protocol type="MFC"/>
<protocol type="FRAG2"/>
</stack>
</stacks>
</subsystem>
如果我不在cachecontainer中使用传输,缓存将被初始化。 正如文档中所建议的,trasnport标签必须具有集群缓存。在cachecontainer中使用传输标记后面临以下错误。
19:26:14,244 ERROR [stderr] (ServerService Thread Pool -- 70) javax.naming.NameNotFoundException: infinispan/container/myCache [Root exception is java.lang.IllegalStateException]
19:26:14,244 ERROR [stderr] (ServerService Thread Pool -- 70) at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:153)
19:26:14,244 ERROR [stderr] (ServerService Thread Pool -- 70) at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:83)
19:26:14,244 ERROR [stderr] (ServerService Thread Pool -- 70) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)
19:26:14,244 ERROR [stderr] (ServerService Thread Pool -- 70) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)
19:26:14,245 ERROR [stderr] (ServerService Thread Pool -- 70) at org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:237)
19:26:14,245 ERROR [stderr] (ServerService Thread Pool -- 70) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:193)
19:26:14,245 ERROR [stderr] (ServerService Thread Pool -- 70) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:189)
19:26:14,245 ERROR [stderr] (ServerService Thread Pool -- 70) at javax.naming.InitialContext.lookup(InitialContext.java:417)
19:26:14,246 ERROR [stderr] (ServerService Thread Pool -- 70) at javax.naming.InitialContext.lookup(InitialContext.java:417)
19:26:14,246 ERROR [stderr] (ServerService Thread Pool -- 70) at com.sixdee.infinispan.cluster.Initialiser.initialiseCache(Initialiser.java:35)
19:26:14,246 ERROR [stderr] (ServerService Thread Pool -- 70) at com.sixdee.infinispan.cluster.Initialiser.init(Initialiser.java:26)
19:26:14,247 ERROR [stderr] (ServerService Thread Pool -- 70) at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
19:26:14,247 ERROR [stderr] (ServerService Thread Pool -- 70) at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)
19:26:14,247 ERROR [stderr] (ServerService Thread Pool -- 70) at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)
19:26:14,247 ERROR [stderr] (ServerService Thread Pool -- 70) at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:231)
19:26:14,248 ERROR [stderr] (ServerService Thread Pool -- 70) at io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:132)
19:26:14,248 ERROR [stderr] (ServerService Thread Pool -- 70) at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:526)
19:26:14,248 ERROR [stderr] (ServerService Thread Pool -- 70) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:101)
19:26:14,249 ERROR [stderr] (ServerService Thread Pool -- 70) at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
19:26:14,249 ERROR [stderr] (ServerService Thread Pool -- 70) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
19:26:14,249 ERROR [stderr] (ServerService Thread Pool -- 70) at java.util.concurrent.FutureTask.run(FutureTask.java:266)
19:26:14,249 ERROR [stderr] (ServerService Thread Pool -- 70) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
19:26:14,250 ERROR [stderr] (ServerService Thread Pool -- 70) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
19:26:14,250 ERROR [stderr] (ServerService Thread Pool -- 70) at java.lang.Thread.run(Thread.java:745)
19:26:14,251 ERROR [stderr] (ServerService Thread Pool -- 70) at org.jboss.threads.JBossThread.run(JBossThread.java:320)
19:26:14,251 ERROR [stderr] (ServerService Thread Pool -- 70) Caused by: java.lang.IllegalStateException
19:26:14,252 ERROR [stderr] (ServerService Thread Pool -- 70) at org.jboss.msc.value.InjectedValue.getValue(InjectedValue.java:47)
19:26:14,252 ERROR [stderr] (ServerService Thread Pool -- 70) at org.jboss.as.naming.service.BinderService.getValue(BinderService.java:138)
19:26:14,252 ERROR [stderr] (ServerService Thread Pool -- 70) at org.jboss.as.naming.service.BinderService.getValue(BinderService.java:46)
19:26:14,252 ERROR [stderr] (ServerService Thread Pool -- 70) at org.jboss.msc.service.ServiceControllerImpl.getValue(ServiceControllerImpl.java:1158)
19:26:14,253 ERROR [stderr] (ServerService Thread Pool -- 70) at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:131)
19:26:14,253 ERROR [stderr] (ServerService Thread Pool -- 70) ... 24 more
在我的代码中初始化缓存如下
Context initContext = new InitialContext();
initContext.lookup("java:jboss/infinispan/container/myCache")).getCache());
以下是我的jboss-deployment-structure.xml
<jboss-deployment-structure>
<deployment>
<exclusions>
</exclusions>
<dependencies>
<module name="org.infinispan" export="true" />
</dependencies>
</deployment>
</jboss-deployment-structure>
使用standalone-ha.xml启动应用程序
关于我错在哪里的任何建议?