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

James Carman edited comment on CAMEL-6927 at 11/4/13 2:52 PM:
--------------------------------------------------------------

Event is your class, right?

According to the documentation here:

http://camel.apache.org/type-converter.html

The method signature should be:

public static <T> T convertTo(Class<T> type, Exchange exchange, Object value, 
TypeConverterRegistry registry);

So, using Event as the parameter type wasn't supposed to work (would have to 
dig to find out why it did), necessarily in the first place.  You'll probably 
need to do an instanceof or isAssignableFrom check on the parameter in order to 
implement your @FallbackConverter method.  Hope that helps.


was (Author: jwcarman):
Event is your class, right?

> 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)

Reply via email to