Friday, April 24, 2015

Manifest Dependencies (Arquillian ShrinkWrap) in Wildfly using Infinispan

Troubled almost half a day by this issue. Should be helpful for all using Arquillian, ShrinkWrap, Infinispan on Wildlfly.

Caused by: javax.ejb.EJBException: java.lang.IllegalArgumentException: 
Can not set org.infinispan.manager.CacheContainer 
field com.psl.radia.gw.cache.manager.CacheManager.cacheContainer 
to org.jboss.as.clustering.infinispan.DefaultCacheContainer

Caused by: java.lang.IllegalArgumentException: 
Can not set org.infinispan.manager.CacheContainer 
field com.psl.radia.gw.cache.manager.CacheManager.cacheContainer 
to org.jboss.as.clustering.infinispan.DefaultCacheContainer


These are the list of steps to be followed to resolve this:

1. Add the MANIFEST.MF to src/test/resources with this content [MANIFEST.MF]
 
Dependencies: org.infinispan export 


2. Modify the standalone.xml or standalone-full.xml [WILDFLY/INFINISPAN]
 
Your standalone-full.xml will already have the following entry
 
<subsystem xmlns="urn:jboss:domain:ee:2.0">
...
</subsystem>

Add the following within the <subsystem> tags:
 
<global-modules> 
    <module name="org.infinispan" slot="main"/>
</global-modules>

 
3. To the Test Case/Deployment, Add the following  [ARQUILLIAN]
 
WebArchive res = ShrinkWrap.create(WebArchive.class, "test.war");        
...
res.addAsManifestResource("MANIFEST.MF");


This is the ONLY way to achieve this, though you may find suggestions all over that require you to change the pom.xml (maven-jar-plugin, maven-ejb-plugin,maven-war-plugin) or that suggest the use of adding the string (Dependencies: org.infinispan export) directly to the MANIFEST.MF created by Arquillian Test Case. 

No comments: