Hi,
We are facing an issue where OSGI configuration values are not getting updated when we check in the /system/console/ConfigMgr
For Ex:
If we make changes in the config file and deploy the same it reflects correctly in crx/de But not in /system/console/ConfigMgr.
We still see old value and have to manually make the changes.
We have taken care of run modes as well so that they should reflect the respective values.
Thanks,
Mrudul
Solved! Go to Solution.
Views
Replies
Total Likes
Here is my sample OSGi configuration associated with Scheduler -
package com.aem.demo.core.configurations; import org.osgi.service.metatype.annotations.AttributeDefinition; import org.osgi.service.metatype.annotations.AttributeType; import org.osgi.service.metatype.annotations.ObjectClassDefinition; @ObjectClassDefinition(name = "Resource Expiration scheduler configuration", description = "Resource Expiration scheduler configuration") public @interface ExpirationSchedulerConfiguration { /** * This method will return the name of the Scheduler * * @return {@link String} */ @AttributeDefinition(name = "Scheduler name", description = "Name of the scheduler", type = AttributeType.STRING) public String schdulerName() default "Expiration scheduler configuration"; /** * This method will set flag to enable the scheduler * * @return {@link Boolean} */ @AttributeDefinition(name = "Enabled", description = "True, if scheduler service is enabled", type = AttributeType.BOOLEAN) public boolean enabled() default false; /** * This method returns the Cron expression which will decide how the scheduler * will run * * @return {@link String} */ @AttributeDefinition(name = "Cron Expression", description = "Cron expression used by the scheduler", type = AttributeType.STRING) public String cronExpression() default "0 * * * * ?"; /** * This method returns the Asset Path * * * @return {@link String} */ @AttributeDefinition(name = "Asset Path", description = "Asset Path", type = AttributeType.STRING) public String assetPath() default "/content/dam"; @AttributeDefinition(name = "Page Taxonomy", description = "Page Taxonomy", type = AttributeType.STRING) public String contentPath() default "/content/we-retail"; }
This is Scheduler where I am reading the above OSGi configuration -
package com.aem.demo.core.configurations; import org.osgi.service.metatype.annotations.AttributeDefinition; import org.osgi.service.metatype.annotations.AttributeType; import org.osgi.service.metatype.annotations.ObjectClassDefinition; @ObjectClassDefinition(name = "Resource Expiration scheduler configuration", description = "Resource Expiration scheduler configuration") public @interface ExpirationSchedulerConfiguration { /** * This method will return the name of the Scheduler * * @return {@link String} */ @AttributeDefinition(name = "Scheduler name", description = "Name of the scheduler", type = AttributeType.STRING) public String schdulerName() default "Expiration scheduler configuration"; /** * This method will set flag to enable the scheduler * * @return {@link Boolean} */ @AttributeDefinition(name = "Enabled", description = "True, if scheduler service is enabled", type = AttributeType.BOOLEAN) public boolean enabled() default false; /** * This method returns the Cron expression which will decide how the scheduler * will run * * @return {@link String} */ @AttributeDefinition(name = "Cron Expression", description = "Cron expression used by the scheduler", type = AttributeType.STRING) public String cronExpression() default "0 * * * * ?"; /** * This method returns the Asset Path * * * @return {@link String} */ @AttributeDefinition(name = "Asset Path", description = "Asset Path", type = AttributeType.STRING) public String assetPath() default "/content/dam"; @AttributeDefinition(name = "Page Taxonomy", description = "Page Taxonomy", type = AttributeType.STRING) public String contentPath() default "/content/we-retail"; }
As I am reading OSGi configuration in above scheduler so, PID is pointing to Scheduler Class itself as shown below -
I have deployed everything on local AEM author instance and every time I am modifying contentpath in CRXDE here /apps/demo/osgiconfig/config.author/com.aem.demo.core.schedulers.ResourceExpirationScheduler.config and change is getting reflected in config manager /system/console/configMgr.
My sample OSGi configurations is getting stored in file system under following path
C:\Users\debal\AEM-instances\demo-author\crx-quickstart\launchpad\config\com\aem\demo\core\schedulers here -
If we take close look this path is nothing but
<AEM-instance-installed-directory>/crx-quickstart/launchpad/config/PID
Hi,
Are you overwriting the out of the box configuration or it is custom config? Try adding some unique value at the end of the config file, if it is out of the box config you are updating
Ex: org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl-<uniqueid>.
@Ravi_Pampana No We are not overwriting OOTB config. It is a custom config
We had similar issue in our project. If you are having OSGi configuration structure like the below one -
Then please check config file[PID] under relevant config folder like config.author or config.publish or config.stage which is aligned with the run mode of that AEM instance and make necessary changes in that config file[PID].
Hi @DEBAL_DAS
Yes, config files are having a correct naming convention and are placed in respective run modes.
One thing we noticed here is PID is not bound to the class name but rather shows Configuration Name.
Let's assume you are on prod author instance and this OSGi configuration will be having prod environment specific value.
Now tell me location of config file in CRXDE (full path), where you have updated the value.
@DEBAL_DAS
This is the path
/apps/my-proj/config.prod.author/com.proinc.aemproinc.core.services.impl.SomeGeneratorServiceImpl.config
Now do one thing first, search with com.proinc.aemproinc.core.services.impl.SomeGeneratorServiceImpl.config in /system/console/configMgr and delete the entry [clicking Delete icon as shown below]
Then update /apps/my-proj/config.prod.author/com.proinc.aemproinc.core.services.impl.SomeGeneratorServiceImpl.config in CRXDE and then check whether updated value is getting reflected on /system/console/ConfigMgr.
First execute these steps on your local AEM author with prod run mode and let me know the result.
@DEBAL_DAS
Sorry it didnt work and we have same issue.
We deleted the config and made some small update in the config file in crx. and observed config got recreated but values are empty and still PID is not linked to config class.
Here is my sample OSGi configuration associated with Scheduler -
package com.aem.demo.core.configurations; import org.osgi.service.metatype.annotations.AttributeDefinition; import org.osgi.service.metatype.annotations.AttributeType; import org.osgi.service.metatype.annotations.ObjectClassDefinition; @ObjectClassDefinition(name = "Resource Expiration scheduler configuration", description = "Resource Expiration scheduler configuration") public @interface ExpirationSchedulerConfiguration { /** * This method will return the name of the Scheduler * * @return {@link String} */ @AttributeDefinition(name = "Scheduler name", description = "Name of the scheduler", type = AttributeType.STRING) public String schdulerName() default "Expiration scheduler configuration"; /** * This method will set flag to enable the scheduler * * @return {@link Boolean} */ @AttributeDefinition(name = "Enabled", description = "True, if scheduler service is enabled", type = AttributeType.BOOLEAN) public boolean enabled() default false; /** * This method returns the Cron expression which will decide how the scheduler * will run * * @return {@link String} */ @AttributeDefinition(name = "Cron Expression", description = "Cron expression used by the scheduler", type = AttributeType.STRING) public String cronExpression() default "0 * * * * ?"; /** * This method returns the Asset Path * * * @return {@link String} */ @AttributeDefinition(name = "Asset Path", description = "Asset Path", type = AttributeType.STRING) public String assetPath() default "/content/dam"; @AttributeDefinition(name = "Page Taxonomy", description = "Page Taxonomy", type = AttributeType.STRING) public String contentPath() default "/content/we-retail"; }
This is Scheduler where I am reading the above OSGi configuration -
package com.aem.demo.core.configurations; import org.osgi.service.metatype.annotations.AttributeDefinition; import org.osgi.service.metatype.annotations.AttributeType; import org.osgi.service.metatype.annotations.ObjectClassDefinition; @ObjectClassDefinition(name = "Resource Expiration scheduler configuration", description = "Resource Expiration scheduler configuration") public @interface ExpirationSchedulerConfiguration { /** * This method will return the name of the Scheduler * * @return {@link String} */ @AttributeDefinition(name = "Scheduler name", description = "Name of the scheduler", type = AttributeType.STRING) public String schdulerName() default "Expiration scheduler configuration"; /** * This method will set flag to enable the scheduler * * @return {@link Boolean} */ @AttributeDefinition(name = "Enabled", description = "True, if scheduler service is enabled", type = AttributeType.BOOLEAN) public boolean enabled() default false; /** * This method returns the Cron expression which will decide how the scheduler * will run * * @return {@link String} */ @AttributeDefinition(name = "Cron Expression", description = "Cron expression used by the scheduler", type = AttributeType.STRING) public String cronExpression() default "0 * * * * ?"; /** * This method returns the Asset Path * * * @return {@link String} */ @AttributeDefinition(name = "Asset Path", description = "Asset Path", type = AttributeType.STRING) public String assetPath() default "/content/dam"; @AttributeDefinition(name = "Page Taxonomy", description = "Page Taxonomy", type = AttributeType.STRING) public String contentPath() default "/content/we-retail"; }
As I am reading OSGi configuration in above scheduler so, PID is pointing to Scheduler Class itself as shown below -
I have deployed everything on local AEM author instance and every time I am modifying contentpath in CRXDE here /apps/demo/osgiconfig/config.author/com.aem.demo.core.schedulers.ResourceExpirationScheduler.config and change is getting reflected in config manager /system/console/configMgr.
My sample OSGi configurations is getting stored in file system under following path
C:\Users\debal\AEM-instances\demo-author\crx-quickstart\launchpad\config\com\aem\demo\core\schedulers here -
If we take close look this path is nothing but
<AEM-instance-installed-directory>/crx-quickstart/launchpad/config/PID
Are you creating your configurations as "sling:OsgiConfig" node . I am not seeing anything in crxde like below
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:OsgiConfig"
Check this configuration for reference /apps/weretail/config/org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-we-retail
Yes @Anoop_Garg We have taken care of this.
If you are using OSGi annotation,
Cross check the @Designate annotation if the OCD is correctly associated to an OSGi component.
If it is a factory config, @Designate should have additional property named factory set to true.
Views
Likes
Replies