Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

SKP's Java/JEE Gotchas: Manifest Dependencies

DZone's Guide to

SKP's Java/JEE Gotchas: Manifest Dependencies

If you're using Arqullian, ShrikWrap, Infinispan, and WildFly and find yourself plagued by illegal argument exceptions, your manifest might be your answer.

· Java Zone
Free Resource

Navigate the Maze of the End-User Experience and pick up this APM Essential guide, brought to you in partnership with CA Technologies

This issue troubled me for almost half a day, so this should be helpful for anyone using Arquillian, ShrinkWrap, and Infinispan with WildFly.

Caused by: javax.ejb.EJBException: java.lang.IllegalArgumentException: 
Can not set org.infinispan.manager.CacheContainer 
field com.psl.roddy.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.roddy.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. 

Thrive in the application economy with an APM model that is strategic. Be E.P.I.C. with CA APM.  Brought to you in partnership with CA Technologies.

Topics:
java ,arquillian ,dependency management ,infinispan ,wildfly

Published at DZone with permission of Sumith Puri, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}