Unable to reading OSGi Configuration values | Community
Skip to main content
December 29, 2020
Solved

Unable to reading OSGi Configuration values

  • December 29, 2020
  • 1 reply
  • 949 views

Hi All,
As per requirement for the migration of AEM 6.2 to AEM 6.5 cloud service. I have to read the OSGi configuration values. I tried this link https://helpx.adobe.com/experience-manager/using/osgi_config63.html.
I was able to create all the specified java files and the build was successful as well.

 

At the component level, I was trying to fetch the values like below code snippet shows, but could not get the values. Looking for the solution for this to achieve. Below are trails which I tried out.

Try 1:
<sly data-sly-use.nav="com.abc.core.use.HelloWorldModel" data-sly-unwrap>In the Java call sly tag</sly><br>
<h1>${nav.getMessage}</h1>


Try 2:
<sly data-sly-use.nav="com.abc.core.use.HelloWorldModel" data-sly-unwrap>In the Java call sly tag</sly><br>
<h1>${nav.getMessage}</h1>
<sly data-sly-test.tryvalue=${nav.getMessage}>
<h2>Value: ${tryvalue}</h2>
</sly>

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by shelly-goel

@prasadab 

There could be multiple reasons for it not working. Considering you're trying on AEM cloud service though the document you've referred uses older maven archetype, it could be due to that. I hope you're using latest archetype 23/ 24 in this case.

Also, please check if the model is available under /system/console/status-slingmodels and you're able to see log statements added for HelloWorldModel.

You can also refer to the below tutorial for setting up sling model

https://experienceleague.adobe.com/docs/experience-manager-learn/getting-started-wknd-tutorial-develop/custom-component.html?lang=en#create-sling-model

1 reply

shelly-goel
Adobe Employee
shelly-goelAdobe EmployeeAccepted solution
Adobe Employee
December 30, 2020

@prasadab 

There could be multiple reasons for it not working. Considering you're trying on AEM cloud service though the document you've referred uses older maven archetype, it could be due to that. I hope you're using latest archetype 23/ 24 in this case.

Also, please check if the model is available under /system/console/status-slingmodels and you're able to see log statements added for HelloWorldModel.

You can also refer to the below tutorial for setting up sling model

https://experienceleague.adobe.com/docs/experience-manager-learn/getting-started-wknd-tutorial-develop/custom-component.html?lang=en#create-sling-model