David Ghedini
PostgreSQL 9.2 has been released (9.2.0):
http://www.postgresql.org/docs/9.2/static/release-9-2.html
Update (September 16, 2012): Just update my blog to 9.2 using pg_upgrade.
So far, so good.
Posted at 04:07AM Sep 11, 2012 by David in PostgreSQL | Comments[2] | Tags: postgresql | Export to: |
This post will cover installing Apache TomEE on CentOS 6.x
TomEE is a certified implementation of the Java EE 6 Web Profile.
What is most interesting is that it is build on top of Tomcat 7. Literally. Nothing has been removed from Tomcat 7, only added to.
Installation is quite identical to Tomcat 7 and you can even deploy TomEE as a WAR from within an existing Tomcat 7.x installation.
I wasn't keen on this option as the overall directory structure, jar locations, conf files, etc...are different from the apache-tomee-1.0.0-webprofile package layout, which we will be installing below.
Conversely, it could be an option to consider as apache-tomee-1.0.0-webprofile is packaged with Tomcat 7.0.27 (current stable is 7.0.29).
There is also a TomEE Plus package with additional features, but this is not Java EE6 certified. Installation of TomEE Plus is identical to Web Profile below, just change the file names.
Below, we'll install TomEE and configure it to run as a service. To see how to run TomEE as an unprivileged user, Manager configuration, run on port 80, etc, etc...please see my Tomcat 7 Installation post
To begin, we'll need to install the Java Development Kit (JDK) 6
You can download the latest JDK here: http://www.oracle.com/technetwork/java/javase/downloads/index.html
We'll install the latest JDK, which is JDK 6, Update 33.
For CentOS 64 bit, I'll be using jdk-6u33-linux-x64.bin (for 32 bit, use jdk-6u33-linux-i586.bin)
Download jdk-6u33-linux-x64.bin and save it the /opt directory.
[root@demo3 opt]# ls jdk-6u33-linux-x64.bin
Creating a new directory /usr/java:
[root@demo3 opt ]# mkdir /usr/java
Change to the /usr/java directory we created
[root@demo3 opt ]# cd /usr/java [root@demo3 java ]#
Execute the bin file using 'sh /opt/jdk-6u33-linux-x64.bin' (if you saved jdk-6u33-linux-x64.bin to a location other than /opt, adjust accordingly)
[root@demo3 java]# sh /opt/jdk-6u33-linux-x64.bin
This will create the directory /usr/java/jdk1.6.0_33. This will be our JAVA_HOME.
We can now set JAVA_HOME and put Java into the path of our users.
To set the JAVA_HOME, add below to the .bash_profile of root (you can do the same for user tomcat - or any other user - later if you decide to run it under a non-privileged user).
JAVA_HOME=/usr/java/jdk1.6.0_33 export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH export PATH
Once you have added the above to .bash_profile, issue '. ~/.bash_profile' as shown below. Or you can simply log out and log back in.
[root@demo3 ~]# . ~/.bash_profile
Verify that Java is now in your path by issuing 'echo $JAVA_HOME'
[root@demo3 ~]# echo $JAVA_HOME /usr/java/jdk1.6.0_33
You can also issue 'java -version' to check that Java is available to your user.
[root@demo3 ~]# java -version java version "1.6.0_33" Java(TM) SE Runtime Environment (build 1.6.0_33-b04) Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03, mixed mode)
We will install TomEE under /usr/share.
Switch to the /usr/share directory:
[root@demo3 ~]# cd /usr/share [root@demo3 share ]#Download apache-tomee-1.0.0-webprofile.tar.gz (or the latest version) here
and save it to /usr/share
unpack the file using tar -xzf:
[root@demo3 share ]# tar -xzf apache-tomee-1.0.0-webprofile.tar.gzThis will create the directory /usr/share/apache-tomee-webprofile-1.0.0
This will be the home directory for TomEE
Create a simple Start/Stop/Restart for TomEE.
Change to the /etc/init.d directory and create a script called 'tomee' as shown below.
[root@demo3 share]# cd /etc/init.d [root@demo3 init.d]# vi tomeeAnd here is the script we will use.
#!/bin/bash # description: TomEE Start Stop Restart # processname: tomee # chkconfig: 234 20 80 JAVA_HOME=/usr/java/jdk1.6.0_33 export JAVA_HOME PATH=$JAVA_HOME/bin:$PATH export PATH CATALINA_HOME=apache-tomee-webprofile-1.0.0 case $1 in start) sh $CATALINA_HOME/bin/startup.sh ;; stop) sh $CATALINA_HOME/bin/shutdown.sh ;; restart) sh $CATALINA_HOME/bin/shutdown.sh sh $CATALINA_HOME/bin/startup.sh ;; esac exit 0You can adjust your script according to your needs.
Make the script executable:
[root@demo3 init.d]# chmod 755 tomeeAdd to chkconfig with run levels 234 (or whatever you prefer)
[root@demo3 init.d]# chkconfig --add tomee [root@demo3 init.d]# chkconfig --level 234 tomee onVerify it:
[root@demo3 init.d]# chkconfig --list tomee tomee 0:off 1:off 2:on 3:on 4:on 5:off 6:offTest the script.
Start TomEE:
[root@demo3 ~]# service tomee start Using CATALINA_BASE: /usr/share/apache-tomee-webprofile-1.0.0 Using CATALINA_HOME: /usr/share/apache-tomee-webprofile-1.0.0 Using CATALINA_TMPDIR: /usr/share/apache-tomee-webprofile-1.0.0/temp Using JRE_HOME: /usr/java/jdk1.6.0_33 Using CLASSPATH: /usr/share/apache-tomee-webprofile-1.0.0/bin/bootstrap.jar:/usr/share/apache-tomee-webprofile-1.0.0/bin/tomcat-juli.jarCheck if the Tomcat Manager page is visible at http://yourIPaddress:8080. If not check your firewall and logs.
Stop TomEE:
[root@demo3 ~]# service tomee stop Using CATALINA_BASE: /usr/share/apache-tomee-webprofile-1.0.0 Using CATALINA_HOME: /usr/share/apache-tomee-webprofile-1.0.0 Using CATALINA_TMPDIR: /usr/share/apache-tomee-webprofile-1.0.0/temp Using JRE_HOME: /usr/java/jdk1.6.0_33 Using CLASSPATH: /usr/share/apache-tomee-webprofile-1.0.0/bin/bootstrap.jar:/usr/share/apache-tomee-webprofile-1.0.0/bin/tomcat-juli.jarReview the catalina.out log located at /usr/share/apache-tomee-webprofile-1.0.0/logs/catalina.out and check for any errors.
[root@demo3 init.d]# more /usr/share/apache-tomee-webprofile-1.0.0/logs/catalina.out
By default, the TomEE Console is restricted via a valve to 127.0.0.1 (localhost).
You can remove or change this via the context.xml at:
/usr/share/apache-tomee-webprofile-1.0.0/webapps/tomee/META-INF/context.xml
<Context> <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.0\.0\.1|0:0:0:0:0:0:0:1(%.*)?|^::1$" deny=""/> </Context>
As with Tomcat 7, piping (|) is used in place of commas.
Below is a quick look at the TomEE Console screens and it's tabs:
TomEE Console Welcome Page:
TomEE Console Test Page:
TomEE Console JNDI Page:
TomEE Console EJB Page:
TomEE Console Class Page:
TomEE Console Invoke Page:
To see how to run TomEE as an unprivileged user, Manager configuration, run on port 80, etc... please see my Tomcat 7 Installation post Related Tomcat Posts
Learn More About Apache Tomcat 7 Apache Tomcat Foundation Tomcat 7

Posted at 07:58AM Aug 14, 2012 by David in Tomcat | Comments[0] | Tags: tomcat java | Export to: |
JasperReportsIntegration 2.0.0 Beta on JBoss 7
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-2.0.0.0.zip --2012-08-07 03:43:35-- http://www.opal- consulting.de/downloads/free_tools/JasperReportsIntegration/2.0.0/JasperReportsIntegration-2.0.0.0.zip Resolving www.opal-consulting.de... 213.185.81.187 Connecting to www.opal-consulting.de|213.185.81.187|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 82738852 (79M) [application/zip] Saving to: `JasperReportsIntegration-2.0.0.0.zip' 100%[======================================>] 82,738,852 2.26M/s in 37s 2012-08-07 03:44:12 (2.13 MB/s) - `JasperReportsIntegration-2.0.0.0.zip' saved [82738852/82738852]
3. unzip it.
[root@dev2 JasperReportsIntegration]# unzip -q JasperReportsIntegration-2.0.0.0.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-2.0.0.0.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-2.0.0.0.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 11.2.0.3.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_2.0.0.0.sql Application
Import the f860_JasperIntegrationTest_2.0.0.0.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
Posted at 01:30AM Aug 07, 2012 by David in JBoss | Comments[0] | Tags: oracle jboss apex | Export to: |


