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

Reply via email to