Tuesday, September 28, 2010

Swiss ICT Awards 2010

Ok, this is not really a Java article as we usually post here on the blog - just a small company advertisement where you might help out. CTP has been nominated by the Swiss ICT Awards 2010 in the category "Champion". This award category gets selected by a jury. For the PUBLIC category, you can actually place a vote!

Please click on the below link and vote for Cambridge Technology Partners now and we may become the winners of the PUBLIC category:



Thursday, September 23, 2010

JavaOne 2010

Time is running quickly, and shocked we have realized that this year's JavaOne is already over - high time to share some conference highlights with you! It's the first time that Oracle drove the conference after acquiring Sun, so we were curious whether the spirit we valued so much during the last years is still around. To give you the conclusion already now - it's a yes, but there are some drawbacks.

It's clear that JavaOne is just the "side conference" this year - it had to leave its home in the Moscone center, which is mainly hosting Oracle OpenWorld. With the move, things got slightly smaller - session rooms (which is probably the most annoying aspect), the chill-out zones and exhibition space, ... . But of course it's not the size that matters; it's the content that compensates for it! The quality of the talks, we've seen, has been very good so far, and as usual it's a lot of great ideas, visions and news floating around. Below we give you a quick summary of the latest Java news and session highlights:


On Sunday evening Larry Ellison hosted the opening session of the Oracle OpenWorld. First of all most of the JavaOne attendees were rather surprised, they were not allowed to join in for this keynote. Nevertheless a quick update on this keynote is provided here before moving on with the real Java stuff.

The first presentation was the Oracle Exalogic Elastic Cloud, which is very briefly summarized “The Cloud in a Box”. The Exalogic box provides both hardware and software. Oracle further announced benefits to the customer due to the homogeneous hardware and software, which is also reflected in Oracle's new tag line "Hardware and Software Engineered to Work Together". Exalogic combines up to 30 servers, including storage (hard disk drive and SSD) and a high-speed internal network between the servers in a rack. The Exalogic solution is designed and optimized to run Enterprise Java applications, i.e. the Oracle Fusion Middleware stack, similar to the Oracle Exadata center which runs Oracle DB servers. Oracle Exalogic can be scaled from 1/4 up to 8 racks, whereas according to Larry Ellison two full racks were enough to host all of Facebook.com.

Afterwards the Unbreakable Enterprise Kernel was presented, which will be 100% RedHat compatible. It is Oracle’s answer to the slowly moving RedHat distribution; according to Larry Ellison RedHat is 4 years behind the mainline.

Finally Oracle Fusion Application was unveiled. It is a CRM/ERP/HRMS system which offers the features of products earlier acquired by Oracle such as PeopleSoft and Siebel. The entire code basis has been re-written based on Oracle Fusion Middleware, which had to be enhanced to support all the middleware functionality needed. It took Oracle five years to develop Oracle Fusion Applications and is one of the biggest projects Oracle ever faced.

On Monday and Tuesday the JavaOne Opening Keynote and the General Technical Session were about the Future of Java, which is the right thing to do after the Sun/Oracle merger last year. After finalizing the Java EE 6 Specification in December 2009, this year the focus is moved to the next version of the Java Standard Edition (Java SE). The last update on the Standard Edition was Java SE 6 in 2006. After a five years break we will get two new versions within roughly 18 months, OpenJDK 7 in mid 2011 and OpenJDK 8 in late 2012.

Thomas Kurian, Executive Vice President, Product Development at Oracle at JavaOne 2010 Opening Keynote

Java SE version 7 contains a bunch of smaller language changes and enhancements. Project Coin contributes most of the new language features, such as Diamond Operator for declaration and instantiation of generics, Try-with-Resource block for proper closing of resources implementing the new AutoCloseable interface in the java.lang package, Mutli-Catch and Re-Throw of Exceptions, Switch statements with Strings and String literals using “_” (int a = 0b100_1010_0011;). Additionally JSR 292 is implemented in this release, which supports mainly other languages setting up on top of the JVM, such as Scala and Groovy. The Fork/Join Framework provides better support for modern multi core processors. There are some other updates shipped with this release such as JDBC 4.1, which supports resource management, and more.

Java SE version 8 will bring a new modularization concept, finally no more hassle with the JAR files and the classpath! Project Jigsaw is defining these new features. A module (*.jmod) contains all its classfiles and a declaration of modules it depends on. This declaration is placed in the module-info.java file, which contains the name and the version of the dependencies. Modules need to be installed on the target system before they can be executed. A second set of major improvements will come out of the Project Lambda. These improvements include closures, value classes - no need to write getters and setters, extension methods and eventually reification.

On the tooling side two new versions of Netbeans IDE will be released during 2011 (check the feature list). Project Glassfish also committed to publish two new releases during calendar year 2011 (check the feature list).

JavaFX script will not be further developed by Oracle and is replaced by a set of APIs, which is supposed to make the technology more accessible to all Java developers without the need to learn a new language. Additionally 3D support is added to JavaFX! According to Thomas Kurian there will be direct 3D hardware rendering support using Microsoft DirectX or OpenGL and a HTML5/JavaScript output for web-based clients.

Not surprisingly, hot topics like the lawsuit with Google or the future of the JCP were not discussed.

Session Highlights

In Hyperproductive JSF 2.0, JSF co-spec lead Ed Burns showed a couple of reasons why your project development might run with hand brake pulled. With several demos he showed probably underused new features in JSF 2 like Groovy support for all JSF artifacts that get hot deployed, or the new facelets >ui:debug< tag that gives you information on the component trees or scope variables. He also emphasised the importance of standards or conventions for a team, which is indeed an often overlooked aspect when a new project needs to get out quickly. This was supplemented by another talk on the new JSF 2 composite components, which make it very easy to create reusable components for e.g. your corporate layout and build up a highly productive framework like that.

While Maven founder Jason van Zyl's talk on Maven 3 was not intended to show new Maven features, he gave an overview of how he envisions future enterprise development. This includes tight integration from IDE over SCM to CI, up to a new tool called Proviso which is targeted to standardize enterprise deployment processes. Another interesting aspect was how Sonatype standardized their component model around Maven and Hudson plugins as well as their repository manager to achieve better reuse, which is now all built around JSR-330.

As a company mainly dealing with enterprise development we were of course giving a main focus on all the Java EE 6 talks. Spec lead Roberto Chinnici gave one of them explaining the Java EE programming model. Even though we have been working with the technology for a while now, this gave a nice summary and showed again that you still get that extra little information from JavaOne that makes the conference very useful when you hear things from the mind behind it. Roberto provided a quick overview on managed beans, CDI and several "must knows" when changing to the new programming model.

On the same track was Dan Allen with presenting in depth on CDI and Seam 3. The talk went from all the CDI concepts from typesafe injection with qualifiers over loose coupling with events to the SPI in CDI leading to Seam 3. This is now split in several independent modules where your application can take what it needs. Spinning this thought further - why not break up all the EJB services and make them a portable extension? We might see something like this in Java EE 7. By the way, Dan is not only an excellent author (when are we going to see Seam in Action 2nd edition?), but also a great speaker - make sure to visit one of his talks when you got a chance.

To close the sessions on Java EE, we were deeply impressed by the session on Arquillian. The framework evolved out of working on the RI for CDI (Weld) and takes the idea of the new EE component model to your unit tests. By eliminating the build to create archives for integration tests, the team around Arquillian has managed to decrease complexity and improve speed of the integration test massively - something critical if you want your team to actually use them. The outcome was a generic component testing framework, which we're convinced will significantly improve quality on EE applications. You can programmatically create an archive on the components you want to test, and run the test either in container or as client in a running application server. This is the time when you feel that enterprise engineering is still a young discipline - why has this not been around for longer?

Last but not least, if you have been following our people spotlights you probably know we're big fans of the Java Posse! As in the last 4 years the posse was present also at this year's JavaOne holding a BoF in the Mason street tent, celebrating the 5th anniversary of the Java Posse. While it was less interactive than the last years BoFs, we got a great show with special guest "Loose" Bruce Kerr giving a live performance of the Posse song, funky costumes and interesting insights on the future of Java - well kind of. Go and download the recordings - although this time I guess it's too bad this is not a video podcast!

As usual we enjoyed being here - CU again next year!

Tuesday, September 21, 2010

Installing Oracle on Ubuntu

Most of the applications we write here at CTP depend on an Oracle database.
After putting some effort on configuring our development environment for a new project and figuring out the process wasn't as straightforward as I expected, I decided to share my finding in this walkthrough.
It describes the steps required to install Oracle on a Ubuntu Server.


The instructions apply to Oracle 11g (version on an Ubuntu 10.04.1 Server Edition 64-bit.
Download Ubuntu's installation ISO from http://www.ubuntu.com/server/get-ubuntu/download and Oracle's ZIPs from http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html.
A Windows environment is used as client. You will need the following tools:

Server configuration


Install Ubuntu in your server. In this example a virtual machine with 32 Gb of disk and 2Gb of RAM is used.
During the installation process, select the "SSH server" to be installed. To do it after installation, run:

sudo apt-get install openssh-server openssh-client

X Forwarding

You should configure PuTTY to forward the graphical applications from the Ubuntu server (the 'server') to your Windows workstation (the 'client'),
as the Oracle 11g installation depends on it.
Open PuTTY and enter the IP address of your server, give a name to the session and save it. Configure the following options:

  • In "Connection > SSH > X11", check "Enable X11 forwarding" and for "X display location" enter "localhost:0"

  • Go to the "Session" menu and save your session again, to persist the configuration changes.

Start the X server in your client computer before connecting to the server through PuTTY. In the programs menu, open "Cygwin-X" and run "XWin Server".
It may start a graphical terminal (XTerm) but you should close it, to avoid confusion. All you need is to keep the server running, indicated by the fancy X icon in the system tray.
Now you can establish the SSH connection. To test if the X Forwarding is properly configured, run xeyes in the server (if not found, run sudo apt-get install x11-apps) and you should see the eyes in your desktop.

Swap configuration

The amount of swap space required by the Oracle DB depends on the available RAM:

Available RAMSwap required
Between 1 and 2 Gb1.5 x RAM
Between 2 and 16 Gb1 x RAM
More than 16 Gb16 Gb

To check the existing configured space, run

$ free
total used free shared buffers cached
Mem: 2057836 181680 1876156 0 12268 91092
-/+ buffers/cache: 78320 1979516
Swap: 1417208 0 1417208

In this walkthrough I'm going to add 2Gb to the existing swap space.

# Creates a swap file, may take a while to execute
$ sudo dd if=/dev/zero of=/mnt/2Gb.swap bs=1M count=2048
# Activating the swap file
sudo mkswap /mnt/2Gb.swap
sudo swapon /mnt/2Gb.swap

To have the swap file mounted automatically after a reboot, add the following line to the /etc/fstab file:

/mnt/2Gb.swap none swap sw 0 0

Updating and installing dependencies

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install build-essential libaio1 libaio-dev libmotif3 libtool expat alien ksh pdksh unixODBC unixODBC-dev sysstat elfutils libelf-dev binutils lesstif2 lsb-cxx rpm lsb-rpm gawk unzip x11-utils ia32-libs

Installing libstdc++ 5

Ubuntu comes with libstdc++ version 6, but Oracle requires version 5. To fix it:

$ wget http://mirrors.kernel.org/ubuntu/pool/universe/g/gcc-3.3/libstdc++5_3.3.6-17ubuntu1_amd64.deb
$ dpkg-deb -x libstdc++5_3.3.6-17ubuntu1_amd64.deb ia64-libs
$ sudo cp ia64-libs/usr/lib/libstdc++.so.5.0.7 /usr/lib64
$ cd /usr/lib64
$ sudo ln -s libstdc++.so.5.0.7 libstdc++.so.5
$ ls -al libstdc++.*
lrwxrwxrwx 1 root root 18 2010-09-17 14:19 libstdc++.so.5 -> libstdc++.so.5.0.7
-rw-r--r-- 1 root root 829424 2010-09-17 14:18 libstdc++.so.5.0.7
lrwxrwxrwx 1 root root 19 2010-09-14 12:05 libstdc++.so.6 -> libstdc++.so.6.0.13
-rw-r--r-- 1 root root 1044112 2010-03-27 01:16 libstdc++.so.6.0.13

Links update

Update the symbolic link /bin/sh from /bin/dash to /bin/bash.

$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 2010-09-14 12:05 sh -> dash
$ cd /bin
$ sudo ln -sf bash /bin/sh
$ ls -l sh
lrwxrwxrwx 1 root root 4 2010-09-14 14:19 sh -> bash

Some links need to be created as well:

ln -s /usr/bin/awk /bin/awk
ln -s /usr/bin/rpm /bin/rpm
ln -s /usr/bin/basename /bin/basename

System users & groups

Change to root and create the following users and groups

ctp@oracle11g:~$ sudo -s
root@oracle11g:~# addgroup oinstall
Adding group `oinstall' (GID 1001) ...
root@oracle11g:~# addgroup dba
Adding group `dba' (GID 1002) ...
root@oracle11g:~# addgroup nobody
Adding group `nobody' (GID 1003) ...
root@oracle11g:~# usermod -g nobody nobody
root@oracle11g:~# useradd -g oinstall -G dba -p password -d /home/oracle -s /bin/bash oracle
root@oracle11g:~# passwd -l oracle
passwd: password expiry information changed.
root@oracle11g:~# mkdir /home/oracle
root@oracle11g:~# chown -R oracle:dba /home/oracle


root@oracle11g:~# mkdir -p /u01/app/oracle
root@oracle11g:~# chown -R oracle:dba /u01

System parameters

Some Linux kernel parameters need to be modified, as specified in Oracle's installation guide. To do that, add the parameters below to the file /etc/sysctl.conf:

fs.file-max = 65535
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65535
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144

The oracle user needs to have some shell limits increased by adding the parameters below to the file /etc/security/limits.conf:

oracle soft nproc 2047
oracle hard nproc 16383
oracle soft nofile 1023
oracle hard nofile 65535

Add the parameters below to the file /etc/pam.d/login:

session required /lib/security/pam_limits.so
session required pam_limits.so

Reboot the system to reload the configuration.

Oracle installation

From the directory you extracted the Oracle zip files, run database/runInstaller as the user oracle created above (see Unix Tips if you need help). You can ignore the DISPLAY warning, if any. If you receive an error regarding the X forwarding permission, use this remote X forwarding trick.

Installation options

The suggested installation options:

  • Create and configure a database

  • Server class

  • Single instance database installation

  • Advanced install

  • Enterprise Edition

  • General purpose/Transaction processing

  • Memory, Character sets, Security and Sample Schemas - as default

Run the fixup script following the instructions and then ignore the package dependencies.

To check if everything is ok, open the following address in your browser:


Startup script

First, edit the file /etc/oratab or create one if you don't have it already. Make sure that the last parameter is "Y", meaning you want the database to be started during boot.


Now create the startup script /etc/init.d/oracledb.

cd /etc/init.d
sudo touch oracledb
sudo chmod a+x oracledb

Add the following content to the startup script

# /etc/init.d/oracledb
# Run-level Startup script for the Oracle Enterprise Manager

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_OWNR=oracle
export ORACLE_SID=oracle

if [ ! -f $ORACLE_HOME/bin/emctl -o ! -d $ORACLE_HOME ]
echo "Oracle startup: cannot start"
exit 1

case "$1" in
# Oracle listener and instance startup
echo -n "Starting Oracle: "
sudo -u $ORACLE_OWNR -E $ORACLE_HOME/bin/lsnrctl start
sudo -u $ORACLE_OWNR -E touch /var/lock/oracle
# Oracle enterprise manager startup
sudo -u $ORACLE_OWNR -E $ORACLE_HOME/bin/emctl start dbconsole
echo "OK"

echo -n "Shutdown Oracle: "
# Oracle enterprise manager shutdown
sudo -u $ORACLE_OWNR -E $ORACLE_HOME/bin/emctl stop dbconsole
# Oracle listener and instance shutdown
sudo -u $ORACLE_OWNR -E $ORACLE_HOME/bin/lsnrctl stop
sudo -u $ORACLE_OWNR -E rm -f /var/lock/oracle
echo "OK"
$0 stop
$0 start
echo "Usage: `basename $0` start|stop|restart|reload"
exit 1

exit 0

To execute the script automatically during server startup:

sudo update-rc.d oracledb defaults 99

General tips n' tricks

Unix tips

Open a shell as anoter user:

sudo -u <username> -s

Remote X session config

$ xauth list
oracle/unix:10 MIT-MAGIC-COOKIE-1 a18621a7bf2c102fc2b27758007b56a0
# Copy the line returned above
sudo -u oracle -s
export HOME=/home/oracle
# Paste the copied line after xauth add
xauth add oracle/unix:10 MIT-MAGIC-COOKIE-1 a18621a7bf2c102fc2b27758007b56a0