Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion service is attempting to convert types that should not be converted [SPR-7283] #11942

Closed
spring-projects-issues opened this issue Jun 14, 2010 · 2 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Scott Andrews opened SPR-7283 and commented

There is a regression in the latest snapshots for 3.0.3 from 3.0.2. The conversion service is attempting to convert incompatible types that share a common interface when defining a collection of these types. Each of these types share a common interface, but are not convertible. The content of this array should be respected as is and not converted.

<util:list id="traceResourceFinders">
     <bean id="endPointFinder" class="com.springsource.insight.repo.analysis.EndPointFinder" />
     <bean id="applicationFinder"
          class="com.springsource.insight.repo.analysis.ApplicationFinder" />
     <bean id="applicationInstanceFinder"
          class="com.springsource.insight.repo.analysis.ApplicationInstanceFinder" />
     <bean id="applicationInstanceEndPointFinder"
          class="com.springsource.insight.repo.analysis.ApplicationInstanceEndPointFinder" />
     <bean id="serverFinder" class="com.springsource.insight.repo.analysis.ServerFinder" />
</util:list>

Leads to:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'traceResourceFinders': Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.util.ArrayList' to required type 'java.util.List' for property 'sourceList'; nested exception is org.springframework.core.convert.ConversionFailedException: Unable to convert value [com.springsource.insight.repo.analysis.EndPointFinder@586f87, com.springsource.insight.repo.analysis.ApplicationFinder@20b52, com.springsource.insight.repo.analysis.ApplicationInstanceFinder@3540ce, com.springsource.insight.repo.analysis.ApplicationInstanceEndPointFinder@31ac15, com.springsource.insight.repo.analysis.ServerFinder@18ac57] from type 'java.util.ArrayList' to type 'java.util.List'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from [com.springsource.insight.repo.analysis.EndPointFinder] to [com.springsource.insight.repo.analysis.ApplicationFinder]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
	... 81 more
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.util.ArrayList' to required type 'java.util.List' for property 'sourceList'; nested exception is org.springframework.core.convert.ConversionFailedException: Unable to convert value [com.springsource.insight.repo.analysis.EndPointFinder@586f87, com.springsource.insight.repo.analysis.ApplicationFinder@20b52, com.springsource.insight.repo.analysis.ApplicationInstanceFinder@3540ce, com.springsource.insight.repo.analysis.ApplicationInstanceEndPointFinder@31ac15, com.springsource.insight.repo.analysis.ServerFinder@18ac57] from type 'java.util.ArrayList' to type 'java.util.List'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from [com.springsource.insight.repo.analysis.EndPointFinder] to [com.springsource.insight.repo.analysis.ApplicationFinder]
	at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:457)
	at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:499)
	at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:493)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1363)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1322)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1076)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
	... 87 more
Caused by: org.springframework.core.convert.ConversionFailedException: Unable to convert value [com.springsource.insight.repo.analysis.EndPointFinder@586f87, com.springsource.insight.repo.analysis.ApplicationFinder@20b52, com.springsource.insight.repo.analysis.ApplicationInstanceFinder@3540ce, com.springsource.insight.repo.analysis.ApplicationInstanceEndPointFinder@31ac15, com.springsource.insight.repo.analysis.ServerFinder@18ac57] from type 'java.util.ArrayList' to type 'java.util.List'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from [com.springsource.insight.repo.analysis.EndPointFinder] to [com.springsource.insight.repo.analysis.ApplicationFinder]
	at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:40)
	at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:187)
	at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:141)
	at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:447)
	... 93 more
Caused by: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from [com.springsource.insight.repo.analysis.EndPointFinder] to [com.springsource.insight.repo.analysis.ApplicationFinder]
	at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:180)
	at org.springframework.core.convert.support.CollectionToCollectionConverter.convert(CollectionToCollectionConverter.java:63)
	at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:37)
	... 96 more

Affects: 3.0.3

Attachments:

Referenced from: commits 902938e, 0e59fc4

@spring-projects-issues
Copy link
Collaborator Author

Scott Andrews commented

Failing test case

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

This should be fixed in trunk now, through smarter guessing of the common element type.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants