You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Carl Hall <ca...@hallwaytech.com> on 2010/08/22 05:41:01 UTC

Reference is null

I have 2 references to the same interface in a service.  There should be
multiple impls of this interface in the system, and I'd like to target one
of them as a default service.  I seem to have this wired up according to the
admin console (see below), but we I get into the class, the first noted
reference below is actually null.  I've added a check to my bind method for
the second reference below to set the first reference according to the
target filter.

Any ideas why "defaultSearchProcessor" says it is "Satisfied" but it is null
in the service where these references are defined?  The service itself is
"active".


Reference defaultSearchProcessor
["Satisfied","Service Name:
org.sakaiproject.nakamura.api.search.SearchResultProcessor","Target Filter:
(&(sakai.search.processor.default=true))","Multiple: single","Optional:
mandatory","Policy: static","Bound Service ID 589
(org.sakaiproject.nakamura.search.processors.NodeSearchResultProcessor)"]

Reference SearchResultProcessor
["Satisfied","Service Name:
org.sakaiproject.nakamura.api.search.SearchResultProcessor","Multiple:
multiple","Optional: optional","Policy: dynamic","Bound Service ID 608
(ContentSearchResultProcessor)","Bound Service ID 609
(org.sakaiproject.nakamura.connections.ConnectionSearchResultProcessor)","Bound
Service ID 604
(org.sakaiproject.nakamura.site.search.SiteSearchResultProcessor)","Bound
Service ID 591
(org.sakaiproject.nakamura.search.processors.PagecontentSearchResultProcessor)","Bound
Service ID 600
(org.sakaiproject.nakamura.discussion.searchresults.CommentSearchResultProcessor)","Bound
Service ID 598
(org.sakaiproject.nakamura.presence.search.UserSearchResultProcessor)","Bound
Service ID 610
(org.sakaiproject.nakamura.connections.ConnectionFinderSearchResultProcessor)","Bound
Service ID 589
(org.sakaiproject.nakamura.search.processors.NodeSearchResultProcessor)","Bound
Service ID 611
(org.sakaiproject.nakamura.message.MessageSearchResultProcessor)"]

Re: Reference is null

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

I cannot reproduce your problem with the current version of Apache Felix
SCR (1.6.0) as used in Sling trunk.

Can you verify that
   (a) the bind/unbind method declarations are present in the
        serviceComponent.xml file
   (b) the methods are present in the class file
   (c) no errors are logged by SCR

Thanks and regards
Felix

On 24.08.2010 15:48, Carl Hall wrote:
> I let SCR generate the bind/unbind methods for "defaultSearchProcessor" but
> I wrote the methods for "SearchResultProcessor".  Since the admin shows
> everything wired up and the component is active, I too found it strange that
> "defaultSearchProcessor" would be null.  I have another set of fields that
> mirror these (different interface) and the same thing happened there, too.
> 
> We're using Sling 2.0.9-SNAPSHOT for the moment, so we're using whatever
> version of Felix & SCR are included there.  From my admin console, that
> appears to be 2.0.4 and 1.6.0, respectively.
> 
> 
> On Sun, Aug 22, 2010 at 7:28 AM, Felix Meschberger <fm...@gmail.com>wrote:
> 
>> Hi,
>>
>> On 22.08.2010 05:41, Carl Hall wrote:
>>> I have 2 references to the same interface in a service.  There should be
>>> multiple impls of this interface in the system, and I'd like to target
>> one
>>> of them as a default service.  I seem to have this wired up according to
>> the
>>> admin console (see below), but we I get into the class, the first noted
>>> reference below is actually null.  I've added a check to my bind method
>> for
>>> the second reference below to set the first reference according to the
>>> target filter.
>>>
>>> Any ideas why "defaultSearchProcessor" says it is "Satisfied" but it is
>> null
>>> in the service where these references are defined?  The service itself is
>>> "active".
>>
>> I cannot tell, why your reference is null. What the below list shows, is
>> that the defaultSearchProcessor is satisified and actually bound. So
>> your bind mehtod for the defaultSearchProcessor should have been called.
>>
>> Unless you don't have such a method, or the method threw an exception
>> (which would be logged, though).
>>
>> BTW: What version of Apache Felix SCR/Declarative Services are you using ?
>>
>> Regards
>> Felix
>>
>>>
>>>
>>> Reference defaultSearchProcessor
>>> ["Satisfied","Service Name:
>>> org.sakaiproject.nakamura.api.search.SearchResultProcessor","Target
>> Filter:
>>> (&(sakai.search.processor.default=true))","Multiple: single","Optional:
>>> mandatory","Policy: static","Bound Service ID 589
>>> (org.sakaiproject.nakamura.search.processors.NodeSearchResultProcessor)"]
>>>
>>> Reference SearchResultProcessor
>>> ["Satisfied","Service Name:
>>> org.sakaiproject.nakamura.api.search.SearchResultProcessor","Multiple:
>>> multiple","Optional: optional","Policy: dynamic","Bound Service ID 608
>>> (ContentSearchResultProcessor)","Bound Service ID 609
>>>
>> (org.sakaiproject.nakamura.connections.ConnectionSearchResultProcessor)","Bound
>>> Service ID 604
>>> (org.sakaiproject.nakamura.site.search.SiteSearchResultProcessor)","Bound
>>> Service ID 591
>>>
>> (org.sakaiproject.nakamura.search.processors.PagecontentSearchResultProcessor)","Bound
>>> Service ID 600
>>>
>> (org.sakaiproject.nakamura.discussion.searchresults.CommentSearchResultProcessor)","Bound
>>> Service ID 598
>>>
>> (org.sakaiproject.nakamura.presence.search.UserSearchResultProcessor)","Bound
>>> Service ID 610
>>>
>> (org.sakaiproject.nakamura.connections.ConnectionFinderSearchResultProcessor)","Bound
>>> Service ID 589
>>>
>> (org.sakaiproject.nakamura.search.processors.NodeSearchResultProcessor)","Bound
>>> Service ID 611
>>> (org.sakaiproject.nakamura.message.MessageSearchResultProcessor)"]
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Reference is null

Posted by Carl Hall <ca...@hallwaytech.com>.
I let SCR generate the bind/unbind methods for "defaultSearchProcessor" but
I wrote the methods for "SearchResultProcessor".  Since the admin shows
everything wired up and the component is active, I too found it strange that
"defaultSearchProcessor" would be null.  I have another set of fields that
mirror these (different interface) and the same thing happened there, too.

We're using Sling 2.0.9-SNAPSHOT for the moment, so we're using whatever
version of Felix & SCR are included there.  From my admin console, that
appears to be 2.0.4 and 1.6.0, respectively.


On Sun, Aug 22, 2010 at 7:28 AM, Felix Meschberger <fm...@gmail.com>wrote:

> Hi,
>
> On 22.08.2010 05:41, Carl Hall wrote:
> > I have 2 references to the same interface in a service.  There should be
> > multiple impls of this interface in the system, and I'd like to target
> one
> > of them as a default service.  I seem to have this wired up according to
> the
> > admin console (see below), but we I get into the class, the first noted
> > reference below is actually null.  I've added a check to my bind method
> for
> > the second reference below to set the first reference according to the
> > target filter.
> >
> > Any ideas why "defaultSearchProcessor" says it is "Satisfied" but it is
> null
> > in the service where these references are defined?  The service itself is
> > "active".
>
> I cannot tell, why your reference is null. What the below list shows, is
> that the defaultSearchProcessor is satisified and actually bound. So
> your bind mehtod for the defaultSearchProcessor should have been called.
>
> Unless you don't have such a method, or the method threw an exception
> (which would be logged, though).
>
> BTW: What version of Apache Felix SCR/Declarative Services are you using ?
>
> Regards
> Felix
>
> >
> >
> > Reference defaultSearchProcessor
> > ["Satisfied","Service Name:
> > org.sakaiproject.nakamura.api.search.SearchResultProcessor","Target
> Filter:
> > (&(sakai.search.processor.default=true))","Multiple: single","Optional:
> > mandatory","Policy: static","Bound Service ID 589
> > (org.sakaiproject.nakamura.search.processors.NodeSearchResultProcessor)"]
> >
> > Reference SearchResultProcessor
> > ["Satisfied","Service Name:
> > org.sakaiproject.nakamura.api.search.SearchResultProcessor","Multiple:
> > multiple","Optional: optional","Policy: dynamic","Bound Service ID 608
> > (ContentSearchResultProcessor)","Bound Service ID 609
> >
> (org.sakaiproject.nakamura.connections.ConnectionSearchResultProcessor)","Bound
> > Service ID 604
> > (org.sakaiproject.nakamura.site.search.SiteSearchResultProcessor)","Bound
> > Service ID 591
> >
> (org.sakaiproject.nakamura.search.processors.PagecontentSearchResultProcessor)","Bound
> > Service ID 600
> >
> (org.sakaiproject.nakamura.discussion.searchresults.CommentSearchResultProcessor)","Bound
> > Service ID 598
> >
> (org.sakaiproject.nakamura.presence.search.UserSearchResultProcessor)","Bound
> > Service ID 610
> >
> (org.sakaiproject.nakamura.connections.ConnectionFinderSearchResultProcessor)","Bound
> > Service ID 589
> >
> (org.sakaiproject.nakamura.search.processors.NodeSearchResultProcessor)","Bound
> > Service ID 611
> > (org.sakaiproject.nakamura.message.MessageSearchResultProcessor)"]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re: Reference is null

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

On 22.08.2010 05:41, Carl Hall wrote:
> I have 2 references to the same interface in a service.  There should be
> multiple impls of this interface in the system, and I'd like to target one
> of them as a default service.  I seem to have this wired up according to the
> admin console (see below), but we I get into the class, the first noted
> reference below is actually null.  I've added a check to my bind method for
> the second reference below to set the first reference according to the
> target filter.
> 
> Any ideas why "defaultSearchProcessor" says it is "Satisfied" but it is null
> in the service where these references are defined?  The service itself is
> "active".

I cannot tell, why your reference is null. What the below list shows, is
that the defaultSearchProcessor is satisified and actually bound. So
your bind mehtod for the defaultSearchProcessor should have been called.

Unless you don't have such a method, or the method threw an exception
(which would be logged, though).

BTW: What version of Apache Felix SCR/Declarative Services are you using ?

Regards
Felix

> 
> 
> Reference defaultSearchProcessor
> ["Satisfied","Service Name:
> org.sakaiproject.nakamura.api.search.SearchResultProcessor","Target Filter:
> (&(sakai.search.processor.default=true))","Multiple: single","Optional:
> mandatory","Policy: static","Bound Service ID 589
> (org.sakaiproject.nakamura.search.processors.NodeSearchResultProcessor)"]
> 
> Reference SearchResultProcessor
> ["Satisfied","Service Name:
> org.sakaiproject.nakamura.api.search.SearchResultProcessor","Multiple:
> multiple","Optional: optional","Policy: dynamic","Bound Service ID 608
> (ContentSearchResultProcessor)","Bound Service ID 609
> (org.sakaiproject.nakamura.connections.ConnectionSearchResultProcessor)","Bound
> Service ID 604
> (org.sakaiproject.nakamura.site.search.SiteSearchResultProcessor)","Bound
> Service ID 591
> (org.sakaiproject.nakamura.search.processors.PagecontentSearchResultProcessor)","Bound
> Service ID 600
> (org.sakaiproject.nakamura.discussion.searchresults.CommentSearchResultProcessor)","Bound
> Service ID 598
> (org.sakaiproject.nakamura.presence.search.UserSearchResultProcessor)","Bound
> Service ID 610
> (org.sakaiproject.nakamura.connections.ConnectionFinderSearchResultProcessor)","Bound
> Service ID 589
> (org.sakaiproject.nakamura.search.processors.NodeSearchResultProcessor)","Bound
> Service ID 611
> (org.sakaiproject.nakamura.message.MessageSearchResultProcessor)"]
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org