aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Ellis (JIRA)" <>
Subject [jira] [Commented] (ARIES-1140) Injected java.lang.reflect.Proxy implements only single interface
Date Fri, 13 Dec 2013 09:12:07 GMT


Richard Ellis commented on ARIES-1140:

There are two different proxies in play here:
i) a jax-ws proxy (e.g. JaxWsClientProxy) which by the jax-ws spec implements the
ii) a Blueprint service reference proxy, which happens in this case to be proxying the jax-ws

As I said the blueprint spec is very clear that the service reference proxy must only implement
the interface it is injected under. This is really important because the service object that
is backing the injected proxy is only guaranteed to meet that interface. If any other interfaces
were allowed it would be prone to failure if the backing object changed to another service
that provided one, but not all of the interfaces.

Is the CRMService interface generated by the jax-ws blueprint namespace handler? If so I would
think that would be the appropriate place to include the BindingProvider interface so that
any injection of that generated interface includes everything it needs to function. That is
why I asked if the CRMService extends BindingProvider.

> Injected java.lang.reflect.Proxy implements only single interface
> -----------------------------------------------------------------
>                 Key: ARIES-1140
>                 URL:
>             Project: Aries
>          Issue Type: Improvement
>          Components: Proxy
>    Affects Versions: proxy-impl-1.0.1
>            Reporter: Andrei Shakirin
> Hi,
> I have a problem in using Blueprint together with CXF and Karaf projects. The use case
is quite trivial: I inject OSGi service into java class source. This OSGi service is exposed
by declared jax-ws client.
> 1. Blueprint configuration exporting service:
> {code:xml}
> <blueprint xmlns=""
>     xmlns:xsi="" xmlns:cxf=""
>     xmlns:jaxws=""
>     xsi:schemaLocation="
>     ">
>     <jaxws:client id="crmClient"
>         xmlns:serviceNamespace=""
>         serviceClass=""
>         serviceName="serviceNamespace:CRMServiceProvider"
>         endpointName="serviceNamespace:CRMServicePort"
>         address="http://localhost:8080/service/CRMService"/>
>      <service ref="crmClient" interface=""
> </blueprint>
> {code}
> Where is generated jax-ws interface
> 2. Blueprint configuration importing service:
> {code:xml}
> <blueprint xmlns=""
> 	xmlns:xsi="" 	xsi:schemaLocation="">
> 	<reference id="CRMServiceClient" interface=""
> 	<bean id="TestClass"
> 		class="org.talend..demo.TestClass">
> 		<property name="crms" ref="CRMServiceClient" />
> 	</bean>
> </blueprint>
> {code}
> 3. Code in TestClass:
> {code:java}
> ...
>     private CRMService crms;
>     public void setCrms(CRMService crms) {
>         this.crms = crms;
>         System.out.println(crms.getClass());
>         System.out.println(crms.toString());
>         System.out.println(crms instanceof BindingProvider);
>     }
> ...
> {code}
> Problem:
> The problem is that crms proxy, injected into TestClass, implements only
> The proxy calls methods of org.apache.cxf.jaxws.JaxWsClientProxy which implements
interface. I expect that crms proxy also implements, but it is
not the case. I have the following output from setCrms:
> class com.sun.proxy.$Proxy151
> org.apache.cxf.jaxws.JaxWsClientProxy@c3f8b42
> false
> The proxy calls toString() method of JaxWsClientProxy, but it is not instance of BindingProvider
interface. The problem is that this proxy is not jax-ws compatible, because spec requires
that all proxies implementing BindingProvider interface.
> Interesting that Spring DM proxy hasn't such problem: it implements BindingProvider interface
in this scenario.
> Is it Blueprint problem? (seems to be true for me)
> Is there way to fix this in Blueprint?
> Regards,
> Andrei.

This message was sent by Atlassian JIRA

View raw message