Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-11749

NoTypeConversionAvailableException in wiretap

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: 2.19.2
    • Fix Version/s: None
    • Component/s: camel-core
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      1. Clone https://github.com/apache/camel/tree/master/examples/camel-example-spring-boot
      2. Add CamelLogger.java with contents below to src/main/java/org/apache/camel/examples
      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());
          }
      }
      

      Changing SampleCamelRouter to

      @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");
          }
      }
      

      Fails with stacktrace

      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]
      

      With Camel 2.15.5 or with SampleCamelRouter of content below, exception doesn't occur.

      @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);
          }
      }
      

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                davsclaus Claus Ibsen
                Reporter:
                keegan Keegan Witt
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: