You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2017/09/06 06:44:00 UTC

[jira] [Resolved] (CAMEL-11749) NoTypeConversionAvailableException in wiretap

     [ https://issues.apache.org/jira/browse/CAMEL-11749?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-11749.
---------------------------------
    Resolution: Not A Problem

You need to configure a name in the bean you use with Spring, eg @Component should be @Component(name = "xxx") or something to use name you call the bean with from the camel route.

The 2nd example is calling the bean directly which you have let Spring dependency inject into the route class.

> NoTypeConversionAvailableException in wiretap
> ---------------------------------------------
>
>                 Key: CAMEL-11749
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11749
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.19.2
>            Reporter: Keegan Witt
>            Assignee: Claus Ibsen
>
> # Clone https://github.com/apache/camel/tree/master/examples/camel-example-spring-boot
> # Add _CamelLogger.java_ with contents below to _src/main/java/org/apache/camel/examples_
> {code:title=CamelLogger.java}
> package org.apache.camel.examples;
> import org.apache.camel.Exchange;
> import org.apache.camel.Processor;
> import org.springframework.stereotype.Component;
> @Component
> public class CamelLogger implements Processor {
>     @Override
>     public void process(Exchange exchange) {
>         System.err.println(exchange.getIn().getBody());
>     }
> }
> {code}
> Changing _SampleCamelRouter_ to
> {code:java}
> @Component
> public class SampleCamelRouter extends RouteBuilder {
>     @Override
>     public void configure() throws Exception {
>         from("timer:hello?period={{timer.period}}")
>                 .transform(method("myBean", "saySomething"))
>                 .wireTap("bean:camelLogger")
>                 .to("stream:out");
>     }
> }
> {code}
> Fails with stacktrace
> {noformat}
> Stacktrace
> ---------------------------------------------------------------------------------------------------------------------------------------
> org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: null to the required type: java.lang.String with value null
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:206) ~[camel-core-2.20.0-20170905.112154-218.jar:2.20.0-SNAPSHOT]
> 	at org.apache.camel.processor.SendDynamicProcessor.resolveEndpoint(SendDynamicProcessor.java:144) ~[camel-core-2.20.0-20170905.112154-218.jar:2.20.0-SNAPSHOT]
> 	at org.apache.camel.processor.SendDynamicProcessor.process(SendDynamicProcessor.java:104) ~[camel-core-2.20.0-20170905.112154-218.jar:2.20.0-SNAPSHOT]
> 	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) ~[camel-core-2.20.0-20170905.112154-218.jar:2.20.0-SNAPSHOT]
> 	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [camel-core-2.20.0-20170905.112154-218.jar:2.20.0-SNAPSHOT]
> 	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97) [camel-core-2.20.0-20170905.112154-218.jar:2.20.0-SNAPSHOT]
> 	at org.apache.camel.processor.WireTapProcessor$1.call(WireTapProcessor.java:158) [camel-core-2.20.0-20170905.112154-218.jar:2.20.0-SNAPSHOT]
> 	at org.apache.camel.processor.WireTapProcessor$1.call(WireTapProcessor.java:153) [camel-core-2.20.0-20170905.112154-218.jar:2.20.0-SNAPSHOT]
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_144]
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_144]
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_144]
> 	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_144]
> {noformat}
> With Camel 2.15.5 or with _SampleCamelRouter_ of content below, exception doesn't occur.
> {code:java}
> @Component
> public class SampleCamelRouter extends RouteBuilder {
>     @Resource CamelLogger camelLogger;
>     @Override
>     public void configure() throws Exception {
>         from("timer:hello?period={{timer.period}}")
>                 .transform(method("myBean", "saySomething"))
>                 .wireTap("direct:logging")
>                 .to("stream:out");
>         from("direct:logging").process(camelLogger);
>     }
> }
> {code}
> I didn't see anything in release notes in 2.16, 2.17, 2.18, or 2.19 that would indicate there's a change in behavior from 2.15 in this regard.  Either this is a bug that should be fixed, or the change in behavior should be documented.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)