wildflyjboss-arquillianwildfly-10ejb-3.2

Arquillian Integration with WildFly 10


Can anyone please guide me on how to use Arquillian with WildFly 10. I have recently migrated my application from JBoss 7 to WildFly 10. Arquillian used to work with JBoss 7, but the same configuration is not working on WildFly 10.

I am able to integrate now, however my EJBs with JNDI names as "java:global/xyz/xyzEMFactor" is failing with following error:

Caused by: java.lang.Exception: {"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.test.test.env.\"com.xyz.abc.poc.knowledge_ba‌​se.ontology.DBContex‌​tBean\".emFactory is missing [jboss.naming.context.java.global.xyz_dal.xyzpEMFactory‌​]"]} at org.jboss.as.controller.client.helpers.standalone.impl.Serve‌​rDeploymentPlanResul‌​tFuture.getActionRes‌​ult(ServerDeployment‌​PlanResultFuture.jav‌​a:134)

Following is my class:

@AccessTimeout(5 * 60 * 60 * 1000)
@StatefulTimeout(-1)
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class DBContextBean<T> {
    @Inject
    @EJB(lookup = "java:global/xyz_dal/xyzEMFactory")
    private xyzEMFactory emFactory;
}

Solution

  • It was because, The testable war file, i was creating a jar as,

    @Deployment(name = "xyz_dal", order = 3)
    public static Archive<?> createDeployment() {
        JavaArchive jar = ShrinkWrap.create(JavaArchive .class, "xyz_dal.jar")
                .addClasses(xyzEMFactory.class, DBContextBean.class, xyzDao.class)
                .addPackages(true, "com.xyz.abc.poc.entities")
                .addAsResource("test-persistence.xml", "META-INF/persistence.xml")
                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml").setManifest(new Asset() {
                    @Override
                    public InputStream openStream() {
                        // dependency management
                        return ManifestBuilder.newInstance()
                                .addManifestHeader("Dependencies", "xyz,javax.api,deployment.abc_common.jar")
                                .openStream();
                    }
                });
        return jar;
    }
    

    It worked when i changed it to

    @Deployment(name = "xyz_dal", order = 3)
    public static Archive<?> createDeployment() {
        WebArchive jar = ShrinkWrap.create(WebArchive.class, "xyz_dal.war")
                .addClasses(xyzpEMFactory.class, DBContextBean.class, xyzDao.class)
                .addPackages(true, "com.xyz.abc.poc.entities")
                .addAsResource("test-persistence.xml", "META-INF/persistence.xml")
                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml").setManifest(new Asset() {
                    @Override
                    public InputStream openStream() {
                        // dependency management
                        return ManifestBuilder.newInstance()
                                .addManifestHeader("Dependencies", "xyz,javax.api,deployment.abc_common.jar")
                                .openStream();
                    }
                });
        return jar;
    }
    

    It was because when i was creating a testable jar,the container wraps the jar in a test.war, and hence the context "java:global/xyz/xyzEMFactory" was not available.