Hi
We have recently migrated our system from AEM 6.1 to 6.3 and removed all admin level privileges. As previous, we have created OSGI services for few OSGI config nodes which can be set in config nodes, the same will be reflected in service properties (visible in Felix console. We use to update the OSGI config nodes property values in CRXDE Lite.
For some reason, I am unable to read my OSGI property values from the OSGI service properties. At very first time when I install the bundle (jar), I could see service is getting activated and the OSGI values are getting set. After few hours (depending on the environment), the custom service is getting the log as "UNREGISTERING", after this log, I am unable to read the property value.
Attached screenshot shows the log from error.log and Felix console where the custom service is getting binded to Default state
- launchpad:resources/install/0/org.apache.sling.scripting.core-2.0.44.jar. I do not know from where and how it is getting set. Due to this I am unable to set/read the property value
Code snippet for try/catch - Activate and readproperties method
@Service({StaticResourceHelper.class})
@Component(metatype=true, immediate=true, label="Static Resource Helper", description="Manages and exposes a helper method that produces fully qualified Akamai URLs for relative CQ resource paths.")
public class StaticResourceHelper implements ConfigurationService {
private static final Logger LOG = LoggerFactory.getLogger(StaticResourceHelper.class);
@Property(unbounded=PropertyUnbounded.DEFAULT, label="Akamai Base URL", description="Define a fully qualified Akamai base URL - Note: this should most likely be an 'https' URL.", value="")
private static final String AKAMAI_BASE_URL_PROPERTY_NAME = "xxxx.akamai.url";
private String akamaiBaseurl = "";
private String appServername = "";
private Session jcrSession = null;
@Reference
private ResourceResolverFactory resolverFactory;
pr try {
Map<String, Object> param = new HashMap <String, Object>();
param.put(resolverFactory.SUBSERVICE, crxWriteService);
ResourceResolver resolver = null;
resolver = resolverFactory.getServiceResourceResolver(param);
jcrSession = resolver.adaptTo(Session.class);
if((resourcePath != null) || (!resourcePath.isEmpty())) {
if(jcrSession.itemExists(resourcePath) || jcrSession.nodeExists(resourcePath)) {
resourceNode = jcrSession.getNode(resourcePath);
}
}
//resolver.adaptTo(Node.class).getNode(resourcePath);
} catch (Exception e) {
LOG.error("Caught exception resolving Node: ", e);
}
public String getAppServername() {
// TODO Auto-generated method stub
return this.appServername;
}
public String getAkamaiBaseurl() {
// TODO Auto-generated method stub
return this.akamaiBaseurl;
}
@Activate
protected void activate(Map<String, Object> properties)
{
LOG.info("[*** AEM ConfigurationService]: activating configuration service");
readProperties(properties);
}
protected void readProperties(Map<String, Object> properties)
{
LOG.info(properties.toString());
this.akamaiBaseurl = PropertiesUtil.toString(properties.get("xxxxx.akamai.url"), "default");
LOG.info("Simple String: " + this.akamaiBaseurl);
this.appServername = PropertiesUtil.toString(properties.get("xxxx.appserver.name"), "default");
LOG.info("Simple String: " + this.akamaiBaseurl);
}
}