Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-83024

Unsafe to call *ServiceUtil methods in Kaleo Designer component activations and message listeners

Details

    Description

      Service builder components aren't published to OSGi until after the proper Release table entries have been added/updated.

      Therefore, if you invoke ServiceUtil methods from an OSGi component, both directly and indirectly (via a static util class, for example), you inadvertently hide a dependency on the underlying service builder service implementation being available. Even if you wait until the component activates (all of its dependencies are satisfied), there is also no guarantee that the service tracker in the ServiceUtil class has been notified, resulting in a NullPointerException.

      Similarly, if you invoke ServiceUtil methods from Spring beans, both directly and indirectly (via a static util class, for example), you inadvertently introduce a dependency where the Spring bean isn't technically ready until it has been published to OSGi, but everything that relies only on Spring will begin making method calls on it, because all of the Spring-managed parts of the lifecycle are complete. Whether you see any errors amounts to a race condition.

      Attachments

        Activity

          People

            harry.chai Harry Chai
            minhchau.dang Minhchau Dang
            Kiyoshi Lee Kiyoshi Lee
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              4 years, 14 weeks, 1 day ago

              Packages

                Version Package
                7.0.0 DXP FP55
                7.0.0 DXP SP9
                7.0.X