Dileepa Dileepa - 1 year ago 109
Java Question

Why sling:OsgiConfig node not working in /etc/folder in AEM?

I have a component with properties as follows.

@Component(immediate = true, metatype = true, label = "Conf Details")
@Service(value = { LocationConfigurationUtil.class })
@Property(label = "location blueprint", name = "locationPath", value = "", description = "..."),
@Property(label = "location page template", name = "locationTemplate", value = "", description = "..."),
@Property(label = "basepath live copies", name = "liveCopyRoot", value = "/content/WebRoot", description = "...") })
public class LocationConfigurationUtil {
protected void activate(Map<String, Object> mapCreated) {
// some code

To make it editable properties in a jcr node, I used a non-standard method. I created
in path
having properties declared in java code, which is working fine.

screen shot

But if I just have the same
, it does not work.

Answer Source

With default settings, JCR Installer Provider does not look for installable bundles and nodes (sling:OsgiConfig) in folders other than /libs and /apps. so any config in /etc will not be loaded.

If you want to change this behavior, make a search path entry in "Apache Sling JCR Installer" config in osgi configuration console. But be aware it is not recommended, you should not be putting any sling:osgiconfig node in /etc in the first place.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download