Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-12105

[camel-salesforce-quickstart] Camel salesforce quickstart is not working on Karaf

    XMLWordPrintable

Details

    • Fuse 7.5 Sprint 54 - Interim

    Description

      Follow Readme.md file in https://github.com/jboss-fuse/karaf-quickstarts/tree/7.x.redhat-7-x/camel/camel-salesforce

      You will get following exception

      ldomain-1571920411249-1-77). Exhausted after delivery attempt: 1 caught: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `org.apache.camel.salesforce.dto.Cheese__c`, problem: `java.lang.NullPointerException`
       at [Source: (String)"{
      "Name": "Gruyere",
      "Country__c": "Switzerland",
      "Milk__c": "Cow",
      "Description__c": "Gruyere is named after a Swiss village. It is a traditional, creamy, unpasteurized, semi-soft cheese. The natural, rusty brown rind is hard, dry, and pitted with tiny holes. The cheese is darker yellow than Emmental but the texture is more dense and compact. Slightly grainy, the cheese has a wonderful complexity of flavors- at first fruity, later becomes more earthy and nutty. To make Gruyere, raw milk is heat"[truncated 522 chars]; line: 2, column: 1]
      
      Message History
      ---------------------------------------------------------------------------------------------------------------------------------------
      RouteId              ProcessorId          Processor                                                                        Elapsed (ms)
      [salesforce-route  ] [salesforce-route  ] [file://work/camel-salesforce/input                                            ] [         1]
      [salesforce-route  ] [log8              ] [log                                                                           ] [         0]
      [salesforce-route  ] [log9              ] [log                                                                           ] [         0]
      [salesforce-route  ] [bean3             ] [bean[org.jboss.fuse.quickstarts.salesforce.JsonHelper]                        ] [         1]
      
      Stacktrace
      ---------------------------------------------------------------------------------------------------------------------------------------
      com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `org.apache.camel.salesforce.dto.Cheese__c`, problem: `java.lang.NullPointerException`
       at [Source: (String)"{
      "Name": "Gruyere",
      "Country__c": "Switzerland",
      "Milk__c": "Cow",
      "Description__c": "Gruyere is named after a Swiss village. It is a traditional, creamy, unpasteurized, semi-soft cheese. The natural, rusty brown rind is hard, dry, and pitted with tiny holes. The cheese is darker yellow than Emmental but the texture is more dense and compact. Slightly grainy, the cheese has a wonderful complexity of flavors- at first fruity, later becomes more earthy and nutty. To make Gruyere, raw milk is heat"[truncated 522 chars]; line: 2, column: 1]
      	at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67) ~[!/:2.9.9]
      	at com.fasterxml.jackson.databind.DeserializationContext.instantiationException(DeserializationContext.java:1608) ~[!/:2.9.9]
      	at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.wrapAsJsonMappingException(StdValueInstantiator.java:484) ~[!/:2.9.9]
      	at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.rewrapCtorProblem(StdValueInstantiator.java:503) ~[!/:2.9.9]
      	at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createUsingDefault(StdValueInstantiator.java:272) ~[!/:2.9.9]
      	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:277) ~[!/:2.9.9]
      	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151) ~[!/:2.9.9]
      	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013) ~[!/:2.9.9]
      	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3004) ~[!/:2.9.9]
      	at org.jboss.fuse.quickstarts.salesforce.JsonHelper.readFile(JsonHelper.java:40) ~[!/:?]
      	at sun.reflect.GeneratedMethodAccessor51.invoke(Unknown Source) ~[?:?]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
      	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
      	at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:481) ~[!/:2.21.0.fuse-750032-redhat-00001]
      	at org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:300) ~[!/:2.21.0.fuse-750032-redhat-00001]
      	at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:273) ~[!/:2.21.0.fuse-750032-redhat-00001]
      	at org.apache.camel.component.bean.AbstractBeanProcessor.process(AbstractBeanProcessor.java:187) ~[!/:2.21.0.fuse-750032-redhat-00001]
      	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:53) ~[!/:2.21.0.fuse-750032-redhat-00001]
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) [!/:2.21.0.fuse-750032-redhat-00001]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [!/:2.21.0.fuse-750032-redhat-00001]
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:138) [!/:2.21.0.fuse-750032-redhat-00001]
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:101) [!/:2.21.0.fuse-750032-redhat-00001]
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [!/:2.21.0.fuse-750032-redhat-00001]
      	at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:452) [!/:2.21.0.fuse-750032-redhat-00001]
      	at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:219) [!/:2.21.0.fuse-750032-redhat-00001]
      	at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:183) [!/:2.21.0.fuse-750032-redhat-00001]
      	at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174) [!/:2.21.0.fuse-750032-redhat-00001]
      	at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101) [!/:2.21.0.fuse-750032-redhat-00001]
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_181]
      	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_181]
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_181]
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_181]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_181]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_181]
      	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
      Caused by: java.lang.NullPointerException
      	at org.apache.camel.salesforce.dto.Cheese__c.<init>(Cheese__c.java:41) ~[!/:?]
      	at sun.reflect.GeneratedConstructorAccessor99.newInstance(Unknown Source) ~[?:?]
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_181]
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_181]
      	at com.fasterxml.jackson.databind.introspect.AnnotatedConstructor.call(AnnotatedConstructor.java:119) ~[!/:2.9.9]
      	at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createUsingDefault(StdValueInstantiator.java:270) ~[!/:2.9.9]
      

      The problem is in generated sources. After running

      mvn -Pgenerate-pojos clean install
      

      I have genereted Cheese__c.java in ./target/generated-sources/camel-salesforce/org/apache/camel/salesforce/dto

      /*
       * Salesforce DTO generated by camel-salesforce-maven-plugin.
       */
      package org.apache.camel.salesforce.dto;
      
      /**
       * Salesforce DTO for SObject Cheese__c
       */
      @Generated("org.apache.camel.maven.CamelSalesforceMojo")
      @XStreamAlias("Cheese__c")
      public class Cheese__c extends AbstractDescribedSObjectBase {
      
          public Cheese__c() {
              getAttributes().setType("Cheese__c");
          }
      
          private static final SObjectDescription DESCRIPTION = createSObjectDescription();
      
          private String Country__c;
      
          @JsonProperty("Country__c")
          public String getCountry__c() {
              return this.Country__c;
          }
      
          @JsonProperty("Country__c")
          public void setCountry__c(String Country__c) {
              this.Country__c = Country__c;
          }
      
          private String Description__c;
      
          @JsonProperty("Description__c")
          public String getDescription__c() {
              return this.Description__c;
          }
      
          @JsonProperty("Description__c")
          public void setDescription__c(String Description__c) {
              this.Description__c = Description__c;
          }
      
          @XStreamConverter(MultiSelectPicklistConverter.class)
          private Cheese__c_MilkEnum[] Milk__c;
      
          @JsonProperty("Milk__c")
          @JsonSerialize(using = MultiSelectPicklistSerializer.class)
          public Cheese__c_MilkEnum[] getMilk__c() {
              return this.Milk__c;
          }
      
          @JsonProperty("Milk__c")
          @JsonDeserialize(using = MultiSelectPicklistDeserializer.class)
          public void setMilk__c(Cheese__c_MilkEnum[] Milk__c) {
              this.Milk__c = Milk__c;
          }
      
       
          @Override
          public final SObjectDescription description() {
              return DESCRIPTION;
          }
      
         .....
      }
      

      Please take a look at the constructor.

      public Cheese__c() {
              getAttributes().setType("Cheese__c");
          }
      

      Method getAttributes() returns null and setType("Ceese__c") causes NPE.

      Attachments

        Activity

          People

            acosenti Andrea Cosentino
            jbouska@redhat.com Jan Bouska
            Tomas Veskrna Tomas Veskrna
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: