[
https://issues.apache.org/jira/browse/KARAF-3438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14270669#comment-14270669
]
Freeman Fang commented on KARAF-3438:
-------------------------------------
Hi Matthieu,
This ClassCastException generally means the class
com.mycompany.blueprint.app.MyHelloService are loaded by different bundles, so
please check your client bundle first and ensure it not embed the
com.mycompany.blueprint.app.MyHelloService class.
Freeman
> ClassCastException on blueprint service reference interface method call
> -----------------------------------------------------------------------
>
> Key: KARAF-3438
> URL: https://issues.apache.org/jira/browse/KARAF-3438
> Project: Karaf
> Issue Type: Bug
> Components: karaf-core, karaf-osgi
> Affects Versions: 3.0.2
> Environment: Windows 7 64bits, Java jdk 1.7.0_u71, maven 3.2.5, no
> admin rights on the platform.
> Reporter: Matthieu Marseille
> Assignee: Jean-Baptiste Onofré
> Fix For: 4.0.0, 3.0.3
>
>
> I've tried to apply the Blueprint tutorial with a simple MyHelloService
> service implemented as MyHelloServiceImpl and exposed to a client that gets
> this service as a reference. Both starting the service and client bundles is
> clean, but when the client calls the simple and unique method hello() of the
> service at startup (blueprint "init-method") I got :
> Caused by: java.lang.ClassCastException:
> Proxy8b5c6c04_36f0_4691_ad01_007e338b9cc9 cannot be cast to
> com.mycompany.blueprint.app.MyHelloService
> at Proxydc340f70_a828_4e83_b591_845608690a75.hello(Unknown Source)
> at
> com.mycompany.blueprint.client.MyActivator.startUp(MyActivator.java:11)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)[:1.7.0_71]
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_71]
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_71]
> at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_71]
> at
> org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:297)
> at
> org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:958)
> at
> org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:712)
> It seems to me that the implementation is registered twice under two proxies
> (proxy names are different at exception throw), which causes the error,
> apparently.
> I have tried the example at home under Windows8 64bits (with admin rights)
> with no error.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)