Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3110
  • Last Modified:

Jasper Report Problem

Hi all  Java Guru,
      i m using java 1.5 and following libs for creating jasper reports for my project.
mysql-connector-java-3.1.11.bin.jar
commons-beanutils-1.5.jar
commons-collections-2.1.jar
commons-digester-1.7.jar
commons-javaflow-20060411.jar
commons-logging-1.0.2.jar
itext-1.3.1.jar
jasperreports-1.2.2.jar
jdt-compiler.jar
xml-apis.jar
      column(field) has an alias name ,I m getting error when while filling report :

      net.sf.jasperreports.engine.JRException: Unknown column name : ContactDesignation
      at net.sf.jasperreports.engine.JRResultSetDataSource.getColumnIndex(JRResultSetDataSource.java:357)
      at net.sf.jasperreports.engine.JRResultSetDataSource.getFieldValue(JRResultSetDataSource.java:113)
      at net.sf.jasperreports.engine.fill.JRFillDataset.next(JRFillDataset.java:727)
      at net.sf.jasperreports.engine.fill.JRBaseFiller.next(JRBaseFiller.java:983)
      at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:126)
      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:750)
      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:647)
      at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:63)
      at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)

mine code as follows :
      try
      {
      long start = System.currentTimeMillis();
      JasperDesign jasperDesign = JRXmlLoader.load(fileName);
      System.out.println("JasperDesign Name -- "+jasperDesign.getName());
      JasperCompileManager.compileReportToFile(fileName);
      JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
      System.err.println("Compiled Name -- "+jasperReport.getName());
      System.err.println("Compile time : " + (System.currentTimeMillis() - start));
      JasperPrint jasperPrint =JasperFillManager.fillReport(jasperReport, parameters, getConnection());
      System.err.println(jasperPrint.toString());
      System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}

any one have idea abt this issue, plz help me. thx in advance.
Regards.
0
Econify
Asked:
Econify
1 Solution
 
bunin76Commented:
From the exception I understand that there is some field in the report that points to field "ContactDesignation" from the DB, which is unregistered in the report, or missing from DB.

Try using GUI tools for jasperreports. I worked with  http://ireport.sourceforge.net
There are convenient options to design the reports.

Hope this helps.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now