How to Configure Report Scheduler to work on your Jasper Server
Introduction
To leverage
this capability to the greatest extent, it is important to get familiar with
configurability of this feature. This tutorial covers some of the most commonly
used configuration parameters associated with the scheduling feature.
Pre-Requisites
- Access to the file system of and
the ability to stop and start an operational installation of JasperReports
Server
- Access to a running outbound mail
server.
Setting Up
the Connection to your Outbound Email Server
In order for
the scheduler to successfully send email notifications and distribute reports,
it must be configured to connect to an outbound email server.
Step
|
Action
|
1
|
Open the
following configuration file in your preferred text editor: /WEB-INF/js.quartz.properties
|
2
|
Set the
value for the mail.sender.host property to your outbound
mail server.
Example: report.scheduler.mail.sender.host=outbound.yourdomain.com
|
3
|
Set the
value for the mail.sender.protocol property to the protocol
used by your outbound mail server.
Example: report.schedulers.mail.sender.protocol=smtp
|
4
|
Set the
value for the mail.sender.port property to the port that
your outbound mail server listens on.
Example: report.schedler.mail.sender.port=25
|
5
|
Set the mail.sender.username and mail.sender.password properties
using valid login credentials to your outbound mail server.
Example: report.scheduler.mail.sender.username=myusername
report.scheduler.mail.sender.password=mypassword
|
6
|
Restart
JasperReports Server for the configurations to take effect.
|
Setting the
Outbound Email Address for the Scheduler
When the
scheduler sends out emails, these emails need to come from a specific email
address as the sender. This should be a valid email that is monitored for email
bounce backs, etc. so that appropriate action can be taken.
The following
steps cover how to define the email address that should be used as the sender
of emails coming from the scheduler jobs.
Step
|
Action
|
1
|
Open the
following configuration file in your preferred text editor: /WEB-INF/js.quartz.properties
|
2
|
Set the
value for the mail.sender.from property to the email address
you would like emails to come from.
Example: report.scheduler.mail.sender.from=yourname@yourdomain.com
|
3
|
Restart
JasperReports Server for the configurations to take effect.
|
Defining the URI for Emailed Report Links
When a link
to a report is sent out in an email from a scheduler job, this link must refer
the user back to the appropriate place on the server to access the output. In
order for this to occur, the scheduler must be aware of the URI for
JasperReports Server.
Example: If the default login page for
JasperReports Server is accessed by going to http://www.yourdomain.com/jasperserver-pro/login.html,
the URI for the scheduler should be set to http://www.yourdomain.com/jasperserver-pro.
The following
steps outline how to set the URI properly.
Step
|
Action
|
1
|
Open the
following configuration file in your preferred text editor: /WEB-INF/js.quartz.properties
|
2
|
Set the
value for the web.deployment.uri property to the URI for
your JasperReports Server installation.
Example: report.scheduler.web.deployment.uri=http://www.yourdomain.com/jasperserver-pro
|
3
|
Restart
JasperReports Server for the configurations to take effect.
|
Defining the Number of Scheduler Threads per Server
In order to
keep the scheduler jobs from using too many resources on a particular server,
it is important to control the number of threads used to process scheduled
jobs.
- The thread count controls the
maximum number of concurrent scheduler jobs that will run on a server at
once.
- Increasing this count increases
the throughput of schedules that can be processed, but may adversely
impact the resources available for end-users that are interacting directly
with the application.
The following
steps cover how to configure the number of threads per server that will process
scheduled jobs.
Step
|
Action
|
1
|
Open the
following configuration file in your preferred text editor: /WEB-INF/js.quartz.base.properties
|
2
|
Set the
value for the threadPool.threadCount property to the number
of threads you want to process schedule jobs per server.
Example: org.quartz.threadPool.threadCount=3
|
3
|
Restart
JasperReports Server for the configurations to take effect.
|
Defining the
Job Misfire Threshold
The misfire
threshold sets the amount of time that can pass before a missed or delayed
scheduler job is skipped.
- Increasing the misfire threshold
will allow reports to run even if schedules are delayed due to server
downtime or a backlog of jobs scheduled at the same time.
- Decreasing this threshold is
useful if you have jobs that are scheduled frequently.
Example: If a report is scheduled every hour,
you may not want the 8am report to run if it is already 9am and the 9am report
would give you the same information.
The following
steps show how to set the misfire threshold.
Step
|
Action
|
1
|
Open the
following configuration file in your preferred text editor: /WEB-INF/js.quartz.base.properties
|
2
|
Set the
value for the jobStore.misfireThreshold property to the
number of milliseconds beyond the scheduled time that a delayed schedule job
should be skipped.
Example: For 30 minutes, org.quartz.jobStore.misfireThreshold=1800000
|
3
|
Restart
JasperReports Server for the configurations to take effect.
|
Disabling the
Report Scheduler on a Server
Under certain
circumstances, it may be necessary to disable the report schedules completely
on a server.
Example: It may make sense to have dedicated
servers for end users separate from those that execute scheduler jobs.
The following
steps cover how to disable the report scheduler on a particular server.
Step
|
Action
|
1
|
Open the
following configuration file in your preferred text editor: /WEB-INF/applicationContext-report-scheduling.xml
|
2
|
Find the
following lines:
<bean class="com.jaspersoft.jasperserver.api.engine.scheduling.quartz.QuartzSchedulerControl"
depends-on="reportSchedulingService"
id="quartzSchedulerControl"
init-method="start">
<property name="scheduler" ref="quartzScheduler"
/>
</bean>
|
3
|
Remove the
init-method definition – init-method=”start”
|
4
|
Restart
JasperReports Server for the configuration to take effect.
|
How to
Configure Report Scheduler to work on your Jasper Server
Another BI technology
I'm exploring right now is Jaspersoft. It's a powerful Open Source BI tool
which is a bit similar to Oracle Hyperion. And since it uses Open Source
technology, this means it's way cheaper and easier to sell. lol
Going back to the topic, I'd like to share how easy it is to configure your Jasper Server to use it's report scheduler facility.
Step 1 :
Look for your Web-Inf folder from your Jaspersoft folder. I'm using Jaspersoft's later version so mine is located at ..\jasperserver-pro\apache-tomcat\webapps\jasperserver-pro\WEB-INF.
Step 2:
At the js.quartz.properties file, add your smtp and email credentials. If you are using gmail, be sure to use the 587 port as 465 port does not work well with gmail.
For example :
report.scheduler.mail.sender.host= your mail server(smtp.gmail.com for gmail)
report.scheduler.mail.sender.username= your email's username
report.scheduler.mail.sender.password= your email's password
report.scheduler.mail.sender.from= your email address
report.scheduler.mail.sender.protocol=smtp
report.scheduler.mail.sender.port=587
report.scheduler.web.deployment.uri=http://localhost:8080/jasperserver-pro (This url should be the same url you see when you open your Jasperserver login page. You only need to remove login.php)
Step 3 (Optional) :
If you'de like to increase your thread pool, you may do so by modifying the file js.quartz.base.properties .
Locate the line org.quartz.threadPool.threadCount and increase the thread count.
For example:
org.quartz.threadPool.threadCount = 3
Step 4 :
At the applicationContext-report-scheduling.xml file, locate the bean id reportSchedulerMailSender . Modify and add the following prop key under the property javaMailProperties.
For Example:
prop key="mail.smtp.auth">true
prop key="mail.smtp.starttls.enable">true
Step 5:
Restart your Jasperserver and schedule your report
Going back to the topic, I'd like to share how easy it is to configure your Jasper Server to use it's report scheduler facility.
Step 1 :
Look for your Web-Inf folder from your Jaspersoft folder. I'm using Jaspersoft's later version so mine is located at ..\jasperserver-pro\apache-tomcat\webapps\jasperserver-pro\WEB-INF.
Step 2:
At the js.quartz.properties file, add your smtp and email credentials. If you are using gmail, be sure to use the 587 port as 465 port does not work well with gmail.
For example :
report.scheduler.mail.sender.host= your mail server(smtp.gmail.com for gmail)
report.scheduler.mail.sender.username= your email's username
report.scheduler.mail.sender.password= your email's password
report.scheduler.mail.sender.from= your email address
report.scheduler.mail.sender.protocol=smtp
report.scheduler.mail.sender.port=587
report.scheduler.web.deployment.uri=http://localhost:8080/jasperserver-pro (This url should be the same url you see when you open your Jasperserver login page. You only need to remove login.php)
Step 3 (Optional) :
If you'de like to increase your thread pool, you may do so by modifying the file js.quartz.base.properties .
Locate the line org.quartz.threadPool.threadCount and increase the thread count.
For example:
org.quartz.threadPool.threadCount = 3
Step 4 :
At the applicationContext-report-scheduling.xml file, locate the bean id reportSchedulerMailSender . Modify and add the following prop key under the property javaMailProperties.
For Example:
prop key="mail.smtp.auth">true
prop key="mail.smtp.starttls.enable">true
Step 5:
Restart your Jasperserver and schedule your report
"repo:ILN_REPORT_dp_summary.jrxml"
$P{SUBREPORT_DIR} +
"ILN_REPORT_dp_summary.jasper"
Comments
Post a Comment