camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sree Panchajanyam D (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-6927) Bean Transformer throwing org.apache.camel.TypeConversionException: Error during type conversion from type: due argument type mismatch
Date Sat, 02 Nov 2013 16:37:28 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-6927?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13812060#comment-13812060
] 

Sree Panchajanyam D commented on CAMEL-6927:
--------------------------------------------

I nailed the issue! After carefully wrapping my head around the Camel Source I realized that
this issue is to do with the method signature of FallBackConverter I have coded :

public static <T> T extractPayload(Class<T> type, Exchange exchange, Event event,
TypeConverterRegistry registry)  ----> This worked only in 2.9.2 and failed on all above
versions

public static <T> T extractPayload(Class<T> type, Exchange exchange, Object obj,
TypeConverterRegistry registry)    ---------> This works for all the Camel versions.

The issue was at the reflection call StaticMethodFallbackTypeConverter.convertTo from version
2.9.3. There is a new abstract class that is introduced from 2.9.3 org.apache.camel.support.TypeConverterSupport.

Till 2.9.2 StaticMethodFallbackTypeConverter implements TypeConverter interface and from 2.9.3
StaticMethodFallbackTypeConverter extends TypeConverterSupport

Trying to figure out what exactly broke the contract.

> Bean Transformer throwing org.apache.camel.TypeConversionException: Error during type
conversion from type: due argument type mismatch
> --------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-6927
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6927
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.9.3, 2.9.4, 2.9.5, 2.10.0, 2.10.1, 2.10.2, 2.10.3, 2.10.4, 2.10.5,
2.10.6, 2.10.7, 2.11.2
>         Environment: Windows 7
>            Reporter: Sree Panchajanyam D
>            Assignee: James Carman
>            Priority: Blocker
>              Labels: features
>         Attachments: EventToPayloadExtracter.java, StackTrace.txt
>
>
> Same piece of camel.xml and POJO working in  camel 2.9.2.
> Issue encountered in camel 2.9.3 and all above versions.
> When trying to start apache camel embedded inside activemq (or camel starting as standalone
on Jetty container), I encountered the following exception : 
> Caused by: org.apache.camel.TypeConversionException: Error during type conversion from
type: com.messagetransformers.StringAppenderBean to the required type: org.apache.camel.Processor
with value com.messagetransformers.StringAppenderBean@77b407 due argument type mismatch
>        at org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:126)
>        at org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:98)
>        at org.apache.camel.util.CamelContextHelper.convertTo(CamelContextHelper.java:72)
> Extract from my camel.xml
> <bean id="beanTransformer" class="com.messagetransformers.StringAppenderBean"/>
>  <camelContext xmlns="http://camel.apache.org/schema/spring">
> 	<route id="beanTransformRoute" autoStartup="true">
>             <description>Transformer Route</description>
>             <from uri="activemqRoute1:MY.QUEUE.1"/>
> 			<bean ref="beanTransformer" method="process"/>
>             <to uri="activemqRoute1:MY.QUEUE.2"/>
>         </route>
> </camelContext>
> Code snippet from that is causing this issue org.apache.camel.impl.converter.BaseTypeConverterRegistry.java(doConvertTo
method) 
>  Object rc;
>             if (tryConvert) {
>                 rc = tc.tryConvertTo(type, exchange, value);
>             } else {
>                 rc = tc.convertTo(type, exchange, value);
>             }
> The else part is not there in Camel 2.9.2 and is introduced from Camel 2.9.3.
> This code seems to force a  normal bean to register as a FallbackTypeConverter which
is causing the issue.
> Removing the else condition from camel 2.10.3 solved the issue. 
> My question is, is it expected that normal bean definitions should fail from upwards
of camel 2.9.3? Documentation seems to say nothing about it.   Please help



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message