
Originally Posted by
Mark Fisher
Could you please post this in JIRA? The chain *should* accept the object-to-string-transformer.
We had originally designed the outbound File adapter to accept the result of toString(). However, that led to excessively aggressive conversion to Strings (message payloads that should *not* be converted to Strings).
Hi Mark, I have the same issue with Spring Integration 2.0.5.RELEASE but I think that this is problem with outbound channel adapter which is the last element in chain rather than with transformer. Currently, I'm trying to chain header enricher and file outbound channel adapter and I'm getting exactly the same exception as MmarcoM.
This is what I cannot do:
Code:
<chain input-channel="fileInChannel">
<header-enricher>
<header name="file_name" value="${conf.filename}" />
</header-enricher>
<file:outbound-channel-adapter id="storeConfigurationFileAdapter"
directory="${conf.directory}" />
</chain>
And here is ugly workaround:
Code:
<chain input-channel="fileInChannel">
<header-enricher>
<header name="file_name" value="${conf.filename}" />
</header-enricher>
<service-activator ref="fileWritingMessageHandler"
method="handleMessage" />
</chain>
<beans:bean id="fileWritingMessageHandler"
class="org.springframework.integration.file.FileWritingMessageHandler">
<beans:constructor-arg value="${conf.directory}" />
<beans:property name="fileNameGenerator">
<beans:bean
class="org.springframework.integration.file.DefaultFileNameGenerator">
<beans:property name="headerName" value="file_name" />
</beans:bean>
</beans:property>
<beans:property name="outputChannel" ref="nullChannel"/>
</beans:bean>
The exception:
Code:
(...)
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.ArrayList' to required type 'java.util.List' for property 'handlers'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.springframework.integration.endpoint.EventDrivenConsumer] to required type [org.springframework.integration.core.MessageHandler] for property 'handlers[1]': no matching editors or conversion strategy found
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:462)
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:1371)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1330)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
... 26 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [org.springframework.integration.endpoint.EventDrivenConsumer] to required type [org.springframework.integration.core.MessageHandler] for property 'handlers[1]': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
at org.springframework.beans.TypeConverterDelegate.convertToTypedCollection(TypeConverterDelegate.java:520)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:173)
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:447)
... 32 more
If you find it as a bug, I'll submit JIRA ticket.
Edit: the same is if I have int-event:outbound-channel-adapter as the last chain element (of course it's another chain and another transformer producing appropriate event).