This will only work for a top-level deployment, as described here. You may need to move the org.infinispan
dependency to the relevant sub-deployment
section:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
...
<!-- This corresponds to the top level deployment. For a war this is the war's module, for an ear -->
<!-- This is the top level ear module, which contains all the classes in the EAR's lib folder -->
<deployment>
<dependencies>
...
</dependencies>
</deployment>
<sub-deployment name="myapp.war">
<!-- This corresponds to the module for a web deployment -->
<!-- it can use all the same tags as the <deployment> entry above -->
<dependencies>
<module name="org.infinispan" slot="main" />
</dependencies>
</sub-deployment>
...
</jboss-deployment-structure>