Java Reporting With Jasper Reports - Part 2

Tags:
Welcome back to Java Reporting series. For those who didn't read the introductory article; have a look here before we get started. Today we're going to have a quick tour in JasperReport architecture, development lifecycle, report definition files, and finally we're going to set up our environment and start work in a sample application.



Architecture

As shown in the above figure JasperReports architecture is based on declarative XML files which by convention have an extension of jrxml that contains the report layout. A lot of third-party design tools were produced to generate your jrxml file in a smooth way (like iReport or JasperAssistant) Design file is supposed to be filled by report's result which is fetched from database, XML files, Java collection, Comma-separated values or Models. Jasper can communicate with those data-sources and more, it can merge any number of data-sources together and manipulates the results of any combinations. This communication goes through JDBC, JNDI, XQuery, EJBQL, Hibernate or existing Oracle PL/SQL. You also can define your own data-source class and pass it to jasper engine directly. After defining your report design layout in jrxml format and determining your data source(s) jasper engine does the rest of work. It compiles your design file and fills it with results fetched from data-source and generates your report to the chosen exporting format (PDF, Excel, HTML, XML, RTF, TXT …, etc.)

Report Definition file structure (jrxml):

Jasper design file –jrxml- contains the following elements:
  • <jasperReport>: the root element.
  • <title>: its contents are printed only once at the beginning of the report
  • <pageHeader> - its contents are printed at the beginning of every page in the report.
  • <detail> - contains the body of the report, repeated by n number of results
  • <pageFooter> - its contents are printed at the bottom of every page in the report.
  • <band> - defines a report section, all of the above elements contain a band element as its only child element.

Only the root element is mandatory, the rest of elements are optional.

 

Environment

To set up working environment we need to download JasperReport jar file from the following URL: http://sourceforge.net/project/showfiles.php?group_id=36382&package_id=28579
And add the following jars to your project classpath:
  • jasperreports-2.0.4.jar
  • commons-digester-1.7.jar
  • commons-collections-2.1.jar (commons-collections.jar)
  • commons-logging-1.0.2.jar
  • commons-beanutils.jar
  • iText-2.0.7.jar (used infor PDF exporting)

Sample application

At this section we'll introduce a sample application that generates PDF, HTML and Excel files contain the results of our report which is built over Oracle database contains the following table:
ITEM

ITEM_ID ---- NUMBER(5) --- NOT NULL
CATEOGRY_ID ---- NUMBER(5) --- NOT NULL
ITEM_NAME ---- VARCHAR2(50) --- NOT NULL
ITEM_DESCIPTION ---- VARCHAR2(200)

ITEM_AMOUNT ---- NUMBER(5) ---- NOT NULL

Result: Report should retrieve the items with amount less than or equal 100 item.

We're going to divide the work into two steps:

  1. Generate the report design (jrxml file).
  2. Implement application that assigns data source, compiles jrxml file and exports result in the chosen format.


Designing The Report

First we create new text file and rename it to sample_report.jrxml, this file should contain the following XML tags.

<!DOCTYPE jasperReport PUBLIC
"//JasperReports//DTD Report Design//EN"
"http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">

<jasperReport name="sample_report" >
<queryString>
<![CDATA[select item_name,item_amount from item
where item_amount <=100]]>
</queryString>
<field name="ITEM_NAME" class="java.lang.String"/>
<field name="ITEM_AMOUNT" class="java.math.BigDecimal"/>
<columnHeader>
<band height="28" isSplitAllowed="true">
<staticText>
<reportElement x="40" y="11" width="193" height="15" key="staticText-1"/>
<text>
<![CDATA[Item Name]]>
</text>
</staticText>
<staticText>
<reportElement x="330" y="11" width="193" height="15" key="staticText-2"/>
<text>
<![CDATA[Item Amount]]>
</text>
</staticText>
</band>
</columnHeader>

<detail>
<band height="27" isSplitAllowed="true">
<textField>
<reportElement x="47" y="6" width="173"
height="18" key="textField"/>
<textFieldExpression class="java.lang.String">
<![CDATA[$F{ITEM_NAME}]]>
</textFieldExpression>
</textField>
<textField >
<reportElement x="330" y="6" width="100"
height="18" key="textField"/>
<textFieldExpression class="java.math.BigDecimal">
<![CDATA[$F{ITEM_AMOUNT}]]>
</textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>

The above XML file consists of the following main sections that defining report behavior and layout:

  • <queryString>: contains the SQL statement which retrieves the report result.
  • <field name>: defines the resulted fields from the query, and give them name to reuse them into the report body [they are case-sensitive].
  • <staticText>: contains the header titles "Item Name" in <![CDATA[Item Name]]> tag format.
  • <textFieldExpression>: defines the appearance of result field.
  • $F{ITEM_NAME}: is a variable contains the value of Query result predefined field in the tag <field name>.

Once we finished the report design file, save it in C:\ directory.

Implementing The Report Service:

- Create a new java project.
- Import the jars listed in environment section to your project libraries.
- Create new class and import the following packages

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.HashMap;

import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRExporterParameter;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.export.JRXlsExporter;


- Define the data source, in my case it's an oracle connection and established by JDBC as following:

public static Connection establishConnection()
{
Connection connection = null;
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
String oracleURL = "jdbc:oracle:thin:@localhost:1521:mySID";
connection = DriverManager.getConnection(oracleURL,"username","password");
connection.setAutoCommit(false);
}
catch(SQLException exception)
{
exception.printStackTrace();
}
return connection;

}

Finally, the core code for compiling, filling and exporting the results in the following sequence:

- Define jasper objects that will hold report template, compiled files, and result files.

/* JasperReport is the object
that holds our compiled jrxml file */
JasperReport jasperReport;


/* JasperPrint is the object contains
report after result filling process */
JasperPrint jasperPrint;

- Create a connection to my data-source; initialize the report parameter into empty HashMap then compile our jrxml file into JasperReport object and finally fill the JasperPrint object by data from data-source connection.

// connection is the data source we used to fetch the data from
Connection connection = establishConnection(); 
// jasperParameter is a Hashmap contains the parameters
// passed from application to the jrxml layout
HashMap jasperParameter = new HashMap();

// jrxml compiling process
jasperReport = JasperCompileManager.compileReport
("C://sample_report.jrxml");

// filling report with data from data source

jasperPrint = JasperFillManager.fillReport(jasperReport,jasperParameter, connection); 

- Last segment of code is responsible for exporting the result files into different formats

// exporting process
// 1- export to PDF
JasperExportManager.exportReportToPdfFile(jasperPrint, "C://sample_report.pdf");

// 2- export to HTML
JasperExportManager.exportReportToHtmlFile(jasperPrint, "C://sample_report.html" ); 

// 3- export to Excel sheet
JRXlsExporter exporter = new JRXlsExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "C://simple_report.xls" );

exporter.exportReport();

You have just managed to generate your first jasper report in 3 different file formats at C:\\ directory (shown in the image below):

- sample_report.html
- sample_report.pdf
- sample_report.xls


 

Here we reach the end of today's article, next article we will cover the following points:
1- Using design tool (iReport) to generate robust and smooth jrxml file.
2- Create run-time search criteria and pass them to report.

Note: this Article was first published in FCI-H Blog, here

Article Type: 
How-to
0
Average: 4 (3 votes)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

chflb replied on Sun, 2008/08/24 - 5:27am

hello,

t the begining i was too happy by finding this tutorial, but after trying it , it doesn't work, there are 51 errors that talk about "symbols not found" , do you know the cause of these problems(i will send you the stack trace if you want), in fact i used commons-logging-1.1.jar instead of commons-logging-1.0.2.jar  and  itext-1.3.1.jar instead of iText-2.0.7.jar

i need your help,

thank you 

 

 

 

hossam replied on Sun, 2008/08/24 - 7:03am

@ chflb

 I guess you didn't read the rest of articles, there were two more articles that cover working with designing tools to facilitate report design and remove the overhead of XML work.

you can find those articles at the following URL's:

http://java.dzone.com/articles/java-reporting-%E2%80%93-part-3

http://java.dzone.com/articles/java-reporting-%E2%80%93-part-4

try to figure them out, if you still facing problems don't hesitate to contact me directly.

 

chflb replied on Sun, 2008/08/24 - 10:45am in response to: hossam

hello hossam, thank you for your reply,

in fact,i have the jrxml file created, 'd like to say also that i use jsf+jpa

this is my code(the procedure responsable for compiling and exporting pdf) :

  public String generate() 
{
try{
Connection connection = establishConnection();
HashMap jasperParameter = new HashMap();
JasperReport jasperReport = JasperCompileManager.compileReport ("E://rapport/rpt.jrxml");
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,jasperParameter, connection);
JasperExportManager.exportReportToPdfFile(jasperPrint, "E://rapport/sample_report.pdf");

}catch(ClassNotFoundException ex)
{ex.printStackTrace();}
catch(JRException jr){jr.printStackTrace();}

return "generate";
   }

 

there are in result 51 errors,(perhaps they will be stupid errors) ;

Initialisation de l'implémentation de JavaServer Faces de Sun (1.2_04-b20-p03) pour le contexte '/rapport'
net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:4: package net.sf.jasperreports.engine does not exist
import net.sf.jasperreports.engine.*;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:5: package net.sf.jasperreports.engine.fill does not exist
import net.sf.jasperreports.engine.fill.*;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:18: cannot find symbol
symbol: class JREvaluator
public class report1_1219591204559_305719 extends JREvaluator
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:25: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
private JRFillParameter parameter_REPORT_RESOURCE_BUNDLE = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:26: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
private JRFillParameter parameter_REPORT_CLASS_LOADER = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:27: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
private JRFillParameter parameter_REPORT_FORMAT_FACTORY = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:28: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
private JRFillParameter parameter_REPORT_TIME_ZONE = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:29: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
private JRFillParameter parameter_REPORT_DATA_SOURCE = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:30: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
private JRFillParameter parameter_REPORT_LOCALE = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:31: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
private JRFillParameter parameter_REPORT_URL_HANDLER_FACTORY = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:32: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
private JRFillParameter parameter_REPORT_PARAMETERS_MAP = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:33: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
private JRFillParameter parameter_REPORT_CONNECTION = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:34: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
private JRFillParameter parameter_IS_IGNORE_PAGINATION = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:35: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
private JRFillParameter parameter_REPORT_TEMPLATES = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:36: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
private JRFillParameter parameter_REPORT_VIRTUALIZER = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:37: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
private JRFillParameter parameter_REPORT_SCRIPTLET = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:38: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
private JRFillParameter parameter_REPORT_MAX_COUNT = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:39: cannot find symbol
symbol : class JRFillField
location: class report1_1219591204559_305719
private JRFillField field_TOT_C = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:40: cannot find symbol
symbol : class JRFillField
location: class report1_1219591204559_305719
private JRFillField field_SOLDE_AUTO = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:41: cannot find symbol
symbol : class JRFillField
location: class report1_1219591204559_305719
private JRFillField field_CODE_INFO = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:42: cannot find symbol
symbol : class JRFillField
location: class report1_1219591204559_305719
private JRFillField field_TOT_D = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:43: cannot find symbol
symbol : class JRFillField
location: class report1_1219591204559_305719
private JRFillField field_DERNIER_NPCH = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:44: cannot find symbol
symbol : class JRFillVariable
location: class report1_1219591204559_305719
private JRFillVariable variable_PAGE_NUMBER = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:45: cannot find symbol
symbol : class JRFillVariable
location: class report1_1219591204559_305719
private JRFillVariable variable_COLUMN_NUMBER = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:46: cannot find symbol
symbol : class JRFillVariable
location: class report1_1219591204559_305719
private JRFillVariable variable_REPORT_COUNT = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:47: cannot find symbol
symbol : class JRFillVariable
location: class report1_1219591204559_305719
private JRFillVariable variable_PAGE_COUNT = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:48: cannot find symbol
symbol : class JRFillVariable
location: class report1_1219591204559_305719
private JRFillVariable variable_COLUMN_COUNT = null;
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:71: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
parameter_REPORT_RESOURCE_BUNDLE = (JRFillParameter)pm.get("REPORT_RESOURCE_BUNDLE");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:72: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
parameter_REPORT_CLASS_LOADER = (JRFillParameter)pm.get("REPORT_CLASS_LOADER");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:73: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
parameter_REPORT_FORMAT_FACTORY = (JRFillParameter)pm.get("REPORT_FORMAT_FACTORY");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:74: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
parameter_REPORT_TIME_ZONE = (JRFillParameter)pm.get("REPORT_TIME_ZONE");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:75: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
parameter_REPORT_DATA_SOURCE = (JRFillParameter)pm.get("REPORT_DATA_SOURCE");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:76: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
parameter_REPORT_LOCALE = (JRFillParameter)pm.get("REPORT_LOCALE");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:77: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
parameter_REPORT_URL_HANDLER_FACTORY = (JRFillParameter)pm.get("REPORT_URL_HANDLER_FACTORY");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:78: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
parameter_REPORT_PARAMETERS_MAP = (JRFillParameter)pm.get("REPORT_PARAMETERS_MAP");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:79: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
parameter_REPORT_CONNECTION = (JRFillParameter)pm.get("REPORT_CONNECTION");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:80: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
parameter_IS_IGNORE_PAGINATION = (JRFillParameter)pm.get("IS_IGNORE_PAGINATION");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:81: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
parameter_REPORT_TEMPLATES = (JRFillParameter)pm.get("REPORT_TEMPLATES");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:82: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
parameter_REPORT_VIRTUALIZER = (JRFillParameter)pm.get("REPORT_VIRTUALIZER");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:83: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
parameter_REPORT_SCRIPTLET = (JRFillParameter)pm.get("REPORT_SCRIPTLET");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:84: cannot find symbol
symbol : class JRFillParameter
location: class report1_1219591204559_305719
parameter_REPORT_MAX_COUNT = (JRFillParameter)pm.get("REPORT_MAX_COUNT");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:93: cannot find symbol
symbol : class JRFillField
location: class report1_1219591204559_305719
field_TOT_C = (JRFillField)fm.get("TOT_C");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:94: cannot find symbol
symbol : class JRFillField
location: class report1_1219591204559_305719
field_SOLDE_AUTO = (JRFillField)fm.get("SOLDE_AUTO");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:95: cannot find symbol
symbol : class JRFillField
location: class report1_1219591204559_305719
field_CODE_INFO = (JRFillField)fm.get("CODE_INFO");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:96: cannot find symbol
symbol : class JRFillField
location: class report1_1219591204559_305719
field_TOT_D = (JRFillField)fm.get("TOT_D");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:97: cannot find symbol
symbol : class JRFillField
location: class report1_1219591204559_305719
field_DERNIER_NPCH = (JRFillField)fm.get("DERNIER_NPCH");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:106: cannot find symbol
symbol : class JRFillVariable
location: class report1_1219591204559_305719
variable_PAGE_NUMBER = (JRFillVariable)vm.get("PAGE_NUMBER");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:107: cannot find symbol
symbol : class JRFillVariable
location: class report1_1219591204559_305719
variable_COLUMN_NUMBER = (JRFillVariable)vm.get("COLUMN_NUMBER");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:108: cannot find symbol
symbol : class JRFillVariable
location: class report1_1219591204559_305719
variable_REPORT_COUNT = (JRFillVariable)vm.get("REPORT_COUNT");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:109: cannot find symbol
symbol : class JRFillVariable
location: class report1_1219591204559_305719
variable_PAGE_COUNT = (JRFillVariable)vm.get("PAGE_COUNT");
^
C:\Users\chifa\.personalDomain\personalDomain\config\report1_1219591204559_305719.java:110: cannot find symbol
symbol : class JRFillVariable
location: class report1_1219591204559_305719
variable_COLUMN_COUNT = (JRFillVariable)vm.get("COLUMN_COUNT");
^
51 errors
at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:193)
at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:220)
at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:153)
at newpackage.Report.generate(Report.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.el.parser.AstValue.invoke(AstValue.java:187)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
at javax.faces.component.UICommand.broadcast(UICommand.java:383)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
at org.
apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
ORA-12519, TNS:no appropriate service handler found
The Connection descriptor used by the client was:
localhost:1521:xe
;_RequestID=9f3c7020-39f3-4f81-aac7-bb04d0479e30;|RAR5038 : Exception inattendue lors de la création de la ressource pour le pool oracle-thinPool. Exception : La connexion n'a pu être attribuée pour la raison suivante : Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found
The Connection descriptor used by the client was:
localhost:1521:xe
ORA-12519, TNS:no appropriate service handler found
The Connection descriptor used by the client was:
localhost:1521:xe
;_RequestID=9f3c7020-39f3-4f81-aac7-bb04d0479e30;|RAR5058 : Erreur lors du redimensionnement du pool oracle-thinPool. Exception : La connexion n'a pu être attribuée pour la raison suivante : Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found
The Connection descriptor used by the client was:
localhost:1521:xe
 
i m sorry it's a very long stack,i hope you will help me, thank you again,

 

chflb replied on Sun, 2008/08/24 - 4:36pm in response to: chflb

hello houssem,

i found the solution,in fact there is another jar to be imported, the jar is: jdt-compiler-X.jar,

thank you very much about these series,i hope next time you make a tutorial about how to use JasperServer, because i need now to put the generated pdfs in server to be consulted by the administrator,

 any way, I thank you so much,

+@ 

urangel replied on Thu, 2009/02/05 - 7:54am

Hello Sir

I have created the jasper report using xml as shown in the above examplebut now i want to implement pagination in this report.how can i implement it.pls do reply .

 

thx

ali askari replied on Tue, 2009/05/12 - 1:55am

a

ali askari replied on Tue, 2009/05/12 - 1:58am in response to: chflb

hello. String appPath = srvlt.getServletContext().getRealPath("/") ; JRProperties.setProperty(JRProperties.COMPILER_CLASSPATH, JRProperties.getProperty(JRProperties.COMPILER_CLASSPATH) + ";"+ appPath + "WEB-INF/lib/jasperreports-x.jar;"); JasperReport jasperReport = JasperCompileManager.compileReport ("E://rapport/rpt.jrxml"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,jasperParameter, connection); JasperExportManager.exportReportToPdfFile(jasperPrint, "E://rapport/sample_report.pdf");

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.