Administering Jasper Reports Server

Doug WaltonCloud Engineer
Published:
Updated:
I recently went through setting up a JasperReports Server using the AWS EC2 instance, and this article will cover some basic administration tasks I had to perform.
JasperReports Server (http://community.jaspersoft.com/project/jasperreports-server) is great tool for creating reports in a simple, visual manner.  Most DBAs and Developers know their database schema pretty well, but for non-technical people it can be hard to figure out how to pull relevant data from a database.  JasperReports Server is a Business Intelligence tool that lets users create their own reports without having to know any SQL.  You can select what tables you want to get data from and drag-and-drop the columns you want to use into a report.  Jasper Server also has support for creating graphs and dashboards, and scheduling reports.

You can get the open source version from SourceForge: http://sourceforge.net/projects/jasperserver/
There's also a pay-by-the-hour "Pro" version you can get if you use Amazon Web Services: https://aws.amazon.com/marketplace/pp/B00B527JQ0/ref=mkt_ste_l2_analytics_f1?nc2=h_l3_al#product-details

Sometimes it's still necessary to use Jaspersoft Studio to create more complicated reports, you can use my "Getting Started" guide here: http://www.experts-exchange.com/articles/17336/Getting-Started-with-Jaspersoft-Studio-Creating-a-report-from-a-template-and-Creating-a-datasource.html

I recently went through setting up a JasperReports Server using the AWS EC2 instance, and this article will cover some basic administration tasks I had to perform.

Creating a User and Changing Password
After logging in as superuser:
  1. Hover over "Manage" in the top navigation bar and click on "Users"
  2. Click on "Add user" near the top
  3. User Name is the full name, while User ID is what they login with.
  4. For example my User Name is Doug Walton and my User ID is dwalton.
  5. Enter in the remaining information
  6. Make sure "User is enabled" is checked then click "Add User" and you're done
To change the password, click on a user, then click Edit near the bottom right.

Adding Roles to a User
After logging in as superuser:
  1. Hover over "Manage" in the top navigation bar and click on "Users"
  2. Select the user you want to add a role to, then click Edit near the bottom right
  3. Select the roles you want to add and click the ">" arrow to add or "<" to remove
  4. Click "Save" when done
Role Breakdown:
  • ROLE_USER - general user (everyone has this by default)
  • ROLE_ADMINISTRATOR - Admins are allowed to edit domains and backend data, they also get emailed when a report fails
  • ROLE_SUPERUSER - has permission to everything
If you need to lock down information you can create more roles and give them specific permissions, the ones I listed above are just the main defaults.

Repository/Folder Permissions
To get to the repository, hover over "View" in the top navigation bar and click on "Repository."  It will list the folders on the left, and the selected folder's contents on the rest of the window.

Folder permissions are inherited from the top directory down.  To see/edit the permissions you can right click on a folder and select "Permissions."  In the popup window you can switch between role and user permissions.  All user specific permissions are set to No Access by default, but role permissions will override that.  If a permission has a "*" next to it, that means it was inherited from a parent folder.

When I was specifying permissions I made sure no one has "Delete" permissions except for on the "Temp" folders.  I didn't want anyone to accidentally delete someone else's report.

Setting up or Changing Database Connections
To create a new database connection, hover over "Create" then select "Data Source."
To edit an existing connection, either click the "View List" link in the Data Sources box on the homepage, or browse to the Data Sources folder in the Repository.  Then right click the data source you want to change and select Edit.
  1. Select the Type of data source you want to use, this will usually be JDBC.  
  2. Then choose a driver for the database type.  
  3. Now you can fill out the connection info and enter the username and password to use for the connection.
  4. Click "Test Connection" to make sure you entered everything correctly, then click "Save."

Clearing Query Cache
Jasper Server tries to cache query results to save time, but if the data changes in the database the changes won't show up right away.  If someone is complaining about a report not showing updated results, you can clear the query cache by doing the following:
  1. Hover over "Manage" in the top navigation bar, then select "Server Settings."
  2. On the left pane click on "Ad Hoc Cache."
  3. Find the query you want to clear then click "Clear" on the right side.  Or you can click "Clear All" at the bottom to clear all queries.
This is also useful if it seems like the server is low on memory or acting slow.  Some big queries can take up a lot of space in the cache and you can clear them out to free up some java memory.  Java/tomcat is allocated to use all/most of the memory on our EC2 instance so this won't really show up when you run top in the terminal, you'll mostly know this is a problem when people are getting random errors.

Running a Report
  1. Find the report you want to run/schedule in the Repository or the list of all Reports.
  2. Right click on the report and select one of the "Run" options you want (Run, Run in new Tab, Run in Background)​
  3. To schedule a report right click on it and select "Schedule"
  4. Click "Create New Schedule" or click the pencil icon to edit an existing schedule.
  5. Here you can specify how often you want it to run, what parameters to use, where it gets saved, and who it gets emailed to.
  6. Click Save, then give the schedule a name/description (I usually name them (time period), like Traffic Stats (Daily)).

Finding Running Reports
You can see what reports are currently running by going to: http:///jasperserver[]-pro]/rest_v2/reportExecutions?
The "-pro" part is only necessary if you're using the JasperReports Server Pro version, the free version won't have that in the URL.

You can also specify a date range using GET variables "fireTimeFrom" and "fireTimeTo" in the format of yyyy-MM-dd'T'HH:mmZ.  For example, the following will list all reports that started after 2015-04-29 at midnight in the PDT timezone:
http://jasper.aws.com/jasperserver-pro/rest_v2/reportExecutions?fireTimeFrom=2015-04-29T00:00PDT

This will look something like:
 
<reportExecutions>
                        <reportExecution>
                          <reportURI>/organizations/organization_1/reports/Test_Report1</reportURI>
                          <requestId>9872345_1345439600599_11</requestId>
                        </reportExecution>
                      </reportExecutions>

Open in new window



Stopping Running Reports
To stop a running report you have to send a PUT command, here's an example of doing this using curl:
 
$ curl -u username:password -X PUT -H "Content-Type: application/xml" -d "<status>cancelled</status>" http://<sever.domain>/jasperserver-pro/rest_v2/reportExecutions/<responseID>/status/

Open in new window


You can get the responseID from going to the URL in the "Finding Running Reports" section above, and the username/password are what you use to login to Jasper Server. The superuser account can cancel any report, while administrators can cancel only cancel reports where they have "Administer" permissions on the parent folder.  Normal users can only cancel reports that they started.

Daily Startup/Shutdown Scripts
We use the Amazon Web Services EC2 Jasper Server instance, which can get pretty expensive.  I recommend shutting it down when no one is using it.
I'll make a separate article on how I did this (I'll update and add a link when I finish this).

Setting up or Changing Domains
Domains are where you specify what schema and tables you want to use for reports.  Each report can only use one domain.

This is where it starts to get more complicated, I'll create another article for this, too (I'll update and add a link when I finish this).

2
4,032 Views

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.