When trying to deploy EJB with Arquillian, ShrikWrap it causes the following issue:
Service jboss.naming.context.java.module.test.test.EJBContext is already registered
The reason found when debugging was that, we were using separate custom EJBContext class in our context and somehow Arquillian's ShrinkWrap deploys a test.war which tries to re-register EJBContext which is then failing to complete the deployment process.
Throughout the debugging following bidingName is trying to redeploy to the container ("java:module/EJBContext")
My question is; Is there any way to avoid such duplication of deployment with Arquillian. or any better solution how to overcome this issue?
Used sample custom Context for EJB:
@Singleton
public class EJBContext
{
public EJBContext() {
}
}
Error log:
org.jboss.arquillian.container.spi.client.container.DeploymentException: Cannot deploy test.war: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"test.war\".INSTALL" => "WFLYSRV0153: Failed to process phase INSTALL of deployment \"test.war\"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEE0052: Failed to install component EJBContext
Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.naming.context.java.module.test.test.EJBContext is already registered"},"WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"test.war\".beanmanager","jboss.deployment.unit.\"test.war\".WeldStartService"],"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"test.war\".batch.artifact.factory is missing [jboss.deployment.unit.\"test.war\".beanmanager]","jboss.deployment.unit.\"test.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"test.war\".beanmanager, jboss.deployment.unit.\"test.war\".WeldStartService]"]}}}