Olá, estava seguindo a aula porém ao colocar o split, comecei a receber o seguinte erro:
org.apache.camel.TypeConversionException: Error during type conversion from type: java.lang.String to the required type: java.io.InputStream with value [item: null] due java.lang.NoClassDefFoundError: org/apache/xml/serializer/TreeWalker
Meu código:
package br.com.caelum.camel;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
public class RotaPedidos {
public static void main(String[] args) throws Exception {
CamelContext context = new DefaultCamelContext();
context.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("file:pedidos?delay=5s&noop=true").
split().
xpath("/pedido/itens/item").
log("${body}").
filter().
xpath("/item/formato[text()='EBOOK']").
marshal().xmljson().
log("${body}").
setHeader("CamelFileName", simple("${file:name.noext}.json")).
to("file:saida");
}
});
context.start();
Thread.sleep(5000);
context.stop();
}
}