1 Reply Latest reply on Sep 11, 2015 12:37 PM by Michal Karm Babacek

    Clustered HA Singleton timer in EAR

    Michal Karm Babacek Apprentice

      Dear fellows, could you help me understand why the undermentioned behaviour takes place, please?

      I wanted to play with a clustered HA singleton timer, to execute jobs only once on a single node within a cluster -- without any database for storing jobs metadata and locks -- but I seem to be having troubles with understanding what's wrong with the SingletonServiceBuilderFactory usage once the project is packaged in an EAR.

       

      The aforementioned repo contains two projects adopted from the Wildfly 9.x quickstarts. On my two WildFly 9.0.1.Final instances, the cluster-ha-singleton project works:

      [org.jboss.as.quickstarts.cluster.hasingleton.service.ejb.SchedulerBean] (EJB default - 9) HASingletonTimer: Info=HASingleton timer @nodeOne Fri Sep 11 03:03:22 CEST 2015
      

      whereas the project packaged as an EAR (ejb-in-ear) keeps giving:

      ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.deployment.subunit."wildfly-ejb-in-ear-ear.ear"."wildfly-ejb-in-ear-ejb.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."wildfly-ejb-in-ear-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.ear"
      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:163)
      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: java.lang.LinkageError: loader constraint violation: when resolving field "SERVICE_NAME" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the referring class, org/jboss/as/server/ServerEnvironmentService, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for the field's resolved type, org/jboss/msc/service/ServiceName, have different Class objects for that type
      at org.jboss.as.quickstarts.cluster.hasingleton.service.ejb.HATimerServiceActivator.install(HATimerServiceActivator.java:56)
      at org.jboss.as.quickstarts.cluster.hasingleton.service.ejb.HATimerServiceActivator.activate(HATimerServiceActivator.java:44)
      at org.jboss.as.server.deployment.service.ServiceActivatorProcessor.deploy(ServiceActivatorProcessor.java:74)
      at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:156)
      ... 5 more
      

      I tried to play with the factory service name and dependency without luck. As long as the service is activated with

      .setInitialMode(ServiceController.Mode.ACTIVE)
      

      it all goes south immediately on installation.

       

      Could you gimme a hand? THX.

       

      -K-

        • 1. Re: Clustered HA Singleton timer in EAR
          Michal Karm Babacek Apprentice

          O.K., I was just blind apparently. I forgot to properly configure the EAR plugin in EAR's pom:

          
          <archive>
              <addMavenDescriptor>false</addMavenDescriptor>
              <manifestEntries>
                  <Dependencies>org.jboss.msc,
                      org.wildfly.clustering.singleton,
                      org.jboss.as.server
                  </Dependencies>
              </manifestEntries>
          </archive>
          <modules>
              <ejbModule>
                  <groupId>org.wildfly.quickstarts</groupId>
                  <artifactId>wildfly-ejb-in-ear-ejb</artifactId>
                  <bundleFileName>wildfly-ejb-in-ear-ejb.jar</bundleFileName>
              </ejbModule>
          </modules>