You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Rory Douglas <ro...@oracle.com> on 2008/07/23 06:14:26 UTC

ObjectContentManagerFactoryImpl still deploying as delayed component?

I'm encountering the same error with the simple-demo sample reported in 
http://issues.apache.org/jira/browse/SLING-546.  I fetched all the 
source from SVN this afternoon.

On the management console > Components tab, 
ObjectContentManagerFactoryImpl is showing as "registered", not "active" 
(expanding the node the Activation value is "delayed").  I've checked 
the source for ObjectContentManagerFactoryImpl and it has @scr.component 
metatype="no" immediate="true" in the JavaDoc (and immediate="true" in 
serviceComponents.xml).

Any idea why this is happening? Thanks for any help

Regards,
Rory

Re: ObjectContentManagerFactoryImpl still deploying as delayed component?

Posted by Carsten Ziegeler <cz...@apache.org>.
Felix Meschberger wrote:
> Hi,
> 
> Carsten Ziegeler schrieb:
>> Felix Meschberger wrote:
>>> Hi,
>>>
>>> Can we please revert this fix (Rev. 679680, fix for 581), because it 
>>> is _not_ the real fix ;-)
>>>
>> Ups, I didn't spend too much time looking at the activate method :(
>> Now, I'm wondering what the better way is: adding the component as a 
>> listener in the activate method or declaring the service interface 
>> through SCR?
> 
> I don't think, I understand you ;-)
> 
> A bundle listener is registered directly with the bundle context 
> (BundleContext.addBundleListener()). Simply registering it as a service 
> with the service registry does not work...
> 
Argh - yes, you're right. (Oh my it's too hot to work today). I actually 
made the same mistake some weeks ago.....

Thanks!
Carsten
-- 
Carsten Ziegeler
cziegeler@apache.org

Re: ObjectContentManagerFactoryImpl still deploying as delayed component?

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

Carsten Ziegeler schrieb:
> Felix Meschberger wrote:
>> Hi,
>>
>> Can we please revert this fix (Rev. 679680, fix for 581), because it 
>> is _not_ the real fix ;-)
>>
> Ups, I didn't spend too much time looking at the activate method :(
> Now, I'm wondering what the better way is: adding the component as a 
> listener in the activate method or declaring the service interface 
> through SCR?

I don't think, I understand you ;-)

A bundle listener is registered directly with the bundle context 
(BundleContext.addBundleListener()). Simply registering it as a service 
with the service registry does not work...

Regards
Felix

Re: ObjectContentManagerFactoryImpl still deploying as delayed component?

Posted by Carsten Ziegeler <cz...@apache.org>.
Felix Meschberger wrote:
> Hi,
> 
> Can we please revert this fix (Rev. 679680, fix for 581), because it is 
> _not_ the real fix ;-)
> 
Ups, I didn't spend too much time looking at the activate method :(
Now, I'm wondering what the better way is: adding the component as a 
listener in the activate method or declaring the service interface 
through SCR?

Carsten
-- 
Carsten Ziegeler
cziegeler@apache.org

Re: ObjectContentManagerFactoryImpl still deploying as delayed component?

Posted by Felix Meschberger <fm...@gmail.com>.
Hi Craig

Craig L. Ching schrieb:
> I'm still getting myself caught up with the way
> you're handling dependency versions, don't get me wrong, I understand
> why you're doing it this way, it's just taking me more time than it
> should to get used to it :-P

No worry. I also didn't realize this concrete situation right from the 
start. Only when I actually looked at it today after the mail traffic I 
remembered ...

Regards
Felix

RE: ObjectContentManagerFactoryImpl still deploying as delayed component?

Posted by "Craig L. Ching" <cc...@mqsoftware.com>.
 

> -----Original Message-----
> From: Felix Meschberger [mailto:fmeschbe@gmail.com] 
> Sent: Friday, July 25, 2008 5:30 AM
> To: sling-dev@incubator.apache.org
> Subject: Re: ObjectContentManagerFactoryImpl still deploying 
> as delayed component?
> 
> Hi,
> 
> Can we please revert this fix (Rev. 679680, fix for 581), 
> because it is _not_ the real fix ;-)
> 

[thanks for the explanation, helps me understand more :-D]

> Setting the immediate attribute to true in the @scr.component 
> tag (as of Rev. 66451, fixing issue 546) fixes the problem.
> 
> But: this fix did _not_ make it into the release.
> 
> And therefore, finally, just compiling and installing the 
> current trunk just fixes the problem.
> 
> Hope this helps.
> 

Ugh, yes, sorry about that, I should have known better as it was
originally my bug ;-)  I'm still getting myself caught up with the way
you're handling dependency versions, don't get me wrong, I understand
why you're doing it this way, it's just taking me more time than it
should to get used to it :-P

> Regards
> Felix
> 

Cheers,
Craig

Re: ObjectContentManagerFactoryImpl still deploying as delayed component?

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

Can we please revert this fix (Rev. 679680, fix for 581), because it is 
_not_ the real fix ;-)

Registering the component as a SynchronousBundleListener does not help 
because nobody is interested in this ;-) Rather this interface is 
implemented such that the activate method can register the component as 
a bundle listener with the framework.

The real cause is another issue: In earlier releases of the Apache Felix 
SCR plugin the immediate attribute handling was wrong, in that the 
immediate attribute was always set to "true" if not specified with the 
@scr.component tag (actually the Apache Felix Declarative Service 
implementation also contained incorrect handling of this attribute).

This turns out to give a wrong default value in the case of a component 
providing a service: The standard says, that components providing 
services are delayed by default, while the maven SCR plugin turn them 
into immediate by default.

It seems, that the released bundle is now created with the new (fixed) 
SCR plugin, which does _not_ set the immediate attribute to any value if 
not set in the @scr.component tag. This causes the Declarative Services 
runtime to apply the correct default value algorithm (which is sort of 
quite convoleted) - making the component a delayed component.

Thus, the ObjectContentManagerFactoryImpl is registered as a delayed 
component and as a consequence the OcmAdapterFactory is not registered 
as an AdapterFactory and hence OCM was actually inactive ...

Setting the immediate attribute to true in the @scr.component tag (as of 
Rev. 66451, fixing issue 546) fixes the problem.

But: this fix did _not_ make it into the release.

And therefore, finally, just compiling and installing the current trunk 
just fixes the problem.

Hope this helps.

Regards
Felix

Carsten Ziegeler schrieb:
> Craig L. Ching wrote
>>>
>>> I think I figured this out:  I added @scr.service 
>>> interface="org.osgi.framework.SynchronousBundleListener" to 
>>> ObjectContentManagerFactoryImpl, and the component now activates 
>>> immediately (and registers mapped types from simple-demo)
>>>
>>
>> Ok, I said in another thread that this didn't work for me, but I forgot
>> about the fact that the release bundle was installed by default, not my
>> built bundle.  I'll open a JIRA issue with a patch.
>>
>> Thanks for finding this Rory!  Saved me a ton of time ;-)
>>
> Yes, thanks for the patch - I've applied it.
> However, the service should have started as the immediate flag has been 
> set to true.
> 
> Carsten

Re: ObjectContentManagerFactoryImpl still deploying as delayed component?

Posted by Carsten Ziegeler <cz...@apache.org>.
Craig L. Ching wrote
>>
>> I think I figured this out:  I added @scr.service 
>> interface="org.osgi.framework.SynchronousBundleListener" to 
>> ObjectContentManagerFactoryImpl, and the component now 
>> activates immediately (and registers mapped types from simple-demo)
>>
> 
> Ok, I said in another thread that this didn't work for me, but I forgot
> about the fact that the release bundle was installed by default, not my
> built bundle.  I'll open a JIRA issue with a patch.
> 
> Thanks for finding this Rory!  Saved me a ton of time ;-)
> 
Yes, thanks for the patch - I've applied it.
However, the service should have started as the immediate flag has been 
set to true.

Carsten
-- 
Carsten Ziegeler
cziegeler@apache.org

RE: ObjectContentManagerFactoryImpl still deploying as delayed component?

Posted by "Craig L. Ching" <cc...@mqsoftware.com>.
 

> -----Original Message-----
> From: Rory Douglas [mailto:rory.douglas@oracle.com] 
> Sent: Tuesday, July 22, 2008 11:40 PM
> To: sling-dev@incubator.apache.org
> Subject: Re: ObjectContentManagerFactoryImpl still deploying 
> as delayed component?
> 
> I think I figured this out:  I added @scr.service 
> interface="org.osgi.framework.SynchronousBundleListener" to 
> ObjectContentManagerFactoryImpl, and the component now 
> activates immediately (and registers mapped types from simple-demo)
> 

Ok, I said in another thread that this didn't work for me, but I forgot
about the fact that the release bundle was installed by default, not my
built bundle.  I'll open a JIRA issue with a patch.

Thanks for finding this Rory!  Saved me a ton of time ;-)


> > Regards,
> > Rory
> 

Cheers,
Craig

Re: ObjectContentManagerFactoryImpl still deploying as delayed component?

Posted by Rory Douglas <ro...@oracle.com>.
I think I figured this out:  I added @scr.service 
interface="org.osgi.framework.SynchronousBundleListener" to 
ObjectContentManagerFactoryImpl, and the component now activates 
immediately (and registers mapped types from simple-demo)

Rory Douglas wrote:
> I'm encountering the same error with the simple-demo sample reported 
> in http://issues.apache.org/jira/browse/SLING-546.  I fetched all the 
> source from SVN this afternoon.
>
> On the management console > Components tab, 
> ObjectContentManagerFactoryImpl is showing as "registered", not 
> "active" (expanding the node the Activation value is "delayed").  I've 
> checked the source for ObjectContentManagerFactoryImpl and it has 
> @scr.component metatype="no" immediate="true" in the JavaDoc (and 
> immediate="true" in serviceComponents.xml).
>
> Any idea why this is happening? Thanks for any help
>
> Regards,
> Rory