Dietmar Aust / Opal Consulting have released JasperReportsIntegration 2.0.0 Beta for testing.
You can see the announcement here
It is has some amazing new features, is updated for JasperReports 4.7.0, and has a new deployment model.
Most importantly, the new version allows you to easily run JasperReportsIntegration on JBoss :)
If you don't have JBoss 7.1.1 installed, you can follow my tutorial here:
One important note - it did not work for me with JDK 1.7 but worked wonderfully with JDK 1.6
The zip file contains the required items for deployment on JBoss as well as items for Oracle (/sql directory) and Apex (/apex directory), it also contains some scripts to run in standalone mode as well as Jetty.
1. Create a directory under /usr/share to be the home for under JasperReportsIntegration
[root@dev2 ~]# mkdir /usr/share/JasperReportsIntegration
2. Change to the new directory:
[root@dev2 ~]# cd /usr/share/JasperReportsIntegration
3. Download the kit from Opal:
Or use wget:
[root@dev2 JasperReportsIntegration]# wget http://www.opal-consulting.de/downloads/free_tools/JasperReportsIntegration/2.0.0/JasperReportsIntegration-220.127.116.11.zip --2012-08-07 03:43:35-- http://www.opal- consulting.de/downloads/free_tools/JasperReportsIntegration/2.0.0/JasperReportsIntegration-18.104.22.168.zip Resolving www.opal-consulting.de... 22.214.171.124 Connecting to www.opal-consulting.de|126.96.36.199|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 82738852 (79M) [application/zip] Saving to: `JasperReportsIntegration-188.8.131.52.zip' 100%[======================================>] 82,738,852 2.26M/s in 37s 2012-08-07 03:44:12 (2.13 MB/s) - `JasperReportsIntegration-184.108.40.206.zip' saved [82738852/82738852]
3. unzip it.
[root@dev2 JasperReportsIntegration]# unzip -q JasperReportsIntegration-220.127.116.11.zip
4. Your directory will look like this:
[root@dev2 JasperReportsIntegration]# ls -l total 80944 drwxr-xr-x 2 root root 4096 Aug 6 17:49 apex drwxr-xr-x 2 root root 4096 Aug 6 17:49 bin drwxr-xr-x 2 root root 4096 Aug 7 05:30 conf -rw-r--r-- 1 root root 204 Aug 6 17:49 deployJasperReportsIntegration.cmd -rw-r--r-- 1 root root 178 Aug 6 17:49 deployJasperReportsIntegration.sh drwxr-xr-x 3 root root 4096 Aug 6 17:49 doc -rw-r--r-- 1 root root 341 Aug 6 17:49 Index.html -rw-r--r-- 1 root root 82738852 Aug 6 19:57 JasperReportsIntegration-18.104.22.168.zip drwxr-xr-x 3 root root 4096 Aug 6 17:49 jetty drwxr-xr-x 2 root root 4096 Aug 6 17:49 lib drwxr-xr-x 2 root root 4096 Aug 6 17:48 logs drwxr-xr-x 5 root root 4096 Aug 7 05:33 reports drwxr-xr-x 5 root root 4096 Aug 6 17:49 sql -rw-r--r-- 1 root root 793 Aug 6 17:49 startJasperReportsIntegration.cmd -rw-r--r-- 1 root root 772 Aug 6 17:49 startJasperReportsIntegration.sh drwxr-xr-x 2 root root 4096 Aug 6 17:49 webapp
5. Change to the webapp directory and locate JasperReportsIntegration.war:
[root@dev2 JasperReportsIntegration]# cd webapp [root@dev2 JasperReportsIntegration]# ls -l total 66508 -rw-r--r-- 1 root root 68028460 Aug 6 17:49 JasperReportsIntegration.war [root@dev2 webapp]#
6. Move the JasperReportsIntegration.war to JBOSS_HOME/standalone/deployments
In my case /usr/share/jboss-as/standalone/deployments:
[root@dev2 webapp]# mv JasperReportsIntegration.war /usr/share/jboss-as/standalone/deployments/JasperReportsIntegration.war
7. Once you have moved the WAR, delete the webapp directory along with the following:
[root@dev2 JasperReportsIntegration]# rm -rf webapp/ [root@dev2 JasperReportsIntegration]# rm -rf jetty/ [root@dev2 JasperReportsIntegration]# rm -rf apex/ [root@dev2 JasperReportsIntegration]# rm -rf sql/ [root@dev2 JasperReportsIntegration]# rm -f deployJasperReportsIntegration.cmd [root@dev2 JasperReportsIntegration]# rm -f deployJasperReportsIntegration.sh [root@dev2 JasperReportsIntegration]# rm -f startJasperReportsIntegration.sh [root@dev2 JasperReportsIntegration]# rm -f startJasperReportsIntegration.cmd [root@dev2 JasperReportsIntegration]# rm -f JasperReportsIntegration-22.214.171.124.zip
4. You should now be left with the following:
[root@dev2 JasperReportsIntegration]# ls bin conf doc Index.html lib logs reports
If you are running under the user jboss, change ownership of the logs directory at /usr/share/JasperReportsIntegration/logs to the user jboss
[root@dev2 JasperReportsIntegration]# chown -Rf jboss.jboss /usr/share/JasperReportsIntegration/logs
5. Change to the conf directory, where you will find application.properties and log4jproperties:
[root@dev2 JasperReportsIntegration]# cd conf [root@dev2 conf]# ls application.properties log4j.properties
6. The application.properties will look as below:
Change the data sources to your own.
Note that one of the verification tests later will look for a data source with the name 'default', so may want to leave one named as 'default'.
#==================================================================== # Application properties (global) #==================================================================== [application] jndiPrefix=java:comp/env/jdbc/ #==================================================================== # JDBC datasource configuration # http://www.orafaq.com/wiki/JDBC#Thin_driver #==================================================================== [datasource:default] name=default url=jdbc:oracle:thin:@192.168.2.114:1521:XE username=my_oracle_user password=my_oracle_user_pwd #==================================================================== # JDBC datasource configuration # http://www.orafaq.com/wiki/JDBC#Thin_driver #==================================================================== [datasource:test] name=test url=jdbc:oracle:thin:@192.168.2.114:1521:XE username=my_oracle_user password=my_oracle_user_pwd #==================================================================== # Direct printing #==================================================================== [directPrinting] isEnabled=true # for debugging purposes does it make sense to display the # print dialog ON THE SERVER before printing. You can even cancel the # request through the print dialog # DONT do that in production!!! displayPrintDialog=false #==================================================================== ## Syntax for specifying properties: ## http://commons.apache.org/configuration/userguide/howto_basicfeatures.html#Basic_features_and_AbstractConfiguration #====================================================================
7. Placing OC_JASPER_CONFIG_HOME into the path of JBoss.
Where you place the path to OC_JASPER_CONFIG_HOME depends on the user you running JBoss under.
If you are running JBoss under the user jboss, you need to add the path to OC_JASPER_CONFIG_HOME to the .bash_profile of user jboss.
If you are running JBoss under the user root, you need to add the path to OC_JASPER_CONFIG_HOME to the .bash_profile of the user root.
If you simply place the path into the Jboss init script (JBOSS_HOME/bin/jboss-as-standalone.sh) or into your jboss script under /etc/init.d, it will throw the following error as JBoss will look for the application.properties file under ../JasperReportsIntegration.war-xxx/conf/application.properties:
net.sf.jasperreports.engine.JRRuntimeException: File /usr/share/jboss-as/standalone/tmp/vfs/temp38167c0517128991/JasperReportsIntegration.war-d170f314ce444645/conf/application.properties not found. de.oc.integration.jasper.webapp.AppContext.loadApplicationProperties(AppContext.java:144) de.oc.integration.jasper.webapp.ReportWrapper.service(ReportWrapper.java:152) javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
So, add the following to the .bash_profile of the user your running jboss under (jboss or root):
OC_JASPER_CONFIG_HOME=/usr/share/JasperReportsIntegration export OC_JASPER_CONFIG_HOME
Along with JAVA_HOME and bin paths (and any others you have), your jboss (or root) user bash_profile would look something like:
JAVA_HOME=/usr/java/jdk1.6.0_33 export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH export PATH OC_JASPER_CONFIG_HOME=/usr/share/JasperReportsIntegration export OC_JASPER_CONFIG_HOME
8. Install the SQL into the user schema
This bit has not changed.
Connect to your database server and change directories to the location you uploaded the /sql directory.
Connect to SQL*Plus as the required user and run @user_install.sql
[root@or2 JRI2]# cd sql [root@or2 sql]# ls sys_install_acl.sql sys_remove.sql user_remove.sql xlib_jasperreports sys_install.log user_install.log xlib_base xlib_status.sql sys_install.sql user_install.sql xlib_http xlib_status_sys.sql [root@or2 sql]# sqlplus /nolog SQL*Plus: Release 126.96.36.199.0 Production on Mon Aug 6 20:39:01 2012 Copyright (c) 1982, 2011, Oracle. All rights reserved. SQL> connect soctt/tiger Connected. SQL> @user_install.sql
Make sure it compiles with no errors.
9. Install the f860_JasperIntegrationTest_188.8.131.52.sql Application
Import the f860_JasperIntegrationTest_184.108.40.206.sql into your work space.
The new testing application has some new features as you can see below.
10. Verify your installation.
In the screenshot below, you can see I did not use the name 'default' for any of my data sources.
11. Test your reports.
Among other new features, there is now a "Save File on Server" option. This allows you to save the generated report on the file system of the application server (jboss). You need to supply the full OS path. One additional note, if you are running as user jboss you will only be able to save into directories owned by jboss (or made available to user jboss). If you are running a root, of course, you can save anywhere on the server.
There is the file, fromapp.pdf, saved to server in above screen shot.
[root@dev2 jboss]# ls -l total 8 -rw-rw-r-- 1 jboss jboss 2153 Aug 7 06:48 fromapp.pdf
Cool beans. Hoping to learn a lot more about this
Official Installation Guide