Re: No suitable setter for property, dataformat.csv
Digged deeper and found that Camel is expecting a String[] initially but then it fails again. I get a different stackTrace 2021-09-20 13:47:54,708 WARN [org.apa.cam.com.sed.SedaConsumer] (Camel (camel-3) thread #27 - seda://textImporter) Error processing exchange. Exchange[FF9E23AAB732300-0001]. Caused by: [org.apache.camel.ResolveEndpointFailedException - Failed to resolve endpoint: dataformat://csv:marshal?header=%5BLjava.lang.String%3B%401f4adc4e due to: Error binding property (header=[Ljava.lang.String;@1f4adc4e) with name: header on bean: org.apache.camel.dataformat.csv.CsvDataFormat@5eed94ae with value: [Ljava.lang.String;@1f4adc4e]: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: dataformat://csv:marshal?header=%5BLjava.lang.String%3B%401f4adc4e due to: Error binding property (header=[Ljava.lang.String;@1f4adc4e) with name: header on bean: org.apache.camel.dataformat.csv.CsvDataFormat@5eed94ae with value: [Ljava.lang.String;@1f4adc4e at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:962) at org.apache.camel.impl.engine.AbstractCamelContext.getEndpoint(AbstractCamelContext.java:853) at org.apache.camel.support.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:73) at org.apache.camel.support.ExchangeHelper.resolveEndpoint(ExchangeHelper.java:120) at org.apache.camel.support.ExchangeHelper.resolveEndpoint(ExchangeHelper.java:99) at org.apache.camel.processor.SendDynamicProcessor.resolveEndpoint(SendDynamicProcessor.java:296) at org.apache.camel.processor.SendDynamicProcessor.process(SendDynamicProcessor.java:157) at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.doRun(RedeliveryErrorHandler.java:804) at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.run(RedeliveryErrorHandler.java:712) at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:179) at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:64) at org.apache.camel.processor.Pipeline.process(Pipeline.java:184) at org.apache.camel.impl.engine.CamelInternalProcessor.process(CamelInternalProcessor.java:398) at org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:269) at org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:187) at org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:130) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) at java.base/java.lang.Thread.run(Thread.java:832) Caused by: org.apache.camel.PropertyBindingException: Error binding property (header=[Ljava.lang.String;@1f4adc4e) with name: header on bean: org.apache.camel.dataformat.csv.CsvDataFormat@5eed94ae with value: [Ljava.lang.String;@1f4adc4e at org.apache.camel.support.PropertyBindingSupport.setSimplePropertyViaReflection(PropertyBindingSupport.java:720) at org.apache.camel.support.PropertyBindingSupport.doSetPropertyValue(PropertyBindingSupport.java:463) at org.apache.camel.support.PropertyBindingSupport.doBuildPropertyOgnlPath(PropertyBindingSupport.java:321) at org.apache.camel.support.PropertyBindingSupport.doBindProperties(PropertyBindingSupport.java:210) at org.apache.camel.support.PropertyBindingSupport.access$100(PropertyBindingSupport.java:88) at org.apache.camel.support.PropertyBindingSupport$Builder.bind(PropertyBindingSupport.java:1812) at org.apache.camel.support.PropertyBindingSupport.bindProperties(PropertyBindingSupport.java:116) at org.apache.camel.component.dataformat.DataFormatComponent.createEndpoint(DataFormatComponent.java:55) at org.apache.camel.support.DefaultComponent.createEndpoint(DefaultComponent.java:171) at org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:928) ... 18 more Caused by: java.lang.IllegalArgumentException: Could not find a suitable setter for property: header as there isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: java.lang.String to the required type: java.lang.String[] with value [Ljava.lang.String;@1f4adc4e at org.apache.camel.support.IntrospectionSupport.setProperty(IntrospectionSupport.java:845) at org.apache.camel.impl.engine.DefaultBeanIntrospection.setProperty(DefaultBeanIntrospection.java:199) at org.apache.camel.support.PropertyBindingSupport.doSetSimplePropertyViaReflection(PropertyBindingSupport.java:829) at
Re: No suitable setter for property, dataformat.csv
Hi We can improve this so I created a ticket https://issues.apache.org/jira/browse/CAMEL-16987 On Mon, Sep 20, 2021 at 12:49 PM Claus Ibsen wrote: > > Hi > > Ah yeah converting to array is a bit shady as checking for the type of > what they arrays holds is needed. > > But ideally it should use the ArrayTypeConverter as fallback in this > case. Can you try a plain unit test / standalone with spring boot or > quarkus. > > On Mon, Sep 20, 2021 at 11:11 AM Mikael Andersson Wigander > wrote: > > > > Hi > > > > Thanks but it doesn't work. > > > > Same issue: > > > > Caused by: java.lang.IllegalArgumentException: Could not find a suitable > > setter for property: header as there isn't a setter method with same type: > > java.lang.String nor type conversion possible: No type converter available > > to convert from type: java.lang.String to the required type: > > java.lang.String[] with value > > status,trade_date,sec_settle_date,fund_name,client_account,trade_reference,uti,broker_id,security_code,isin,fee,quantity,currency,market_price,loan_value,trade_time,trade_venue > > > > > > /M > > > > ‐‐‐ Original Message ‐‐‐ > > > > On Monday, September 20th, 2021 at 06:38, Claus Ibsen > > wrote: > > > > > Hi > > > > > > > in.setHeader("ColumnNames", new ArrayList<>(headers)); > > > > > > Store that header as a single string with comma separated values, > > > > > > On Sun, Sep 19, 2021 at 5:37 PM Mikael Andersson Wigander > > > > > > mikael.andersson.wigan...@pm.me.invalid wrote: > > > > > > > HI > > > > > > > > I'm converting a route from Camel 2.25.0 Spring Boot to latest Quarkus. > > > > > > > > The route parses a CSV file, splits it and use either headers if exist > > > > or creates headers if not, sends it to a bean for further processing > > > > ending up as amessage in a JMS. > > > > > > > > This was working fine but now when I run it in Quarkus I receive the > > > > following Exception: > > > > > > > > Caused by: java.lang.IllegalArgumentException: Could not find a > > > > suitable setter for property: header as there isn't a setter method > > > > with same type: java.lang.String nor type conversion possible: No type > > > > converter available to convert from type: java.lang.String to the > > > > required type: java.lang.String[] with value [status, trade_date, > > > > sec_settle_date, fund_name, client_account, trade_reference, uti, > > > > broker_id, security_code, isin, fee, quantity, currency, market_price, > > > > loan_value, trade_time, trade_venue] > > > > > > > > Route: > > > > > > > > from(seda("textImporter")) > > > > > > > > .description("DATA-IMPORTER-TEXT", > > > > > > > > "Imports data from text files such as .txt, .csv, .tab", > > > > > > > > "en") > > > > > > > > .toD("dataformat:csv:unmarshal?delimiter=${header.FileSplitter}=${header.UseHeader}") > > > > > > > > .split() > > > > > > > > .body() > > > > > > > > .streaming() > > > > > > > > .parallelProcessing(false) > > > > > > > > .process(exchange -> { > > > > > > > > final Message in = exchange.getIn(); > > > > > > > > final Map body = new LinkedHashMap<>(); > > > > > > > > if (!in.getHeader("UseHeader", Boolean.class)) { > > > > > > > > final List list = in.getBody(List.class); > > > > > > > > IntStream.range(0, list.size()) > > > > > > > > .forEach(i -> body.put(i + "", list.get(i))); > > > > > > > > } else { > > > > > > > > body.putAll(in.getBody(Map.class)); > > > > > > > > } > > > > > > > > final Set headers = body.keySet(); > > > > > > > > in.setHeader("ColumnNames", new ArrayList<>(headers)); > > > > > > > > final String idPath = in.getHeader("IdPath", String.class); > > > > > > > > in.setHeader("InternalReference", body.get(idPath)); > > > > > > > > final List> newList = new ArrayList<>(Set.of(body)); > > > > > > > > in.setBody(newList, List.class); > > > > > > > > }) > > > > > > > > .toD("dataformat:csv:marshal?header=${header.ColumnNames}") > > > > > > > > .convertBodyTo(String.class) > > > > > > > > .log(LoggingLevel.DEBUG, "${body}") > > > > > > > > .bean(XSDMapping.class, "create") > > > > > > > > .marshal(jaxbDataFormat) > > > > > > > > .convertBodyTo(String.class) > > > > > > > > .to("{{jms.queue.outgoing}}") > > > > > > > > .to(log("FILE-IMPORTER-TEXT").level("DEBUG") > > > > > > > > .groupInterval(5000L) > > > > > > > > .groupActiveOnly(true)) > > > > > > > > .choice() > > > > > > > > .when(simple("${header.CamelSplitComplete} == true")) > > > > > > > > .log("Number of records split: ${header.CamelSplitSize}") > > > > > > > > .log("Importing complete: ${header.CamelFileName}") > > > > > > > > .endChoice() > > > > > > > > .end(); > > > > > > > > Using Quarkus 2.2.3.Final on Java 11, Camel 3.11.1 > > > > > > > > /M > > > > > > -- > > > > > > Claus Ibsen > > > --- > > > > > > http://davsclaus.com @davsclaus > > > > > > Camel in Action 2: https://www.manning.com/ibsen2 > > > > -- > Claus Ibsen > - > http://davsclaus.com @davsclaus > Camel in Action 2:
Re: No suitable setter for property, dataformat.csv
Hi Ah yeah converting to array is a bit shady as checking for the type of what they arrays holds is needed. But ideally it should use the ArrayTypeConverter as fallback in this case. Can you try a plain unit test / standalone with spring boot or quarkus. On Mon, Sep 20, 2021 at 11:11 AM Mikael Andersson Wigander wrote: > > Hi > > Thanks but it doesn't work. > > Same issue: > > Caused by: java.lang.IllegalArgumentException: Could not find a suitable > setter for property: header as there isn't a setter method with same type: > java.lang.String nor type conversion possible: No type converter available to > convert from type: java.lang.String to the required type: java.lang.String[] > with value > status,trade_date,sec_settle_date,fund_name,client_account,trade_reference,uti,broker_id,security_code,isin,fee,quantity,currency,market_price,loan_value,trade_time,trade_venue > > > /M > > ‐‐‐ Original Message ‐‐‐ > > On Monday, September 20th, 2021 at 06:38, Claus Ibsen > wrote: > > > Hi > > > > > in.setHeader("ColumnNames", new ArrayList<>(headers)); > > > > Store that header as a single string with comma separated values, > > > > On Sun, Sep 19, 2021 at 5:37 PM Mikael Andersson Wigander > > > > mikael.andersson.wigan...@pm.me.invalid wrote: > > > > > HI > > > > > > I'm converting a route from Camel 2.25.0 Spring Boot to latest Quarkus. > > > > > > The route parses a CSV file, splits it and use either headers if exist or > > > creates headers if not, sends it to a bean for further processing ending > > > up as amessage in a JMS. > > > > > > This was working fine but now when I run it in Quarkus I receive the > > > following Exception: > > > > > > Caused by: java.lang.IllegalArgumentException: Could not find a suitable > > > setter for property: header as there isn't a setter method with same > > > type: java.lang.String nor type conversion possible: No type converter > > > available to convert from type: java.lang.String to the required type: > > > java.lang.String[] with value [status, trade_date, sec_settle_date, > > > fund_name, client_account, trade_reference, uti, broker_id, > > > security_code, isin, fee, quantity, currency, market_price, loan_value, > > > trade_time, trade_venue] > > > > > > Route: > > > > > > from(seda("textImporter")) > > > > > > .description("DATA-IMPORTER-TEXT", > > > > > > "Imports data from text files such as .txt, .csv, .tab", > > > > > > "en") > > > > > > .toD("dataformat:csv:unmarshal?delimiter=${header.FileSplitter}=${header.UseHeader}") > > > > > > .split() > > > > > > .body() > > > > > > .streaming() > > > > > > .parallelProcessing(false) > > > > > > .process(exchange -> { > > > > > > final Message in = exchange.getIn(); > > > > > > final Map body = new LinkedHashMap<>(); > > > > > > if (!in.getHeader("UseHeader", Boolean.class)) { > > > > > > final List list = in.getBody(List.class); > > > > > > IntStream.range(0, list.size()) > > > > > > .forEach(i -> body.put(i + "", list.get(i))); > > > > > > } else { > > > > > > body.putAll(in.getBody(Map.class)); > > > > > > } > > > > > > final Set headers = body.keySet(); > > > > > > in.setHeader("ColumnNames", new ArrayList<>(headers)); > > > > > > final String idPath = in.getHeader("IdPath", String.class); > > > > > > in.setHeader("InternalReference", body.get(idPath)); > > > > > > final List> newList = new ArrayList<>(Set.of(body)); > > > > > > in.setBody(newList, List.class); > > > > > > }) > > > > > > .toD("dataformat:csv:marshal?header=${header.ColumnNames}") > > > > > > .convertBodyTo(String.class) > > > > > > .log(LoggingLevel.DEBUG, "${body}") > > > > > > .bean(XSDMapping.class, "create") > > > > > > .marshal(jaxbDataFormat) > > > > > > .convertBodyTo(String.class) > > > > > > .to("{{jms.queue.outgoing}}") > > > > > > .to(log("FILE-IMPORTER-TEXT").level("DEBUG") > > > > > > .groupInterval(5000L) > > > > > > .groupActiveOnly(true)) > > > > > > .choice() > > > > > > .when(simple("${header.CamelSplitComplete} == true")) > > > > > > .log("Number of records split: ${header.CamelSplitSize}") > > > > > > .log("Importing complete: ${header.CamelFileName}") > > > > > > .endChoice() > > > > > > .end(); > > > > > > Using Quarkus 2.2.3.Final on Java 11, Camel 3.11.1 > > > > > > /M > > > > -- > > > > Claus Ibsen > > --- > > > > http://davsclaus.com @davsclaus > > > > Camel in Action 2: https://www.manning.com/ibsen2 -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
Re: No suitable setter for property, dataformat.csv
Hi Thanks but it doesn't work. Same issue: Caused by: java.lang.IllegalArgumentException: Could not find a suitable setter for property: header as there isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: java.lang.String to the required type: java.lang.String[] with value status,trade_date,sec_settle_date,fund_name,client_account,trade_reference,uti,broker_id,security_code,isin,fee,quantity,currency,market_price,loan_value,trade_time,trade_venue /M ‐‐‐ Original Message ‐‐‐ On Monday, September 20th, 2021 at 06:38, Claus Ibsen wrote: > Hi > > > in.setHeader("ColumnNames", new ArrayList<>(headers)); > > Store that header as a single string with comma separated values, > > On Sun, Sep 19, 2021 at 5:37 PM Mikael Andersson Wigander > > mikael.andersson.wigan...@pm.me.invalid wrote: > > > HI > > > > I'm converting a route from Camel 2.25.0 Spring Boot to latest Quarkus. > > > > The route parses a CSV file, splits it and use either headers if exist or > > creates headers if not, sends it to a bean for further processing ending up > > as amessage in a JMS. > > > > This was working fine but now when I run it in Quarkus I receive the > > following Exception: > > > > Caused by: java.lang.IllegalArgumentException: Could not find a suitable > > setter for property: header as there isn't a setter method with same type: > > java.lang.String nor type conversion possible: No type converter available > > to convert from type: java.lang.String to the required type: > > java.lang.String[] with value [status, trade_date, sec_settle_date, > > fund_name, client_account, trade_reference, uti, broker_id, security_code, > > isin, fee, quantity, currency, market_price, loan_value, trade_time, > > trade_venue] > > > > Route: > > > > from(seda("textImporter")) > > > > .description("DATA-IMPORTER-TEXT", > > > > "Imports data from text files such as .txt, .csv, .tab", > > > > "en") > > > > .toD("dataformat:csv:unmarshal?delimiter=${header.FileSplitter}=${header.UseHeader}") > > > > .split() > > > > .body() > > > > .streaming() > > > > .parallelProcessing(false) > > > > .process(exchange -> { > > > > final Message in = exchange.getIn(); > > > > final Map body = new LinkedHashMap<>(); > > > > if (!in.getHeader("UseHeader", Boolean.class)) { > > > > final List list = in.getBody(List.class); > > > > IntStream.range(0, list.size()) > > > > .forEach(i -> body.put(i + "", list.get(i))); > > > > } else { > > > > body.putAll(in.getBody(Map.class)); > > > > } > > > > final Set headers = body.keySet(); > > > > in.setHeader("ColumnNames", new ArrayList<>(headers)); > > > > final String idPath = in.getHeader("IdPath", String.class); > > > > in.setHeader("InternalReference", body.get(idPath)); > > > > final List> newList = new ArrayList<>(Set.of(body)); > > > > in.setBody(newList, List.class); > > > > }) > > > > .toD("dataformat:csv:marshal?header=${header.ColumnNames}") > > > > .convertBodyTo(String.class) > > > > .log(LoggingLevel.DEBUG, "${body}") > > > > .bean(XSDMapping.class, "create") > > > > .marshal(jaxbDataFormat) > > > > .convertBodyTo(String.class) > > > > .to("{{jms.queue.outgoing}}") > > > > .to(log("FILE-IMPORTER-TEXT").level("DEBUG") > > > > .groupInterval(5000L) > > > > .groupActiveOnly(true)) > > > > .choice() > > > > .when(simple("${header.CamelSplitComplete} == true")) > > > > .log("Number of records split: ${header.CamelSplitSize}") > > > > .log("Importing complete: ${header.CamelFileName}") > > > > .endChoice() > > > > .end(); > > > > Using Quarkus 2.2.3.Final on Java 11, Camel 3.11.1 > > > > /M > > -- > > Claus Ibsen > --- > > http://davsclaus.com @davsclaus > > Camel in Action 2: https://www.manning.com/ibsen2
Re: No suitable setter for property, dataformat.csv
Hi > in.setHeader("ColumnNames", new ArrayList<>(headers)); Store that header as a single string with comma separated values, On Sun, Sep 19, 2021 at 5:37 PM Mikael Andersson Wigander wrote: > > HI > > I'm converting a route from Camel 2.25.0 Spring Boot to latest Quarkus. > The route parses a CSV file, splits it and use either headers if exist or > creates headers if not, sends it to a bean for further processing ending up > as amessage in a JMS. > > This was working fine but now when I run it in Quarkus I receive the > following Exception: > > Caused by: java.lang.IllegalArgumentException: Could not find a suitable > setter for property: header as there isn't a setter method with same type: > java.lang.String nor type conversion possible: No type converter available to > convert from type: java.lang.String to the required type: java.lang.String[] > with value [status, trade_date, sec_settle_date, fund_name, client_account, > trade_reference, uti, broker_id, security_code, isin, fee, quantity, > currency, market_price, loan_value, trade_time, trade_venue] > > Route: > > from(seda("textImporter")) > > .description("DATA-IMPORTER-TEXT", > > "Imports data from text files such as .txt, .csv, .tab", > > "en") > > .toD("dataformat:csv:unmarshal?delimiter=${header.FileSplitter}=${header.UseHeader}") > > .split() > > .body() > > .streaming() > > .parallelProcessing(false) > > .process(exchange -> { > > final Message in = exchange.getIn(); > > final Map body = new LinkedHashMap<>(); > > if (!in.getHeader("UseHeader", Boolean.class)) { > > final List list = in.getBody(List.class); > > IntStream.range(0, list.size()) > > .forEach(i -> body.put(i + "", list.get(i))); > > } else { > > body.putAll(in.getBody(Map.class)); > > } > > final Set headers = body.keySet(); > > in.setHeader("ColumnNames", new ArrayList<>(headers)); > > final String idPath = in.getHeader("IdPath", String.class); > > in.setHeader("InternalReference", body.get(idPath)); > > final List> newList = new ArrayList<>(Set.of(body)); > > in.setBody(newList, List.class); > > }) > > .toD("dataformat:csv:marshal?header=${header.ColumnNames}") > > .convertBodyTo(String.class) > > .log(LoggingLevel.DEBUG, "${body}") > > .bean(XSDMapping.class, "create") > > .marshal(jaxbDataFormat) > > .convertBodyTo(String.class) > > .to("{{jms.queue.outgoing}}") > > .to(log("FILE-IMPORTER-TEXT").level("DEBUG") > > .groupInterval(5000L) > > .groupActiveOnly(true)) > > .choice() > > .when(simple("${header.CamelSplitComplete} == true")) > > .log("Number of records split: ${header.CamelSplitSize}") > > .log("Importing complete: ${header.CamelFileName}") > > .endChoice() > > .end(); > > Using Quarkus 2.2.3.Final on Java 11, Camel 3.11.1 > > /M -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
No suitable setter for property, dataformat.csv
HI I'm converting a route from Camel 2.25.0 Spring Boot to latest Quarkus. The route parses a CSV file, splits it and use either headers if exist or creates headers if not, sends it to a bean for further processing ending up as amessage in a JMS. This was working fine but now when I run it in Quarkus I receive the following Exception: Caused by: java.lang.IllegalArgumentException: Could not find a suitable setter for property: header as there isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: java.lang.String to the required type: java.lang.String[] with value [status, trade_date, sec_settle_date, fund_name, client_account, trade_reference, uti, broker_id, security_code, isin, fee, quantity, currency, market_price, loan_value, trade_time, trade_venue] Route: from(seda("textImporter")) .description("DATA-IMPORTER-TEXT", "Imports data from text files such as .txt, .csv, .tab", "en") .toD("dataformat:csv:unmarshal?delimiter=${header.FileSplitter}=${header.UseHeader}") .split() .body() .streaming() .parallelProcessing(false) .process(exchange -> { final Message in = exchange.getIn(); final Map body = new LinkedHashMap<>(); if (!in.getHeader("UseHeader", Boolean.class)) { final List list = in.getBody(List.class); IntStream.range(0, list.size()) .forEach(i -> body.put(i + "", list.get(i))); } else { body.putAll(in.getBody(Map.class)); } final Set headers = body.keySet(); in.setHeader("ColumnNames", new ArrayList<>(headers)); final String idPath = in.getHeader("IdPath", String.class); in.setHeader("InternalReference", body.get(idPath)); final List> newList = new ArrayList<>(Set.of(body)); in.setBody(newList, List.class); }) .toD("dataformat:csv:marshal?header=${header.ColumnNames}") .convertBodyTo(String.class) .log(LoggingLevel.DEBUG, "${body}") .bean(XSDMapping.class, "create") .marshal(jaxbDataFormat) .convertBodyTo(String.class) .to("{{jms.queue.outgoing}}") .to(log("FILE-IMPORTER-TEXT").level("DEBUG") .groupInterval(5000L) .groupActiveOnly(true)) .choice() .when(simple("${header.CamelSplitComplete} == true")) .log("Number of records split: ${header.CamelSplitSize}") .log("Importing complete: ${header.CamelFileName}") .endChoice() .end(); Using Quarkus 2.2.3.Final on Java 11, Camel 3.11.1 /M