0 Replies Latest reply on Aug 8, 2014 6:26 AM by Trond G. Ziarkowski

    JNDI lookup from a ServiceActivator implementation

    Trond G. Ziarkowski Newbie

      Hi all!


      I'm in the process of upgrading from JBossAS 7.1.2 (built from source) to WildFly 8.1. My project uses a few cluster-ha-singleton services that has previously been "bootstrapped" from an ejb:


      public class SingletonServiceStartup {
       private MyHelper fromSameModule;
       private MySecondHelper fromOtherModule;
        public void installServices() {
          SingletonService<UUID> singleton = new SingletonService<UUID>(service, serviceName);


      This code fails in WildFly and the cluster-ha-singleton quick start shows that I need to implement a ServiceActivator instead:


      public class SingletonServiceActivator implements ServiceActivator {
       public void activate(ServiceActivatorContext context) {
         MyHelper fromOtherModule = InitialContext.doLookup("java:global/my-ear-file/other-module/MyHelper"); // This works fine
         MySecondHelper fromSameModule = InitialContext.doLookup("java:global/my-ear-file/my-module/MySecondHelper"); // Throws NameNotFoundException


      My app is packaged with 2 jar files within an ear file like this:


      |-- other-module.jar
      |-- my-module.jar
       |-- SingletonServiceActivator.class
       |-- META-INF
         |-- services
           |-- org.jboss.msc.service.ServiceActivator


      So basically I can perform JNDI lookups in SingletonServiceActivator of EJB's in other-module.jar, but not from my-module.jar.


      Bug or feature? Any suggestions of a workaround?