title: Jasper Report Error retrieving field value from bean when generating Report with JSON file
body: <p>I reconnect with you. Since the last few times you have helped me and I have been with this problem for some time now and to solve it, my job depends because I am in practice and I have to solve it.</p>
  
  <p>Mi JSON:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>[
    {
      "fecha": "03/07/2018 08:16:58",
      "velocidad_up": "30",
      "velocidad_dw": "30",
      "ppoe_usuario": "48575443596ACB9B",
      "ppoe_password": "48575443596ACB9B",
      "c": "0"
    },
    {
      "fecha": "03/07/2018 08:23:13",
      "velocidad_up": "30",
      "velocidad_dw": "30",
      "ppoe_usuario": "4857544321F99C9B",
      "ppoe_password": "4857544321F99C9B",
      "c": "0"
    },
    {
      "fecha": "04/07/2018 18:58:02",
      "velocidad_up": "5",
      "velocidad_dw": "20",
      "ppoe_usuario": "48575443DC26FB9B",
      "ppoe_password": "48575443DC26FB9B",
      "c": "0"
    },
    {
      "fecha": "05/07/2018 08:33:00",
      "velocidad_up": "10",
      "velocidad_dw": "20",
      "ppoe_usuario": "48575443DC23E79B",
      "ppoe_password": "48575443DC23E79B",
      "c": "0"
    },
    {
      "fecha": "06/07/2018 18:50:29",
      "velocidad_up": "5",
      "velocidad_dw": "20",
      "ppoe_usuario": "48575443A351D79B",
      "ppoe_password": "48575443A351D79B",
      "c": "0"
    },
    {
      "fecha": "06/07/2018 18:53:13",
      "velocidad_up": "5",
      "velocidad_dw": "25",
      "ppoe_usuario": "48575443DC26A59B",
      "ppoe_password": "48575443DC26A59B",
      "c": "0"
    }
  ]</code></pre>
  </div>
  </div>
  </p>
  
  <p>The fact is that when trying to generate a report in JASPER REPORT with dynamic columns from a JSON file, when arriving at the line where Jasper print is generated, the following error appears:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>Exception in thread "main" net.sf.jasperreports.engine.JRException: Error retrieving field value from bean: fecha.
   at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getBeanProperty(JRAbstractBeanDataSource.java:193)
   at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getFieldValue(JRAbstractBeanDataSource.java:158)
   at net.sf.jasperreports.engine.data.JRBeanCollectionDataSource.getFieldValue(JRBeanCollectionDataSource.java:104)
   at net.sf.jasperreports.engine.fill.JRFillDataset.setOldValues(JRFillDataset.java:1489)
   at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:1390)</code></pre>
  </div>
  </div>
  </p>
  
  <p>This error occurs on the line:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>jasperPrint = JasperFillManager.fillReport(jasperReport, parametros, dataSource);</code></pre>
  </div>
  </div>
  </p>
  
  <p>But in reality it is seen that NETBEANS gives a warning on the lines:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>public static JRDataSource getDatasource(List&lt;AbstractColumn&gt; columns) throws FileNotFoundException {
        
           Gson gson = new Gson();
           JsonElement json = gson.fromJson(new FileReader("C:/tools/2datos-prue.json"), JsonElement.class);
           datosJson = gson.fromJson(json, new TypeToken&lt;List&lt;JsonElement&gt;&gt;(){}.getType());
            List data = new ArrayList();
           data.addAll(datosJson);
           List data3 = new ArrayList();
          data3 =  SortUtils.sortCollection(data, columns);
                       
         return new JRBeanCollectionDataSource(data3, false); </code></pre>
  </div>
  </div>
  </p>
  
  <p>Specifically on the line:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>data3 =  SortUtils.sortCollection(data, columns);</code></pre>
  </div>
  </div>
  </p>
  
  <p>giving the following errors:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>ago 20, 2019 10:15:55 AM ar.com.fdvs.dj.util.MultiPropertyComparator compare
  ADVERTENCIA: java.lang.NoSuchMethodException: Unknown property 'fecha'
  ago 20, 2019 10:15:55 AM ar.com.fdvs.dj.util.MultiPropertyComparator compare
  ADVERTENCIA: java.lang.NoSuchMethodException: Unknown property 'velocidad_up'
  ago 20, 2019 10:15:55 AM ar.com.fdvs.dj.util.MultiPropertyComparator compare
  ADVERTENCIA: java.lang.NoSuchMethodException: Unknown property 'velocidad_dw'
  ago 20, 2019 10:15:55 AM ar.com.fdvs.dj.util.MultiPropertyComparator compare
  ADVERTENCIA: java.lang.NoSuchMethodException: Unknown property 'ppoe_usuario'
  ago 20, 2019 10:15:55 AM ar.com.fdvs.dj.util.MultiPropertyComparator compare
  ADVERTENCIA: java.lang.NoSuchMethodException: Unknown property 'ppoe_password'
  ago 20, 2019 10:15:55 AM ar.com.fdvs.dj.util.MultiPropertyComparator compare
  ADVERTENCIA: java.lang.NoSuchMethodException: Unknown property 'c'
  ago 20, 2019 10:15:55 AM ar.com.fdvs.dj.util.MultiPropertyComparator compare
  ADVERTENCIA: java.lang.NoSuchMethodException: Unknown property 'fecha'
  ago 20, 2019 10:15:55 AM ar.com.fdvs.dj.util.MultiPropertyComparator compare
  ADVERTENCIA: java.lang.NoSuchMethodException: Unknown property 'velocidad_up'
  ago 20, 2019 10:15:55 AM ar.com.fdvs.dj.util.MultiPropertyComparator compare ....</code></pre>
  </div>
  </div>
  </p>
  
  <p>The error is repeated for each of the columns where the data is.</p>
  
  <p>I am very overwhelmed by this problem ... I would like to help me .....</p>
  
  <p>Thanks anyway to everyone, I hope your ideas hopefully find the solution...</p>
  
  <p>The solution already works is that I read my JSON, like JRBeanCollectionDataSource and I must read it as DataSource pass it to jasper .....</p>