It's seems it was caused by this https://jira.springsource.org/browse/SPR-8964 The issue is fixed in spring 3.1.1
-----Original Message----- From: Sergey Beryozkin [mailto:[email protected]] Sent: Wednesday, May 09, 2012 4:17 PM To: [email protected] Subject: Re: Spring : TypeMismatchException in jaxrs:client after upgrading to 2.6.0 Hi On 09/05/12 15:11, Pavel Khodchenkov wrote: > After upgrading spring to 3.1.1.RELEASE, the issue has gone :) > Thanks for the confirmation. I guess in 3.1.0.RELEASE, Spring auto-converts the single values to (singleton) lists of values which would break a lot of code, as in this example. Cheers, Sergey > -----Original Message----- > From: Pavel Khodchenkov > Sent: Wednesday, May 09, 2012 4:01 PM > To: [email protected] > Subject: RE: Spring : TypeMismatchException in jaxrs:client after > upgrading to 2.6.0 > > Hi, > Cxf-2.6.0 uses spring 3.0.7.RELEASE and org.apache.cxf.jaxrs.spring. > JAXRSClientFactoryBeanTest works fine. > However, it also fails if spring version 3.1.0.RELEASE is used: > > org.springframework.beans.factory.BeanCreationException: Error creating bean > with name 'setHeaderClient.proxyFactory': Error setting property values; > nested exception is org.springframework.beans.PropertyBatchUpdateException; > nested PropertyAccessExceptions (1) are: > PropertyAccessException 1: org.springframework.beans.TypeMismatchException: > Failed to convert property value of type 'java.util.LinkedHashMap' to > required type 'java.util.Map' for property 'headers'; nested exception is > java.lang.ClassCastException: java.util.ArrayList cannot be cast to > java.lang.String > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1396) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) > at > org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) > at > org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) > at > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) > at > org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) > at > org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) > at > org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) > at > org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93) > at > org.apache.cxf.jaxrs.spring.JAXRSClientFactoryBeanTest.testClients(JAXRSClientFactoryBeanTest.java:41) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) > at > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) > at > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) > at > org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) > at > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31) > at > org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49) > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) > at org.junit.runners.ParentRunner.run(ParentRunner.java:236) > at org.junit.runner.JUnitCore.run(JUnitCore.java:157) > at > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76) > at > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:182) > at > com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:62) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) > Caused by: org.springframework.beans.PropertyBatchUpdateException; nested > PropertyAccessExceptions (1) are: > PropertyAccessException 1: org.springframework.beans.TypeMismatchException: > Failed to convert property value of type 'java.util.LinkedHashMap' to > required type 'java.util.Map' for property 'headers'; nested exception is > java.lang.ClassCastException: java.util.ArrayList cannot be cast to > java.lang.String > at > org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:102) > at > org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58) > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1393) > ... 40 more > > -----Original Message----- > From: Pavel Khodchenkov > Sent: Wednesday, May 09, 2012 12:19 AM To:<[email protected]> > Cc: [email protected] > Subject: Re: Spring : TypeMismatchException in jaxrs:client after > upgrading to 2.6.0 > > Hi, > No,it's not an osgi env. I will checkout cxf 2.6. Sources and compare > my config with unit cxf unit test > > Sent from my iPad > > On 08.05.2012, at 14:51, "Sergey Beryozkin"<[email protected]> wrote: > >> Hi >> On 07/05/12 14:45, Pavel Khodchenkov wrote: >>> Hi folks, >>> I am having the following exception in Spring after upgrading to cxf 2.6.0 >>> from 2.5.2: >>> >>> Caused by: org.springframework.beans.factory.BeanCreationException: Error >>> creating bean with name 'transactionServiceRestPort.proxyFactory': Error >>> setting property values; nested exception is >>> org.springframework.beans.PropertyBatchUpdateException; nested >>> PropertyAccessExceptions (1) are: >>> PropertyAccessException 1: >>> org.springframework.beans.TypeMismatchException: Failed to convert >>> property value of type 'java.util.LinkedHashMap' to required type >>> 'java.util.Map' for property 'headers'; nested exception is >>> java.lang.ClassCastException: java.util.ArrayList cannot be cast to >>> java.lang.String >>> >>> Code snippet: >>> >>> <jaxrs:client id="transactionServiceRestPort" >>> >>> address="http://localhost:9090/services/TransactionRestService" >>> >>> serviceClass="com.kitd.services.transaction.api.TransactionService" >>> inheritHeaders="true"> >>> <jaxrs:headers> >>> <entry key="Content-Type" value="application/xml"/> >>> <entry key="Accept" value="application/xml"/> >>> </jaxrs:headers> >>> </jaxrs:client> >>> >>> What is wrong with headers? >> >> Does it happen in the OSGI environment ? Looks like a class loader >> issue...We have a simple jaxrs client loaded from Spring where the headers >> are also specified. It is difficult to figure out where the problem is >> without a test case. >> >> Cheers, Sergey >> >>> This e-mail and any attachments are confidential and intended solely for >>> the addressee and may also be privileged or exempt from disclosure under >>> applicable law. If you are not the addressee, or have received this e-mail >>> in error, please notify the sender immediately, delete it from your system >>> and do not copy, disclose or otherwise act upon any part of this e-mail or >>> its attachments. Internet communications are not guaranteed to be secure or >>> virus-free. KIT digital Inc. and its affiliates do not accept >>> responsibility for any loss arising from unauthorised access to, or >>> interference with, any Internet communications by any third party, or from >>> the transmission of any viruses. >>> >> >> >> -- >> Sergey Beryozkin >> >> Talend Community Coders >> http://coders.talend.com/ >> >> Blog: http://sberyozkin.blogspot.com -- Sergey Beryozkin Talend Community Coders http://coders.talend.com/ Blog: http://sberyozkin.blogspot.com
