I have an OSGI service/service implementation combo to store the GTM codes.
I have some passwords that's stored in .java files at the moment. To make it more secure, I followed the same technique used on the GTM codes to create an OSGI config (acessible via configMgr). I have no problems accessing it on my component class (com.myhost.core.impl.view.component.mycomponent).
The issue I have is I cannot access the password config in a servlet.
This lead me to believe that perhaps I'm doing it wrong.
If yes, how can I access the OSGI config from a servlet?
How do I know which filename to use for the XML if I were to use the techniques mentioned in the link? Can I arbitrarily used whatever filename I want?
I actually have tried question 3. I followed the article. I created a new XML (filename=com.myhost.core.services.impl.whatever.xml) file inside ui.apps/src/main/content/jcr_root/apps/myhost/configs/config.author.localhost and used the xml below as the contents of the file. I installed the compiled maven package (.zip) but I cannot see the new XML in CRXDE (/apps/myhost/configs/config.author.localhost).
I would recommend creating OSGi service along with the OSGi configuration of the same name and use that service in servlet.
3. Name of the configurations file can be the arbitrary name but if you have created OSGi service then the configurations file name should be same as the service name. Read here more about OSGi configurations Configuring OSGi.
4. Check your filter package filter.xml, you might have forgotten to add xml file
You might be missing Service User Mappingconfigure for the bundle.
Check your erro.log and see if you have below error:
" org.apache.sling.jcr.resource.internal.JcrSystemUserValidator The provided service user id 'serviceuser--Lab2019.core' is not a known JCR system user id and therefore not allowed in the Sling Service User Mapper."