<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>@Activation annotation not working when Bundle starts ?</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=111242747" />
  <subtitle>@Activation annotation not working when Bundle starts ?</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=111242747</id>
  <updated>2026-04-03T18:10:48Z</updated>
  <dc:date>2026-04-03T18:10:48Z</dc:date>
  <entry>
    <title>RE: @Activation annotation not working when Bundle starts ?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111292007" />
    <author>
      <name>Vishnu S Kumar</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111292007</id>
    <updated>2018-10-23T14:17:40Z</updated>
    <published>2018-10-23T14:17:40Z</published>
    <summary type="html">&lt;blockquote&gt;Are these all in the same bundle, or are they separate bundles using the same packages?&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt; All these in the same bundle</summary>
    <dc:creator>Vishnu S Kumar</dc:creator>
    <dc:date>2018-10-23T14:17:40Z</dc:date>
  </entry>
  <entry>
    <title>RE: @Activation annotation not working when Bundle starts ?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111279039" />
    <author>
      <name>David H Nebinger</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111279039</id>
    <updated>2018-10-22T23:13:36Z</updated>
    <published>2018-10-22T23:13:36Z</published>
    <summary type="html">Are these all in the same bundle, or are they separate bundles using the same packages?</summary>
    <dc:creator>David H Nebinger</dc:creator>
    <dc:date>2018-10-22T23:13:36Z</dc:date>
  </entry>
  <entry>
    <title>RE: @Activation annotation not working when Bundle starts ?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111277342" />
    <author>
      <name>Vishnu S Kumar</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111277342</id>
    <updated>2018-10-22T18:34:54Z</updated>
    <published>2018-10-22T18:34:54Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Thanks David, that was a very useful and new info. The component status says&amp;nbsp; '&lt;strong&gt;satisfied&lt;/strong&gt;', but did'nt find any reason for not being &lt;strong&gt;active&lt;/strong&gt;. The attached is the screenshot of the 'scr:info xxx' command.&lt;br&gt;&lt;br&gt;&lt;img src="/documents/14/110203810/Capture.PNG/8c2f64a5-b14c-53d2-2d5a-872687ac9728?t=1540232530556"&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;Few more info regarding our scenario. We have&lt;strong&gt; 3 different configuration interfaces&lt;/strong&gt; with unique Meta.OCD id. In order to read this configuration we have&lt;strong&gt; 3 differant reader classes&lt;/strong&gt;, the @activate methods are there in each of them for the respective config interfaces. It came into my observation that only&lt;strong&gt; one of this configuration reader class component is 'active' in the gogo shell&lt;/strong&gt;, &lt;strong&gt;other components says 'satisfied&lt;/strong&gt;'. The 'satisfied' component becomes active only if&amp;nbsp; we reactivae the project bundle from app manager (even redeploy doesn't make this components active). Two of our config interfaces and config reader classes are given below.&lt;br&gt;&lt;br&gt;ex1; config interface and its reader class&lt;br&gt;&lt;pre&gt;&lt;code&gt;@ExtendedObjectClassDefinition(category = "TH")
@Meta.OCD(name = "TH Search Config", id = "th.module.search.service.configs.SearchConfigs",
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; description = "Search Configurations", localization = "content/Language")
public interface SearchConfigs {

&amp;amp;nbsp; @Meta.AD(name = "Accordion Structure Id", required = true, deflt = "0")
&amp;amp;nbsp; public Long gid();
}
........

@Component(configurationPid = {"th.module.search.service.configs.SearchConfigs"},
&amp;amp;nbsp;&amp;amp;nbsp;    immediate = true,
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; service = ReadSearchConfig.class)
public class ReadSearchConfig&amp;amp;nbsp; {

&amp;amp;nbsp; private volatile static SearchConfigs _configuration;

&amp;amp;nbsp; @Activate
&amp;amp;nbsp; @Modified
&amp;amp;nbsp; protected void activate(Map&amp;lt;string, object&amp;gt; properties) {
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; _configuration = ConfigurableUtil.createConfigurable(SearchConfigs.class, properties);

&amp;amp;nbsp; }
}&amp;lt;/string,&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;ex 2: config interface and its reader class&lt;br&gt;&lt;pre&gt;&lt;code&gt;@ExtendedObjectClassDefinition(category = "TH")
@Meta.OCD(name = "TH Search Field  Configs",
    id = "th.module.search.service.configs.SearchFieldConfigs",
    localization = "content/Language")
public interface SearchFieldConfigs {

  @Meta.AD(name = "Description field name for accordion search results", required = false,
      deflt = "ChildContent")
  public String accordionDescriptionField();
}
........

@Component(configurationPid = {"th.module.search.service.configs.SearchFieldConfigs"},
    immediate = true,
    service = ReadSearchFieldConfig.class)
public class ReadSearchFieldConfig {

  private volatile static SearchFieldConfigs _searchFieldConfiguration

 @Activate
  @Modified
  protected void activate(Map&amp;lt;string, object&amp;gt; properties) {
    _searchFieldConfiguration =
        ConfigurableUtil.createConfigurable(SearchFieldConfigs.class, properties);
    updatesearchmetadata();
  }

}
&amp;lt;/string,&amp;gt;&lt;/code&gt;&lt;/pre&gt;&amp;nbsp;We have one more config and reader class like the above, one of them will be active and others will be 'satisfied' upon deployment. Always only one component gets active out of 'x' number of config interface reader components.&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Vishnu S Kumar</dc:creator>
    <dc:date>2018-10-22T18:34:54Z</dc:date>
  </entry>
  <entry>
    <title>RE: @Activation annotation not working when Bundle starts ?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111262416" />
    <author>
      <name>David H Nebinger</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111262416</id>
    <updated>2018-10-21T23:42:06Z</updated>
    <published>2018-10-21T23:42:06Z</published>
    <summary type="html">That doesn&amp;#39;t mean much...&lt;br /&gt;&lt;br /&gt;When you deploy, drop into gogo and list the bundles to find your bundle id.&lt;br /&gt;&lt;br /&gt;Then do &amp;#34;scr:list NN&amp;#34; where NN is your bundle id, it lists all of the components.  Verify that they are all active.  For one(s) that are not, use &amp;#34;scr:info XXX&amp;#34; where XXX is the service id (will be shown when you use the scr:list command) and it will tell you why your component(s) are not started.</summary>
    <dc:creator>David H Nebinger</dc:creator>
    <dc:date>2018-10-21T23:42:06Z</dc:date>
  </entry>
  <entry>
    <title>RE: @Activation annotation not working when Bundle starts ?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111255806" />
    <author>
      <name>Vishnu S Kumar</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111255806</id>
    <updated>2018-10-19T14:15:11Z</updated>
    <published>2018-10-19T14:15:11Z</published>
    <summary type="html">&lt;blockquote&gt;Minhchau Dang&lt;blockquote&gt;&lt;strong&gt;Why is @Activate method not triggering when the bundle (re)starts&lt;/strong&gt; in Machine 2, or sometimes @Modified also not working when the configuration is changed?&lt;/blockquote&gt;&lt;br /&gt;The &lt;strong&gt;@Activate&lt;/strong&gt; method is only called when a component activates, and a bundle can be started without the component starting. Chances are that your component has a dependency that isn&amp;#39;t satisfied on Machine 2.&lt;/blockquote&gt;&lt;br /&gt;Thanks for the reply. I don&amp;#39;t think it&amp;#39;s any dependency issuse. It&amp;#39;s not throwing any depedency error in the console as well as it works after re-actiavting the bundle from App Manager without adding any other dependencies. Both the enviroment have all same dependencies. I also tested it with the example shown in the liferay doc&amp;#39;s and got the same issue in Machine 2</summary>
    <dc:creator>Vishnu S Kumar</dc:creator>
    <dc:date>2018-10-19T14:15:11Z</dc:date>
  </entry>
  <entry>
    <title>RE: @Activation annotation not working when Bundle starts ?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111245444" />
    <author>
      <name>Minhchau Dang</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111245444</id>
    <updated>2018-10-19T02:00:03Z</updated>
    <published>2018-10-19T02:00:03Z</published>
    <summary type="html">&lt;blockquote&gt;&lt;strong&gt;Why is @Activate method not triggering when the bundle (re)starts&lt;/strong&gt; in Machine 2, or sometimes @Modified also not working when the configuration is changed?&lt;/blockquote&gt;&lt;br /&gt;The &lt;strong&gt;@Activate&lt;/strong&gt; method is only called when a component activates, and a bundle can be started without the component starting. Chances are that your component has a dependency that isn&amp;#39;t satisfied on Machine 2.</summary>
    <dc:creator>Minhchau Dang</dc:creator>
    <dc:date>2018-10-19T02:00:03Z</dc:date>
  </entry>
  <entry>
    <title>@Activation annotation not working when Bundle starts ?</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111242746" />
    <author>
      <name>Vishnu S Kumar</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=111242746</id>
    <updated>2018-10-18T19:10:47Z</updated>
    <published>2018-10-18T19:10:47Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Following snippets are a sample configuration interface and configuration reading class.&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;[code]@Meta.OCD(id = "docs.exampleconfig.ExampleConfiguration")
public interface ExampleConfiguration {

    @Meta.AD(
        deflt = "0",
        required =true
    )
    public Long authId();
}&lt;/code&gt;&lt;/pre&gt; &lt;br&gt;&lt;br&gt;We read the above configuration in the Application class like below.&lt;br&gt;&lt;pre&gt;&lt;code&gt;[code]@Component(
    configurationPid = "docs.exampleconfig.ExampleConfiguration",
    configurationPolicy = ConfigurationPolicy.OPTIONAL,
    immediate = true,
    property = {
        "javax.portlet.name=com_liferay_docs_exampleconfig_portlet_ExampleConfigPortlet"
    },
    service = ConfigurationAction.class
)
public class ExampleConfigurationAction extends DefaultConfigurationAction {


    @Activate
    @Modified
    protected void activate(Map&amp;lt;object, object&amp;gt; properties) {
        _exampleConfiguration = ConfigurableUtil.createConfigurable(
            ExampleConfiguration.class, properties);
    }

    private volatile ExampleConfiguration _exampleConfiguration;


}
............&amp;lt;/object,&amp;gt;&lt;/code&gt;&lt;/pre&gt;Everytime when we restart the&amp;nbsp; liferay server in machine 1 the @Activate method triggers and the new configurations are picked up and works fine.&lt;br&gt;But in machine 2 the @Activate won't trigger when restarting the machine or even @Modified when the new value is added to the config. The following are the differences between machine 1 &amp;amp; 2&lt;br&gt;&lt;br&gt;&lt;br&gt;Machine 1 (working)&amp;nbsp; : Liferay DXP fix pack 57, Tomcat 8.0.32, MySQL DB, Elasticsearch 2.2.2&lt;br&gt;Machine 2 (not working) : Liferay DXP fix pack 59, IBM Websphere, Oracle DB, Elasticsearch 2.2.4&lt;br&gt;&lt;br&gt;&lt;br&gt;In order to make machine 2 to read this osgi config after restart/modification we need to go to the App Manager and reactivate the bundle from there. Then it will trigger @Activate and the configuration value will pick up.&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;strong&gt;Why is @Activate method not triggering when the bundle (re)starts&lt;/strong&gt; in Machine 2, or sometimes @Modified also not working when the configuration is changed ? Thanks in advance for your valuable answers. Please feel free to ask anymore info to better understand the scenario.&lt;br&gt;&lt;br&gt;With Regards&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Vishnu S Kumar</dc:creator>
    <dc:date>2018-10-18T19:10:47Z</dc:date>
  </entry>
</feed>
