InjectorHierarchy bindConfig not called on InjectorConfig registration

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

InjectorHierarchy bindConfig not called on InjectorConfig registration

Olle
I am trying to setup a project with AEM 6 SP1 and Slice 4.1.0 but I can't seem to get it to work. I've downloaded the source from Github and tried to debug the issue with it and have come to the following:


If I look in the OSGI events web interface I see:
Service (id=2893, objectClass=com.cognifide.slice.api.injector.InjectorConfig, bundle=com.foo.bar-aem-services) registered

however in code configByName in InjectorHierarchy is always empty. If I understand correctly bindConfig should have been called upon that event I see in the event log causing the InjectorConfig to be added to the set. Is there something wrong with the code or am I missing something?

I've tried with AEM 6 SP1 and AEM 6 SP2 using Slice 4.1.0 and Slice 4.1.1-SNAPSHOT from the 4.1.1 maintenance release.





Reply | Threaded
Open this post in threaded view
|

Re: InjectorHierarchy bindConfig not called on InjectorConfig registration

maciej.majchrzak
Administrator
Hi Olle,

bindConfig method which you're refering to is called by OSGi framework whenever you're registering a service implementing InjectorConfig. InjectorConfig is kind of descriptor of your application's injector and is used to register your app. Slice provides you with nice and easy to use utility which allows you to build and start injector - it's called InjectorRunner.

You should take a look at Slice documentation which describes how to setup injector and run your application https://cognifide.atlassian.net/wiki/display/SLICE/Writing+activator+-+4.1

Please let me know if you are able to run your app with use of the above.

Cheers
Maciej
Reply | Threaded
Open this post in threaded view
|

Re: InjectorHierarchy bindConfig not called on InjectorConfig registration

Olle
Hi Maciej,

Thanks for your fast response.

Yes I have a InectorRunner in my Activator. And if I debug I see the call to injectorRunner.start(); which in turn executes:

this.bundleContext.registerService(InjectorConfig.class.getName(), config, properties);

when that line executes my InjectorConfig is registered and in the felix event console I see it as Service (id=2893, objectClass=com.cognifide.slice.api.injector.InjectorConfig, bundle=com.foo.bar-aem-services) registered

however the OSGI container does not trigger the bindConfig. So "bindConfig method which you're refering to is called by OSGi framework whenever you're registering a service implementing InjectorConfig." is not happening

I have uploaded a screenshot of the services to http://i.imgur.com/ExtXraM.png

as you can see there is a InjectorConfig there however the bindConfig has never been called and configByName remains empty.

Best Regards,
Olle
Reply | Threaded
Open this post in threaded view
|

Re: InjectorHierarchy bindConfig not called on InjectorConfig registration

maciej.majchrzak
Administrator
That sounds pretty weird. We used Slice 4.1 in AEM 6 SP1 without any issue. I'm trying to find out what can be a reason of InjectorHierarchy not being called while an InjectorConfig is being registered... One reason may be InjectorConfig registration before InjectorHierarchy service has started. Have you tried to install bundle of your app after Slice has been installed on your instance? Also, have you checked logs of your instance if there's something suspicious?