You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Ashwin Kondhalkar <as...@oracle.com> on 2009/06/11 15:43:54 UTC
Issues while writing interceptors in CXF.
Hi,
I am implementing the interceptor for doing schema validation on incoming request. I have written MyInterceptor.java class and made entry of it in cxf.xml file.
MyInterceptor.java
*********************************************************************************************************************************************************************
package com.citi.soa.domainservices.interceptor;
import org.apache.cxf.binding.soap.SoapMessage;
import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.phase.Phase;
public class MyInterceptor extends AbstractSoapInterceptor
{
public MyInterceptor() {
super(Phase.UNMARSHAL);
}
public void handleMessage(SoapMessage message) throws Fault {
System.out.println("********************************************************************************");
System.out.println("The interceptor MyInterceptor is called");
System.out.println("********************************************************************************");
}
}
*********************************************************************************************************************************************************************
Entry in CXF.xml
*********************************************************************************************************************************************************************
<bean id="MyInterceptor" class="com.citi.soa.domainservices.interceptor.MyInterceptor"/>
<!-- We are adding the interceptors to the bus as we will have only one endpoint/service/bus. -->
<cxf:bus>
<cxf:inInterceptors>
<list>
<ref bean="MyInterceptor"/>
</list>
</cxf:inInterceptors>
*********************************************************************************************************************************************************************
I have deployed the application and while deploying I faced below exception, Can someone guide me how to get rid of this issue?
Exception I got at the console,
*********************************************************************************************************************************************************************
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf': Er
ror setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateEx
ception; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert pr
operty value of type [java.util.ArrayList] to required type [java.util.List] for property 'inInt
erceptors'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type
[java.util.ArrayList] to required type [org.apache.cxf.interceptor.Interceptor] for property 'i
nInterceptors[0]': no matching editors or conversion strategy found
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptio
n details (1) are:
PropertyAccessException 1:
org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.
util.ArrayList] to required type [java.util.List] for property 'inInterceptors'; nested exceptio
n is java.lang.IllegalArgumentException: Cannot convert value of type [java.util.ArrayList] to r
equired type [org.apache.cxf.interceptor.Interceptor] for property 'inInterceptors[0]': no match
ing editors or conversion strategy found
Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [java.util.ArrayList
] to required type [org.apache.cxf.interceptor.Interceptor] for property 'inInterceptors[0]': no
matching editors or conversion strategy found
*********************************************************************************************************************************************************************
Thanks & Regards
Ashwin
Re: Issues while writing interceptors in CXF.
Posted by Benson Margulies <bi...@gmail.com>.
Get rid of the <list>. Our spring extension does that for you. See the
configuration_interceptors example.
On Thu, Jun 11, 2009 at 9:43 AM, Ashwin
Kondhalkar<as...@oracle.com> wrote:
> Hi,
>
> I am implementing the interceptor for doing schema validation on incoming request. I have written MyInterceptor.java class and made entry of it in cxf.xml file.
>
> MyInterceptor.java
>
> *********************************************************************************************************************************************************************
>
> package com.citi.soa.domainservices.interceptor;
>
> import org.apache.cxf.binding.soap.SoapMessage;
>
> import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
>
> import org.apache.cxf.interceptor.Fault;
>
> import org.apache.cxf.phase.Phase;
>
> public class MyInterceptor extends AbstractSoapInterceptor
>
> {
>
> public MyInterceptor() {
>
> super(Phase.UNMARSHAL);
>
> }
>
> public void handleMessage(SoapMessage message) throws Fault {
>
> System.out.println("********************************************************************************");
>
> System.out.println("The interceptor MyInterceptor is called");
>
> System.out.println("********************************************************************************");
>
> }
>
> }
>
> *********************************************************************************************************************************************************************
>
> Entry in CXF.xml
>
> *********************************************************************************************************************************************************************
>
> <bean id="MyInterceptor" class="com.citi.soa.domainservices.interceptor.MyInterceptor"/>
>
> <!-- We are adding the interceptors to the bus as we will have only one endpoint/service/bus. -->
>
> <cxf:bus>
>
> <cxf:inInterceptors>
>
> <list>
>
> <ref bean="MyInterceptor"/>
>
> </list>
>
> </cxf:inInterceptors>
>
> *********************************************************************************************************************************************************************
>
> I have deployed the application and while deploying I faced below exception, Can someone guide me how to get rid of this issue?
>
> Exception I got at the console,
>
> *********************************************************************************************************************************************************************
>
> org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf': Er
> ror setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateEx
> ception; nested PropertyAccessExceptions (1) are:
> PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert pr
> operty value of type [java.util.ArrayList] to required type [java.util.List] for property 'inInt
> erceptors'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type
> [java.util.ArrayList] to required type [org.apache.cxf.interceptor.Interceptor] for property 'i
> nInterceptors[0]': no matching editors or conversion strategy found
> Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptio
> n details (1) are:
> PropertyAccessException 1:
> org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.
> util.ArrayList] to required type [java.util.List] for property 'inInterceptors'; nested exceptio
> n is java.lang.IllegalArgumentException: Cannot convert value of type [java.util.ArrayList] to r
> equired type [org.apache.cxf.interceptor.Interceptor] for property 'inInterceptors[0]': no match
> ing editors or conversion strategy found
> Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [java.util.ArrayList
> ] to required type [org.apache.cxf.interceptor.Interceptor] for property 'inInterceptors[0]': no
> matching editors or conversion strategy found
>
> *********************************************************************************************************************************************************************
>
>
>
> Thanks & Regards
>
> Ashwin
>
>