3 Replies Latest reply on Oct 22, 2015 10:34 AM by wdfink

    Info about SimpleSingletonElectionPolicy

    leonets

      Hi all,

       

      I have a problem using the SingletonElectionPolicy.

       

      First, I tried to modify the hasingleton service for including it in my application where I added the following dependencies.

      I moved the java files and renamed the package, I moved the meta-inf directory and updated the package inside the file org.jboss.msc.service.ServiceActivator.

      The 'example' has been moved inside an 'EJBModule' in an Enterprise application.

       

      org.jboss.msc, jboss-msc, 1.2.6.Final, provided

      org.jboss.spec.javax.ejb,jboss-ejb-api_3.1_spec,1.0.2.Final-redhat-3,provided

      org.jboss.spec.javax.annotation, jboss-annotations-api_1.1_spec,1.0.1.Final-redhat-3,provided

      org.jboss.as,jboss-as-clustering-singleton,7.5.0.Final-redhat-21,provided

      org.jboss.as, jboss-as-logging,7.5.0.Final-redhat-21


      If I set 'provided' I get a LinkageError


      Caused by: java.lang.LinkageError: loader constraint violation:

      when resolving method "org.jboss.as.clustering.singleton.SingletonService.<init>

      (Lorg/jboss/msc/service/Service;Lorg/jboss/msc/service/ServiceName;)V"

       

       

       

       

      the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class,

      it/example/cluster/timer/HATimerServiceActivator,

       

       

      and the class loader (instance of org/jboss/modules/ModuleClassLoader) for resolved class,

      org/jboss/as/clustering/singleton/SingletonService,

      have different Class objects for the type org/jboss/msc/service/Service used in the signature


      While if I DO NOT set 'provided' I instead get a ClassNotFound


      Caused by: java.lang.ClassNotFoundException: org.jboss.as.clustering.singleton.SingletonElectionPolicy from [Module "


      I am using EAP 6.4, any idea ?

      the jboss-as-clustering-singleton artifact ishould be provided or not ?


      thks in advance


       

      I answer by myself ... You need to add the modules to the jboss-deployment.xml          <module name="org.jboss.as.clustering.service" export="true" />          <module name="org.jboss.as.clustering.singleton" export="true" />          <module name="org.jboss.msc" export="true" />

        • 1. Re: Info about SimpleSingletonElectionPolicy
          wdfink

          I don't have a clear understanding right now, but it seems like a packaging issue.

          Did you package any *jboss* class in your ear/jar, sometimes maven do this by accident.

           

          Do you have a small example to share?

          As you use EAP I suppose you have a subscription, in that case you might open a case in the portal.

          • 2. Re: Info about SimpleSingletonElectionPolicy
            leonets

            Yes it is a packaging problem.


            I resolved the ClassNotFound by adding all the needed modules to the jboss-deployment-structure.xml         

            <module name="org.jboss.as.clustering.service" export="true" />         

            <module name="org.jboss.as.clustering.singleton" export="true" />         

            <module name="org.jboss.msc" export="true" />

            • 3. Re: Info about SimpleSingletonElectionPolicy
              wdfink

              You should mark the answer as "correct", makes it easier for others