I'm working in an Felix to OSGI migration activity. As part of this I'm facing the below issue. Can anyone help me on this?
com.adobe.cq.commerce.common.ServiceContext.languageManager returns null in AEM 6.4 using OSGI annotations. The same is working fine in AEM 6.1 with felix annotations. Additionally not only languageManager, for these also I'm getting null SearcProviderManager, settingService, slingRepository, slingSettingService & userPropertiesService.
Can you post more of your code - where is it failing - using @Reference?
Please find the below references,
Issue in detail:
1) In screenshot:1 line no:91, I'm trying to get the languageManager from config.
2) In screenshot:2 line no:55 I'm getting properties from serviceFactory. serviceFactory is nothing but DefaultHybrisfactory.
3) In screenshot:3 DefaultHybriFactory extends AbstarctJcrCommerceServiceFactory where the languageManager has been referred.
4) In screenshot:4 If you see the AbstarctJcrCommerceServiceFactory predefined class, it has the LanguageManager Reference, but here everything is in felix annotation.
5) Finally when I get the languageManager from AbstarctJcrCommerceServiceFactory I'm getting null value.(I'm using OSGI annotations)
6) The same code is working fine in 6.1 with felix annotations(felix annotations used in my code not OSGI)
I'm suspecting that, Since I have converted all the felix annotations to OSGI in my code but the predefined class (AbstarctJcrCommerceServiceFactory) is still having felix annotations. that's why I'm getting null value?
Do you have any idea on this issue?
This may be a bug. If code works in Felix Annotations but fails on R6 Annotations - you should open a support ticket.