Jasper is one of the standard report generator in the industry. However, setting up Jasper is a pain of ass. This post is my note for setting up Jasper on Linux, in case I have to do it again in the future…
Setting up an Ubuntu instance on Amazon
The first thing you need to do when you launch an Amazon EC2 instance is add the hostname to hosts. Copy /etc/hostname
to /etc/hosts
like so:
1
|
|
The ip-10-0-0-1
is the host name in your /etc/hostname
. You’ll need this setup else the jasper installation script might fail.
Update aptitude and install PostgresQL
This section is referenced from Ubuntu PostgreSQL HowTo
1 2 |
|
After Postgres is installed, you’ll need to setup its permission and password, so that jasper can connect to it.
First, enable postgres to be reached from localhost. Edit /etc/postgresql/9.1/main/postgresql.conf
and un-comment this line:
1
|
|
Then, login to postgres using postgres user:
1
|
|
You should be able to login without using password. Now, update your password:
1 2 |
|
After setting the password, edit the file /etc/postgresql/9.1/main/pg_hba.conf
and set the postgres
user to use md5 authentication.
1
|
|
Finally, restart the postgres server:
1
|
|
Download and run jasperserver install script
Got to Jaspersoft Downloads and get the jasperreports-server-cp-5.5.0-linux-x64-installer.run
script. In our case we run it as super user.
1 2 |
|
You’ll go through several steps:
-
It prints out the license. Read through it and select
y
when the promptDo you accept this license? [y/n]: y
shows up. -
It asks you to choose complete install or custom install. Choose custom.
-
It asks you to select a folder for install destination. I chose the default
/opt/jasperreports-server-cp-5.5.0
. -
It asks you to use bundled tomcat or existing one. Choose bundled.
-
It asks you to use bundled postgres or existing one. Choose existing.
-
It asks you the Tomcat server port. Just use the default
8080
. -
It asks you postgres binary location. Use
/usr/lib/postgresql/9.1/bin
. -
It asks you host and port for postgres server. Use the default
127.0.0.1
and5432
. -
It asks you the postgres password. Type it in.
-
It asks you whether to install sample database and sample reports. Pick whatever you like.
-
Proceed the rest of the installation.
Once you’re done with the installation. You can start the tomcat server using the command
1
|
|
Setup plsql query adapter
This section is referenced to Jaspersoft wiki. We found that when selecting query language as plsql
, jasperserver rejects the uploaded report.
To solve the issue, you’ll need to extend jasperserver with this plugin: jasperreports-extensions-3.5.3.jar. Download the jar, and place it to /opt/jasperreports-server-cp-5.5.0/apache-tomcat/webapps/jasperserver/WEB-INF/lib/
.
Now, cd to /opt/jasperreports-server-cp-5.5.0/apache-tomcat/webapps/jasperserver/WEB-INF
, and add one line to classes/jasperreports.properties
.
1
|
|
Edit flows/queryBeans.xml
. Change the line <property name="queryLanguages" ref="queryLanguages">
to
1 2 3 4 5 6 7 |
|
Edit applicationContext.xml
. Search for supportedQueryLanguages
and change it to the following.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
Finally, restart the jasper server.
1 2 |
|
Increase Jasper memory usage
More specifically, tomcat’s memory usage. The default memory setting is quite low and jasper is pretty in-responsive to user clicks. To change the setting, edit /opt/jasperreports-server-cp-5.5.0/apache-tomcat/scripts/ctl.sh
and change the two JAVA_OPTS
to
1
|
|
Relaunch your jasper server again. Now it should run more smoothly.
Conclusion
ITS A PAIN TO RUN JASPER…
Thanks to all the people that wrote wiki and articles to help me out. I hope I’ll never need to set it up again.