felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Artem Zhirkov ...@develdynamic.com>
Subject Re: Getting a reference to a declarative service
Date Tue, 20 Jan 2015 18:27:55 GMT
I installed felix scr bundle into my host osgi application and tried to 
obtain a list of active services by visiting a controller of my spring 
application which calls osgi code and it threw the following error:

| Error java.lang.NoClassDefFoundError: 
org/springsource/loaded/ri/ReflectiveInterceptor
| Error     at 
org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:253)
| Error     at 
org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:127)
| Error     at 
org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:871)
| Error     at 
org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:838)
| Error     at 
org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:777)
| Error     at 
org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:320)
| Error     at 
org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:231)
| Error     at 
org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:327)

Full stack trace available at http://paste.ubuntu.com/9796839/


It seems like felix scr interferes with spring loaded? Is it possible to 
avoid this?


Thanks

On 20.01.2015 18:08, Artem Zhirkov wrote:
> Neil,
> bundle is active, but I dont have any DS implementation bundle 
> installed...I thought the framework itself contains the implementation.
>
> On 01/20/2015 03:19 PM, Neil Bartlett wrote:
>> Dirk: I don’t think Artem was asking about activation of the 
>> component, he has a problem with service registration. So whether the 
>> component is immediate or delayed seems to be irrelevant.
>>
>> Artem: there are a few things you need to check. Is your bundle 
>> active? Do you have a DS implementation bundle (such as 
>> org.apache.felix.scr, or org.eclipse.equinox.ds) installed and active?
>>
>> Regards,
>> Neil
>>
>>
>>> On 20 Jan 2015, at 11:09, Dirk Rudolph <dirk.rudolph@netcentric.biz> 
>>> wrote:
>>>
>>> Try to add immediate=“true” to your component definition. This 
>>> should result in something like
>>>
>>>> <?xml version="1.0" encoding="UTF-8"?><components 
>>>> xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
>>>>    <scr:component immediate=“true” 
>>>> name="ru.multicabinet.gateway.ExampleDS">
>>>>        <implementation class="ru.multicabinet.gateway.ExampleDS"/>
>>>>        <service servicefactory="false">
>>>>            <provide interface="ru.multicabinet.gateway.SimpleI"/>
>>>>        </service>
>>>>        <property name="service.pid" 
>>>> value="ru.multicabinet.gateway.ExampleDS"/>
>>>>    </scr:component>
>>>> </components>
>>> and causes the component to be started immediately after it has been 
>>> registered.
>>>
>>> Kind regards,
>>> Dirk Rudolph | Senior Software Engineer
>>>
>>> Netcentric AG
>>>
>>> M: +41 79 642 37 11
>>> D: +49 174 966 84 34
>>>
>>> dirk.rudolph@netcentric.biz <mailto:dirk.rudolph@netcentric.biz> | 
>>> www.netcentric.biz <http://www.netcentric.biz/>
>>>> On 20 Jan 2015, at 11:53, Artem Zhirkov <az@develdynamic.com> wrote:
>>>>
>>>> Hello,
>>>>
>>>> I want to include more than one service into a bundle, so it seems 
>>>> like I have to make a use of declarative services.
>>>>
>>>> I'm building a test bundle with maven + maven-bundle-plugin and 
>>>> generating the ds descriptor with maven-scr-plugin, so it looks 
>>>> like this:
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?><components 
>>>> xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0">
>>>>    <scr:component name="ru.multicabinet.gateway.ExampleDS">
>>>>        <implementation class="ru.multicabinet.gateway.ExampleDS"/>
>>>>        <service servicefactory="false">
>>>>            <provide interface="ru.multicabinet.gateway.SimpleI"/>
>>>>        </service>
>>>>        <property name="service.pid" 
>>>> value="ru.multicabinet.gateway.ExampleDS"/>
>>>>    </scr:component>
>>>> </components>
>>>>
>>>> After installing the test bundle into my osgi container I'm trying 
>>>> to get a list of all services in the test bundle by calling 
>>>> bundle.getRegisteredServices(), but it'd always return null.
>>>>
>>>> What I'm doing wrong? Maybe  I should use ServiceTracker to obtain 
>>>> a reference to ds service?
>>>>
>>>> Thanks
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>
>
>
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message