osgi config file not working (not appearing in config manager). Incorrect name? | Community
Skip to main content
Level 8
May 7, 2021
Solved

osgi config file not working (not appearing in config manager). Incorrect name?

  • May 7, 2021
  • 6 replies
  • 3777 views

In order to create a cors entry, we created a file:

 

 

/myapp.ui.config/src/main/content/jcr_root/apps/myapp/osgiconfig/config.author.dev/com.adobe.granite.cors.impl.CORSPolicyImpl-myapp.cfg.json

 

 

When we deploy the project to the local author instance using mvn clean install -PautoInstallSinglePackage in the root, then look in the config manager, it is not there.  Should it be?

Here I am assuming that when you run the AEM SDK locally, its in dev run mode.

 

above is only a config which was manually created.  We would expect our mypp config to also be there.

 

The contents were this:

 

 

{ "alloworigin":["*"], "alloworiginregexp":[], "allowedpaths":[".*"], "exposedheaders":[""], "maxage":1800, "supportedheaders":["*"], "supportedmethods":["GET","POST"], "supportedcredentials":"true" }

 

 

 

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 Pawan-Gupta

Hello,

Just to add, the local config file name should not have "-" in the file name rather use "~" to make it work. so create the file name as

 

/myapp.ui.config/src/main/content/jcr_root/apps/myapp/osgiconfig/config.author.dev/com.adobe.granite.cors.impl.CORSPolicyImpl~myapp.cfg.json

6 replies

Vaibhavi_J
Level 7
May 7, 2021

Hi @tb3dock ,

 

Please have a check in crx if the newly created config is available in the below path.

/apps/myapp/osgiconfig/config.author.dev/com.adobe.granite.cors.impl.CORSPolicyImpl-myapp.cfg.json

 

Also please confirm if your local instance run mode is set to dev?

TB3dockAuthor
Level 8
May 7, 2021
Yes, its in the CRX viewer, but not in the osgi config viewer. I am running locally, so must be dev. How do you verify?
Level 2
May 7, 2021

.

Prince_Shivhare
Community Advisor
Community Advisor
May 7, 2021

Hi @tb3dock ,

 

It should be available in config Manager.

you should keep the file in the part mentioned by @vaibhavi_j .

and make sure you are building all the modules in maven not only the ui.apps.

it should deploy it to config Manager. Also, check-in CRXDE if you are able to see this in osgiconfig node.


Thanks,

Prince

Asutosh_Jena_
Community Advisor
Community Advisor
May 7, 2021

Hi @tb3dock 

 

Your configuration is created under config.author.dev which will be used only for the developement author environment.

/myapp.ui.config/src/main/content/jcr_root/apps/myapp/osgiconfig/config.author.dev/com.adobe.granite.cors.impl.CORSPolicyImpl-myapp.cfg.json

 

if your current instance is running on dev, author runmode, you will be able to see the above config under system/console/configMgr, else it will not be picked by the instance even though it is present under /apps/myapp/osgiconfig/config.author.dev

 

if you want it to be available on your local author instance, put it either to /apps/myapp/osgiconfig/config or create a new run mode such as /apps/myapp/osgiconfig/config.author.local and set the run mode in the sling.properties file as a property like "sling.run.modes=local, author"

 

Hope this helps!

 

Thanks

TB3dockAuthor
Level 8
May 7, 2021

We assume because we are running the author instance locally, it must be in dev mode, as its not stage or prod, and there are only 3 possibilities.  We don't have a sling.propertiers file currently.

Pawan-Gupta
Pawan-GuptaAccepted solution
Level 8
May 7, 2021

Hello,

Just to add, the local config file name should not have "-" in the file name rather use "~" to make it work. so create the file name as

 

/myapp.ui.config/src/main/content/jcr_root/apps/myapp/osgiconfig/config.author.dev/com.adobe.granite.cors.impl.CORSPolicyImpl~myapp.cfg.json
arunpatidar
Community Advisor
Community Advisor
May 8, 2021

Hi

local AEM SDK does not contain dev run mode by default. you can set though using command line when you start aem or set in sling:properties file.

you can varify run modes on instance at http://localhost:4502/libs/granite/operations/content/systemoverview.html

Arun Patidar
TB3dockAuthor
Level 8
May 9, 2021
Thanks, I had assumed that local dev instance would be in dev mode, this solved the main problem. Sadly, that system overview link doesnt work on the target cloud instances, only local SDK.