So Im still stumbling a bit around this, and not sure what todo...

On Mon, May 18, 2015 at 11:09 AM, nino martinez wael
<[email protected]> wrote:
> Setter is correct:
>
> https://paste.apache.org/e5ld
>
> And BackendBImplement does implement the interface
>
> https://paste.apache.org/4pOv
>
> Heres the interface:
>
> package com.netdesign.osgi.examples.rest.domain;
>
> /**
>  * Created by nmw on 14-05-2015.
>  */
> public interface MessageProvider {
>
>     String getMessage();
> }
>
>
> I've probably made some simple mistake..Other than that im thinking of
> class loader conflicts..
>
> On Mon, May 18, 2015 at 10:03 AM, Jean-Baptiste Onofré <[email protected]> 
> wrote:
>> Hi,
>>
>> Check if the setter has the correct type. Check also if the
>> BackendBImplement implements MessageProvider.
>>
>> Regards
>> JB
>>
>>
>> On 05/18/2015 09:40 AM, nino martinez wael wrote:
>>>
>>> Hi im having a little difficulty getting my services to get "injected"
>>> via a blueprint, the service are injected but when trying to use it,
>>> it fails with this exception:
>>>
>>> Proxyac192a6f_60ad_44a3_8470_75b9a9054462 cannot be cast to
>>> com.netdesign.osgi.examples.rest.domain.MessageProvider
>>> java.lang.ClassCastException
>>>
>>> Service registration (in one bundle, interfaces in a shared bundle):
>>>
>>>      <bean id="backendB"
>>> class="com.netdesign.osgi.examples.rest.backendb.BackendBImplementation"
>>> />
>>>      <service id="serviceB" ref="backendB"
>>> interface="com.netdesign.osgi.examples.rest.domain.MessageProvider"
>>> ranking="2"/>
>>>
>>>
>>> Service consumer (another bundle)
>>>      <bean id="htmlServer"
>>> class="com.netdesign.osgi.examples.rest.endpoint.HtmlServer">
>>>          <!-- <property name="messageProvider"
>>> ref="messageProviderService" /> -->
>>>      </bean>
>>>
>>>      <reference-list
>>> interface="com.netdesign.osgi.examples.rest.domain.MessageProvider">
>>>          <reference-listener ref="htmlServer"
>>> bind-method="setMessageProvider"/>
>>>      </reference-list>
>>>
>>>       <!--<reference id="messageProviderService"
>>>
>>> interface="com.netdesign.osgi.examples.rest.domain.MessageProvider"></reference>-->
>>>
>>>   I started using the commented out stuff since it was simpler, when
>>> fail I switched.
>>>
>>>
>>>
>>>
>>>
>>
>> --
>> Jean-Baptiste Onofré
>> [email protected]
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>
>
>
> --
> Best regards / Med venlig hilsen
> Nino Martinez



-- 
Best regards / Med venlig hilsen
Nino Martinez

Reply via email to