Unable to reading OSGi Configuration values

Avatar

Avatar

PrasadAB

Avatar

PrasadAB

PrasadAB

29-12-2020

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>

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

shelly-goel

Avatar

shelly-goel

shelly-goel

29-12-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-devel...

Answers (0)