You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Wulff, Oliver" <Ol...@iona.com> on 2008/09/05 14:21:13 UTC

Injection support for client side proxy (jaxws:client) unclear

Hi there

I develop a custom feature which registers an OutInterceptor which invokes another webservice within the handleMessage method. The idea is to use injection and configure the jaxws:client bean in the spring configuration.

There are two options:
1) set/get Method in Feature class
2) Java Resource annotation in Feature class

Both doesn't work for me.

option 1:
---------

public class MyFeature...
....
public EncryptionInterfaceV10 getEncryptionProxy() {
    return encryptionProxy;
}

public void setEncryptionProxy(EncryptionInterfaceV10 encryptionProxy) {
    this.encryptionProxy = encryptionProxy;
}
...

Here the configuration on the client side:
    <cxf:bus>
    	<cxf:features>
    	     <ref bean="MyFeature"/>
        </cxf:features>
    </cxf:bus>
    
    <jaxws:client id="encryptionProxyId"
      xmlns:ns1="...."
      serviceClass="..."
      wsdlLocation="...."
      serviceName="..."
      endpointName="...."
      address="..." />
    
    <bean id="MyFeature" class="MyFeature">
        <property name="encryptionProxy">
            <ref bean="encryptionProxyId" />
        </property>
    </bean>

When I run the cxf client, I get the following exception:

05.09.2008 13:48:06 org.apache.cxf.bus.spring.SpringBusFactory createBus
WARNUNG: Failed to create application context.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf': Cannot resolve reference to bean 'PMPFeature' while setting bean property 'features' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'PMPFeature' defined in class path resource [client.xml]: Cannot resolve reference to bean 'encryptionProxyId' while setting bean property 'encryptionProxy'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'encryptionProxyId': Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public java.lang.Object org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception; nested exception is java.lang.NullPointerException
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'PMPFeature' defined in class path resource [client.xml]: Cannot resolve reference to bean 'encryptionProxyId' while setting bean property 'encryptionProxy'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'encryptionProxyId': Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public java.lang.Object org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception; nested exception is java.lang.NullPointerException
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'encryptionProxyId': Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public java.lang.Object org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception; nested exception is java.lang.NullPointerException
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public java.lang.Object org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception; nested exception is java.lang.NullPointerException
Caused by: java.lang.NullPointerException

Option 2:
---------

public class MyFeature...
...
    @Resource(name = "encryptionProxyId")
    private EncryptionInterfaceV10 encryptionProxy;
...

The proxy instance is null. It looks like that CXF doesn't try to initialize it at all.


I don't understand why injection doesn't work in this situation whereas it works fine for a jaxws:endpoint bean.

Any ideas?

Thanks
Oliver

AW: Injection support for client side proxy (jaxws:client) unclear

Posted by "Wulff, Oliver" <Ol...@iona.com>.
Hi there

Any ideas?

Your help is highly appreciated.

Thanks
Oliver

-----Ursprüngliche Nachricht-----
Von: Wulff, Oliver [mailto:Oliver.Wulff@iona.com]
Gesendet: Fr 05.09.2008 14:21
An: users@cxf.apache.org
Betreff: Injection support for client side proxy (jaxws:client) unclear
 
Hi there

I develop a custom feature which registers an OutInterceptor which invokes another webservice within the handleMessage method. The idea is to use injection and configure the jaxws:client bean in the spring configuration.

There are two options:
1) set/get Method in Feature class
2) Java Resource annotation in Feature class

Both doesn't work for me.

option 1:
---------

public class MyFeature...
....
public EncryptionInterfaceV10 getEncryptionProxy() {
    return encryptionProxy;
}

public void setEncryptionProxy(EncryptionInterfaceV10 encryptionProxy) {
    this.encryptionProxy = encryptionProxy;
}
...

Here the configuration on the client side:
    <cxf:bus>
    	<cxf:features>
    	     <ref bean="MyFeature"/>
        </cxf:features>
    </cxf:bus>
    
    <jaxws:client id="encryptionProxyId"
      xmlns:ns1="...."
      serviceClass="..."
      wsdlLocation="...."
      serviceName="..."
      endpointName="...."
      address="..." />
    
    <bean id="MyFeature" class="MyFeature">
        <property name="encryptionProxy">
            <ref bean="encryptionProxyId" />
        </property>
    </bean>

When I run the cxf client, I get the following exception:

05.09.2008 13:48:06 org.apache.cxf.bus.spring.SpringBusFactory createBus
WARNUNG: Failed to create application context.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf': Cannot resolve reference to bean 'PMPFeature' while setting bean property 'features' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'PMPFeature' defined in class path resource [client.xml]: Cannot resolve reference to bean 'encryptionProxyId' while setting bean property 'encryptionProxy'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'encryptionProxyId': Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public java.lang.Object org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception; nested exception is java.lang.NullPointerException
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'PMPFeature' defined in class path resource [client.xml]: Cannot resolve reference to bean 'encryptionProxyId' while setting bean property 'encryptionProxy'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'encryptionProxyId': Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public java.lang.Object org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception; nested exception is java.lang.NullPointerException
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'encryptionProxyId': Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public java.lang.Object org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception; nested exception is java.lang.NullPointerException
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public java.lang.Object org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception; nested exception is java.lang.NullPointerException
Caused by: java.lang.NullPointerException

Option 2:
---------

public class MyFeature...
...
    @Resource(name = "encryptionProxyId")
    private EncryptionInterfaceV10 encryptionProxy;
...

The proxy instance is null. It looks like that CXF doesn't try to initialize it at all.


I don't understand why injection doesn't work in this situation whereas it works fine for a jaxws:endpoint bean.

Any ideas?

Thanks
Oliver


Re: Injection support for client side proxy (jaxws:client) unclear

Posted by Daniel Kulp <dk...@apache.org>.
You may be hitting a circular bean problem.   Creating the bus requires the 
feature which requires the client which requires a bus.   Not really sure 
though.   Any chance you could package up a small sample and send it along to 
me to dig into?

Dan


On Friday 05 September 2008 8:21:13 am Wulff, Oliver wrote:
> Hi there
>
> I develop a custom feature which registers an OutInterceptor which invokes
> another webservice within the handleMessage method. The idea is to use
> injection and configure the jaxws:client bean in the spring configuration.
>
> There are two options:
> 1) set/get Method in Feature class
> 2) Java Resource annotation in Feature class
>
> Both doesn't work for me.
>
> option 1:
> ---------
>
> public class MyFeature...
> ....
> public EncryptionInterfaceV10 getEncryptionProxy() {
>     return encryptionProxy;
> }
>
> public void setEncryptionProxy(EncryptionInterfaceV10 encryptionProxy) {
>     this.encryptionProxy = encryptionProxy;
> }
> ...
>
> Here the configuration on the client side:
>     <cxf:bus>
>     	<cxf:features>
>     	     <ref bean="MyFeature"/>
>         </cxf:features>
>     </cxf:bus>
>
>     <jaxws:client id="encryptionProxyId"
>       xmlns:ns1="...."
>       serviceClass="..."
>       wsdlLocation="...."
>       serviceName="..."
>       endpointName="...."
>       address="..." />
>
>     <bean id="MyFeature" class="MyFeature">
>         <property name="encryptionProxy">
>             <ref bean="encryptionProxyId" />
>         </property>
>     </bean>
>
> When I run the cxf client, I get the following exception:
>
> 05.09.2008 13:48:06 org.apache.cxf.bus.spring.SpringBusFactory createBus
> WARNUNG: Failed to create application context.
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'cxf': Cannot resolve reference to bean 'PMPFeature' while
> setting bean property 'features' with key [0]; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'PMPFeature' defined in class path resource [client.xml]:
> Cannot resolve reference to bean 'encryptionProxyId' while setting bean
> property 'encryptionProxy'; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'encryptionProxyId': Instantiation of bean failed; nested
> exception is
> org.springframework.beans.factory.BeanDefinitionStoreException: Factory
> method [public java.lang.Object
> org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception;
> nested exception is java.lang.NullPointerException Caused by:
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'PMPFeature' defined in class path resource [client.xml]:
> Cannot resolve reference to bean 'encryptionProxyId' while setting bean
> property 'encryptionProxy'; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'encryptionProxyId': Instantiation of bean failed; nested
> exception is
> org.springframework.beans.factory.BeanDefinitionStoreException: Factory
> method [public java.lang.Object
> org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception;
> nested exception is java.lang.NullPointerException Caused by:
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'encryptionProxyId': Instantiation of bean failed; nested
> exception is
> org.springframework.beans.factory.BeanDefinitionStoreException: Factory
> method [public java.lang.Object
> org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception;
> nested exception is java.lang.NullPointerException Caused by:
> org.springframework.beans.factory.BeanDefinitionStoreException: Factory
> method [public java.lang.Object
> org.apache.cxf.frontend.ClientProxyFactoryBean.create()] threw exception;
> nested exception is java.lang.NullPointerException Caused by:
> java.lang.NullPointerException
>
> Option 2:
> ---------
>
> public class MyFeature...
> ...
>     @Resource(name = "encryptionProxyId")
>     private EncryptionInterfaceV10 encryptionProxy;
> ...
>
> The proxy instance is null. It looks like that CXF doesn't try to
> initialize it at all.
>
>
> I don't understand why injection doesn't work in this situation whereas it
> works fine for a jaxws:endpoint bean.
>
> Any ideas?
>
> Thanks
> Oliver



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog