Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

SOLVED

Read OSGI configuration

Avatar

Level 4

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

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