Expand my Community achievements bar.

How to work with Configurations in CQ ?

Avatar

Level 2

Hi,

I want to create a configuration which can be edited at run time using OSGI console.

While I edit the file .xml in the folder runmodes -> config I see the property in OSGI console. It has a PID number and a field that I 

set in the file .xml.

When I read the property (that I have set  in the file .xml)  I receive a exception "NullPointerException".

I suspect that the error concerns  the annotation @References because  when I go in debug (from eclipse) the field that it is annotate with @ Reference is null.

Could you help me?

I have followed this tutorial 

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

My version of CQ is 5.6.1.

Thank you.

Eventually

2 Replies

Avatar

Level 2

Thank you, 

I have resolved in this way:

ClassName p = sling.getService(ClassName.class);

I called in the jsp with keyword new, example :

<% 
LibraryService libraryService = new LibraryService(); 
Homepage home= libraryService.getHomepage();
%>

so, I obtained  the Exception. Now it's work !