Problem with TimerService(duplicated resource)
ziemianin4 Jul 28, 2016 6:21 AMHi,
I found a problem with TimerService that occurs when your application is configured as a singleton deployment.
Test Application
I created a small app that can be used to reproduce the problem. It is available on https://github.com/arturkowalczyk/wildfly10-timerservice-problem. The project has the following structure:
EAR
|- JAR
|- Singleton Bean that uses TimerService (TimerEJB)
Test Environment
Two Wildfly instances (master, slave) connected to a cluster. EAR application deployed as singleton deployment with a custom singleton policy - preference for a node name. EAR file deployed on both nodes.
Test Case
- Start master node, the app is also started - OK
- Start slave node, the app is deployed but bot stared - OK
- Stop master node, the app is started on slave - OK
- Start master node, there is a preference for node name so the app will be started again on master and stopped in slave - OK
- Stop master node, the app should be started again on slave but an exception occur. - ERROR
09:50:42,115 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.deployment.subunit."wildfly-ejb-in-ear.ear"."wildfly-ejb-in-ear-ejb.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."wildfly-ejb-in-ear.ear"."wildfly-ejb-in-ear-ejb.jar".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of subdeployment "wildfly-ejb-in-ear-ejb.jar" of deployment "wildfly-ejb-in-ear.ear" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEJB0086: Failed to install management resources for TimerEJB at org.jboss.as.ejb3.deployment.processors.EjbManagementDeploymentUnitProcessor.deploy(EjbManagementDeploymentUnitProcessor.java:82) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147) ... 5 more Caused by: java.lang.IllegalStateException: WFLYCTL0075: Duplicate resource timer-service at org.jboss.as.controller.registry.AbstractModelResource$DefaultResourceProvider.register(AbstractModelResource.java:290) at org.jboss.as.controller.registry.AbstractModelResource.registerChild(AbstractModelResource.java:169) at org.jboss.as.server.deployment.DeploymentResourceSupport.register(DeploymentResourceSupport.java:322) at org.jboss.as.server.deployment.DeploymentResourceSupport.registerDeploymentSubResource(DeploymentResourceSupport.java:219) at org.jboss.as.ejb3.deployment.processors.EjbManagementDeploymentUnitProcessor.installManagementResource(EjbManagementDeploymentUnitProcessor.java:119) at org.jboss.as.ejb3.deployment.processors.EjbManagementDeploymentUnitProcessor.deploy(EjbManagementDeploymentUnitProcessor.java:79) ... 6 more
It looks that the test app is not undeployed correctly on slave and as a result it cannot be deployed again in Step 5. Any ideas how can I resolve this problem?