title: Jasper Report Error: The report has no Pages
body: <p>I am sure similar questions as the above have been asked but the provided answers seem not to address or solve my issues here. I have looked into <a href="https://stackoverflow.com/questions/15964552/the-document-has-no-pages-jasper-report">this</a> and followed <a href="https://www.youtube.com/watch?v=ydNRavmbzWU" rel="nofollow noreferrer">this tutorial on youtube</a> but all seems fine and yet my application is not working.</p>
  
  <p><strong>I created a report in <code>iReport-5.6.0</code> and it is working fine, I mean it is displaying the report as expected. Now the problem comes when I want to open this same report in Java code...it is saying</strong> "The document has no pages".</p>
  
  <p>From my reading I understand that this has to do with my data source or something related to that but I cannot fix it.</p>
  
  <p><strong>My Java Code</strong></p>
  
  <p>This code is one I am using to run my reports.</p>
  
  <pre><code>private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {                                           
      try {
          conn = con.getConnection();
          JasperReport jasperReport = JasperCompileManager.compileReport(getClass().getResourceAsStream("transrep1.jrxml"));
          JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null, conn);
          JasperViewer.viewReport(jasperPrint);
      } catch (JRException ex) {
          Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
      } finally {
          try {
              conn.close();
          } catch (SQLException ex) {
              Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
          }
      }
  } 
  </code></pre>
  
  <p><strong>My JRXML</strong></p>
  
  <pre><code>     &lt;?xml version="1.0" encoding="UTF-8"?&gt;
       &lt;jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="transrep" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="3b8454da-c73e-44b5-8419-6b700bb7a5cb"&gt;
      &lt;property name="ireport.zoom" value="1.0"/&gt;
      &lt;property name="ireport.x" value="0"/&gt;
      &lt;property name="ireport.y" value="0"/&gt;
      &lt;queryString language="SQL"&gt;
          &lt;![CDATA[select *
  from transactions
  Where cashier='jill']]&gt;
      &lt;/queryString&gt;
      &lt;field name="id" class="java.lang.Integer"&gt;
          &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
      &lt;/field&gt;
      &lt;field name="inv_number" class="java.lang.String"&gt;
          &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
      &lt;/field&gt;
      &lt;field name="barcode" class="java.lang.String"&gt;
          &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
      &lt;/field&gt;
      &lt;field name="sku" class="java.lang.String"&gt;
          &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
      &lt;/field&gt;
      &lt;field name="description" class="java.lang.String"&gt;
          &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
      &lt;/field&gt;
      &lt;field name="quantity" class="java.lang.Integer"&gt;
          &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
      &lt;/field&gt;
      &lt;field name="discount" class="java.lang.Double"&gt;
          &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
      &lt;/field&gt;
      &lt;field name="line_price" class="java.lang.Double"&gt;
          &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
      &lt;/field&gt;
      &lt;field name="date" class="java.lang.String"&gt;
          &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
      &lt;/field&gt;
      &lt;field name="cash" class="java.lang.Double"&gt;
          &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
      &lt;/field&gt;
      &lt;field name="card" class="java.lang.Double"&gt;
          &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
      &lt;/field&gt;
      &lt;field name="cheque" class="java.lang.Double"&gt;
          &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
      &lt;/field&gt;
      &lt;field name="other" class="java.lang.Double"&gt;
          &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
      &lt;/field&gt;
      &lt;field name="total_amount" class="java.lang.Double"&gt;
          &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
      &lt;/field&gt;
      &lt;field name="cashier" class="java.lang.String"&gt;
          &lt;fieldDescription&gt;&lt;![CDATA[]]&gt;&lt;/fieldDescription&gt;
      &lt;/field&gt;
      &lt;background&gt;
          &lt;band splitType="Stretch"/&gt;
      &lt;/background&gt;
      &lt;title&gt;
          &lt;band height="60" splitType="Stretch"&gt;
              &lt;staticText&gt;
                  &lt;reportElement x="0" y="0" width="555" height="55" uuid="42374cc0-37f3-45a4-9a48-018a149d5098"/&gt;
                  &lt;textElement textAlignment="Center"&gt;
                      &lt;font size="16" isBold="true"/&gt;
                  &lt;/textElement&gt;
                  &lt;text&gt;&lt;![CDATA[Transactions by Cashier]]&gt;&lt;/text&gt;
              &lt;/staticText&gt;
          &lt;/band&gt;
      &lt;/title&gt;
      &lt;columnHeader&gt;
          &lt;band height="23" splitType="Stretch"&gt;
              &lt;staticText&gt;
                  &lt;reportElement x="0" y="0" width="92" height="20" uuid="012eb72f-85e5-430a-91d9-fc498cff5b66"/&gt;
                  &lt;textElement textAlignment="Center"&gt;
                      &lt;font size="14" isBold="true" isUnderline="true"/&gt;
                  &lt;/textElement&gt;
                  &lt;text&gt;&lt;![CDATA[ID]]&gt;&lt;/text&gt;
              &lt;/staticText&gt;
              &lt;staticText&gt;
                  &lt;reportElement x="92" y="0" width="92" height="20" uuid="4736ffa3-2266-43e0-a3ad-7d292f049f26"/&gt;
                  &lt;textElement textAlignment="Center"&gt;
                      &lt;font size="14" isBold="true" isUnderline="true"/&gt;
                  &lt;/textElement&gt;
                  &lt;text&gt;&lt;![CDATA[Invoice #]]&gt;&lt;/text&gt;
              &lt;/staticText&gt;
              &lt;staticText&gt;
                  &lt;reportElement x="184" y="0" width="92" height="20" uuid="50dec793-43ff-49ee-91ed-469584c4c5b6"/&gt;
                  &lt;textElement textAlignment="Center"&gt;
                      &lt;font size="14" isBold="true" isUnderline="true"/&gt;
                  &lt;/textElement&gt;
                  &lt;text&gt;&lt;![CDATA[SKU]]&gt;&lt;/text&gt;
              &lt;/staticText&gt;
              &lt;staticText&gt;
                  &lt;reportElement x="276" y="0" width="92" height="20" uuid="73110a66-5b8a-4cbc-a5f1-a0bced23b51f"/&gt;
                  &lt;textElement textAlignment="Center"&gt;
                      &lt;font size="14" isBold="true" isUnderline="true"/&gt;
                  &lt;/textElement&gt;
                  &lt;text&gt;&lt;![CDATA[Quantity]]&gt;&lt;/text&gt;
              &lt;/staticText&gt;
              &lt;staticText&gt;
                  &lt;reportElement x="368" y="0" width="92" height="20" uuid="35565309-8ede-415c-83d1-e74f6248fdb5"/&gt;
                  &lt;textElement textAlignment="Center"&gt;
                      &lt;font size="14" isBold="true" isUnderline="true"/&gt;
                  &lt;/textElement&gt;
                  &lt;text&gt;&lt;![CDATA[Total Amount]]&gt;&lt;/text&gt;
              &lt;/staticText&gt;
              &lt;staticText&gt;
                  &lt;reportElement x="460" y="0" width="92" height="20" uuid="06e79d8b-1789-4586-b7bd-3cbbb8a325ef"/&gt;
                  &lt;textElement textAlignment="Center"&gt;
                      &lt;font size="14" isBold="true" isUnderline="true"/&gt;
                  &lt;/textElement&gt;
                  &lt;text&gt;&lt;![CDATA[Cashier]]&gt;&lt;/text&gt;
              &lt;/staticText&gt;
          &lt;/band&gt;
      &lt;/columnHeader&gt;
      &lt;detail&gt;
          &lt;band height="21" splitType="Stretch"&gt;
              &lt;textField&gt;
                  &lt;reportElement x="0" y="0" width="92" height="20" uuid="e2b6453b-900e-4790-8de4-f7145b483b50"/&gt;
                  &lt;textElement textAlignment="Center"/&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$F{id}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;textField&gt;
                  &lt;reportElement x="92" y="0" width="92" height="20" uuid="ad12a306-7ab3-4e38-b339-2c7607093955"/&gt;
                  &lt;textElement textAlignment="Center"/&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$F{inv_number}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;textField&gt;
                  &lt;reportElement x="184" y="0" width="92" height="20" uuid="fdf9efa8-5849-49d3-b91e-8f822e4675e1"/&gt;
                  &lt;textElement textAlignment="Center"/&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$F{sku}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;textField&gt;
                  &lt;reportElement x="276" y="0" width="92" height="20" uuid="0843372f-078c-4a93-9bbb-34fb4a1c42ad"/&gt;
                  &lt;textElement textAlignment="Center"/&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$F{quantity}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;textField&gt;
                  &lt;reportElement x="368" y="0" width="92" height="20" uuid="ddf7abde-9ea0-4c94-8b7e-aba789dec10e"/&gt;
                  &lt;textElement textAlignment="Center"/&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$F{total_amount}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;textField&gt;
                  &lt;reportElement x="460" y="0" width="92" height="20" uuid="d4aaedef-1880-40cd-b6f1-f4d5eaac587a"/&gt;
                  &lt;textElement textAlignment="Center"/&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$F{cashier}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
          &lt;/band&gt;
      &lt;/detail&gt;
      &lt;pageFooter&gt;
          &lt;band height="49" splitType="Stretch"&gt;
              &lt;textField&gt;
                  &lt;reportElement x="210" y="27" width="80" height="20" uuid="7cbceb70-1224-4afc-acfb-4a50a937320b"/&gt;
                  &lt;textElement textAlignment="Right"/&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;textField evaluationTime="Report"&gt;
                  &lt;reportElement x="334" y="27" width="40" height="20" uuid="07b25ad8-d771-41f3-81f3-8c57bd529025"/&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[" " + $V{PAGE_NUMBER}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
          &lt;/band&gt;
      &lt;/pageFooter&gt;
  &lt;/jasperReport&gt;
  </code></pre>
  
  <p><strong>So what have I done wrong?</strong></p>