Read OSGI configuration | Community
Skip to main content
Nandujee
Level 3
October 16, 2015
Solved

Read OSGI configuration

  • October 16, 2015
  • 1 reply
  • 819 views

Hello,

Could any one guide me to read OSGI configuration in java.

I have created OSGI:config under app\config folder and name is 'xx.yy.zz', I have add property as "myipaddress = XXXXX"

Now I try to get the this config in the servlet. 

I tried like below

    @Reference
    private ConfigurationAdmin configurationAdmin;

   Configuration config = configurationAdmin.getConfiguration("xx.yy.zz"); LINE 01

But I got NullpointerException on LINE 01.

Kindly guide me how to overcome this issue..

If my way of fetching the value is wrong. Suggest the steps to fetch OSGI.config property  in java

Many thanks

Nanda

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 Mshaji

Here are the steps to create osgi config

http://www.wemblog.com/2012/10/how-to-work-with-configurations-in-cq.html

Here is how you read the config

http://sonycharan.blogspot.com/2014/05/how-to-read-config-properties-in-cq5.html

Please check whether you are following the steps and check error.log for StackTrace

1 reply

MshajiCommunity AdvisorAccepted solution
Community Advisor
October 16, 2015

Here are the steps to create osgi config

http://www.wemblog.com/2012/10/how-to-work-with-configurations-in-cq.html

Here is how you read the config

http://sonycharan.blogspot.com/2014/05/how-to-read-config-properties-in-cq5.html

Please check whether you are following the steps and check error.log for StackTrace