Jasper Reports
How to install JASPER SERVER on machine?
Installation Steps:
- In Windows, the installer is an executable file that you can double-click to run. For example, double-click the following:
jasperserver-ce-3.7-windows-installer.exe
- In Linux, the installer is a .bin file; you can run it from the command line or from a graphical environment. To start the installer from the command line, login with an account that has administrative privileges and open a bash shell. At the command line, enter the name of the installer file. For example:
./jasperserver-ce-3.7-linux-installer.bin
- The first step introduces the installer and allows you to continue or exit. Click Next.
You are prompted to read and accept the license agreement. Read the agreement, agree to the terms by clicking I accept the agreement, and click Next. On the command line, you must page through several screens of text to read the full agreement.
- Installation Directory Location
You are prompted for the directory where JasperServer is installed referred to as the <js-install> directory. Accept the default or click Browse and select a different location, and click Next. On the command line, press Enter to accept the default. To choose a different directory location, enter that location at the prompt.
The default <js-install> directory depends on your operating system.
- Selecting Tomcat Configuration
JasperServer requires a web application server in order to run. The JasperServer installer is pre-configured to run with the Apache Tomcat server. There are two options available for your Tomcat configuration.
The first option is to choose a bundled Tomcat. If you choose this option, the installer puts an instance of Tomcat 5 onto your system. Click Next. You are prompted for the server port and shutdown port that Tomcat will use. Most users accept the default values that are displayed. Accept the default values or enter alternate values and then click Next.
The second option is to choose an existing Tomcat. If you already have an instance of Tomcat on your system, then you can choose this option. Choose the existing Tomcat option and click Next. You are prompted for its location. Enter the correct location for Tomcat or click Browse to locate and select another location. Click Next. You are prompted for Tomcat's server port and shutdown port. Accept the default values or enter alternate values and then click Next.
- Selecting MySQL Configuration
JasperServer requires a database in order to run. The JasperServer installer is pre-configured to run with the MySQL database.
There are two options available for you MySQL configuration same as Tomcat. Instructions for the configuration is same as above.
- Parameter Default Value and Description
Port 3306 - User must choose an alternate port if 3306 is in use.
Database User Name Hard coded default: jasperdb - The installer creates this user which is used to connect to the jasperserver database
Database User Password Hard coded default: password - The installer uses this password for the jasperdb account.
Jaspersoft recommends that you change your database user password from the default value to a new, secure value.
- Installing Sample Data
JasperServer can be installed with sample data that can help you evaluate its features.
Jaspersoft strongly recommends that you install this data, unless you are not interested in testing or evaluating with the default sample data. Click Yes to install the sample data and click Next.
- Installing iReport
iReport is the leading GUI-based JasperReports creation tool. It has the capability of communicating directly with a JasperServer instance and can thus retrieve existing JasperReports from a JasperServer instance for editing, uploading or execution.
In the installer, iReport comes pre-configured with a plugin that allows it to communicate with JasperServer via the web services interface.
If you would like to install iReport click Yes.
- Ready to Install
The components are now ready for installation. Click Install or Next to continue. Installation can take a number of minutes.
- Installation Complete Screen
After the JasperServer files have been installed, you will see the final installation screen. There are several Post-Installation options that you can choose from, each with its own checkbox. Simply click to make your choices and then click Finish.
- Parameter Default Value and Description
Binary Directory: is where the mysql and mysqladmin binaries are located.
Port: The port numbers that MySQL uses (default is 3306).
IP or Host Name: The value is hard coded to 172.0.0.1. Note that your existing MySQL instance must reside on the local machine.
MySQL Root User Name: User name of the database administrative user.
MySQL Root Password: Password of the database administrative user. *
Database User Name jasperdb - The installer creates this user which is used to connect to the jasperserver database.
Database User Password password - The installer uses this default password for the jasperdb account. *
How to start and stop Jasper Server?
Start:
Click Start > All Programs > JasperServer 3.7 > JasperServer Management > Start JasperServer.
Stop:
Click Start > All Programs > JasperServer 3.7 > JasperServer Management >Stop JasperServer.
From command prompt:
Start:
Stop:
USER Management on Jasper server:
1) Login as “jasperadmin” as user
2) Click on MANAGE->ROLE link
3) Click on ADD ROLE
4) Give role name and details
5) Click submit
6) Go to MANAGE->USERS
7) Click on ADD user
8) Click submit
9) Go to HOME page
10) Create folders
Based on the requirements, put the reports in various categories. Say you have created two folders under root folder. ONE is report_all and other report_admin
11) Put your jasper files accordingly in the respective folders created
12) Right click on the folders created and click on permissions.
13) Assign this folder access to the roles you wanted.
How to set up generation of reports through jasper scheduler and sending the report through Email notification
Email set up
Follow these steps:
- Go to “D:\Program Files\jasperserver-ce-3.7.0\apache-tomcat\webapps\jasperserver\WEB-INF” --since your japser is in root directory.
- Open “js.quartz” file
- Change these parameters to mentioned below
(Changing with respect to mail sent by gmail id)
report.scheduler.mail.sender.host=smtp.gmail.com
report.scheduler.mail.sender.username= (your gmail username will come here)
report.scheduler.mail.sender.password= (your gmail password will come here)
report.scheduler.mail.sender.from= ( your gmail id will come here)
report.scheduler.mail.sender.protocol=smtp
report.scheduler.mail.sender.port=587
report.scheduler.web.deployment.uri= your jasperserver url will come here(eg http://localhost:8083/jasperserver)
Save the file.
- Open “ applicationContext-report-scheduling” file in the same folder
- Set the following property :
<prop key="mail.smtp.auth">true</prop>
<prop key="mail.smtp.starttls.enable">true</prop>
Under <property name="javaMailProperties"> property
- Restart the server and run the scheduled report
Scheduling
- Right click on the report which you want to schedule. Click on schedule option.
- Click on Schedule job and Enter the parameters for running the report at what and how many times
- Click next and enter default parameter values and click next and fill up the following screen with proper email id to whom the mail needs to be sent.
- Click on save.
How to deploy files in Jasper Server?
- Right click on the folder in which you want to deploy the file.
- Click next and enter the name of the file. Your name should be same to your report design file always.
- Upload the main design file. Click Next.
- On next screen, you actually create the parameters of the report. You can also upload some additional resources like sub reports in this section.
- For parameters click on “ADD CONTROL”. Your parameter name should always be the same with the one you defined in design file always.
- Select the data source with which you want to associate your report. (database)
- Click on finish and then save and your report link will be created.
How to solve DATABASE_TIMEZONE error in Jasper Server?
Many a times when you deploy files on Jasperserver, while running the report, you face this problem.
The root cause of this problem is having subreports in your main report. Things run fine on designer but starts failing on server.
While adding the subreport elements in main report, keep in mind to give the subreport expression property of subreport as
“repo:<subreportname>” instead of giving the entire path where the file is saved in the machine
Once this activity is done, as soon as you deploy your main report on Jasper server, it asks you to upload the additional resources (are subreports) also on server. If all subreports deployed properly, this error will never come on server.