I'm developing a web application distributed on multi nodes with java 8 and java ee7 on wildfly-11.0.0.Final, and i used infinispan cache for share data. This is the configuration of cache:
<cache-container name="mycache-container" default-cache="my-cache" jndi-name="infinispan/mycache-container">
<transport lock-timeout="60000"/>
<replicated-cache name="my-cache" jndi-name="infinispan/mycache-container/my-cache" mode="ASYNC">
<locking isolation="READ_COMMITTED"/>
<transaction locking="OPTIMISTIC" mode="NON_XA"/>
<eviction strategy="NONE"/>
</replicated-cache>
</cache-container>
And this is the configuration of jgroups subsystem used for replicated cache:
<subsystem xmlns="urn:jboss:domain:jgroups:5.0">
<channels default="ee">
<channel name="ee" stack="tcpping" cluster="ejb"/>
</channels>
<stacks>
<stack name="tcpping">
<transport type="TCP" socket-binding="jgroups-tcp"/>
<protocol type="org.jgroups.protocols.TCPPING">
<property name="initial_hosts">
node1[7600], node2[7600]
</property>
</protocol>
<protocol type="MERGE3"/>
<protocol type="FD_SOCK"/>
<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="MFC"/>
<protocol type="FRAG2"/>
</stack>
</stacks>
</subsystem>
On the application's startup i load all entity from database and put in the cache. If i inject cache through container in this way:
@Resource(lookup="java:jboss/infinispan/mycache-container")
EmbeddedCacheManager container;
@PostConstruct
public void init(){
Cache mycache = container.getCache();
}
the app start and load all objects in cache without problem, but in the other nodes these objects are not replicated also that jgroups cluster is created wihout errors. Instead if i inject cache directly in this way:
@Resource(lookup="java:jboss/infinispan/mycache-container/my-cache")
Cache myCache;
the app in startup give me this error: "WFLYCTL0348: Timeout after [300] seconds waiting for service container stability. Operation will roll back. Step that first updated the service; and the server not start"
How should I use the cache to prevent timeout on startup and be able to replicate that objects on all nodes?
Thank you.