Friday, September 28, 2012

ADF Essentials in the RedHat Cloud (Glassfish / OpenShift)


RedHat OpenShift Cloud


In this post we (Ulrich @GerkmannBartels (,@multikoop, are going to show how to setup the runtime environment for running ADF Essentials Applications on Glassfish in RedHats OpenShift Cloud. For the moment we are not going to connect to any database. What we are actually going to show is
  • Setup Glassfish on OpenShift Cloud
  • Configure appropriate JVM settings
  • Install ADF Share Libraries into Glassfish Domain
  • Deploy ADF Essentials Application (currently with no database access)


Step 1: Sign up for free OpenShift account (if needed)
Goto and register for a free account if you do not have one yet.
All you need is a valid emailadress. You will get 1.5G Memory and 3G Storage

Step 2: Create new Cloud Application
Login through the web interface and create a new application, i.e. adf with the Do-It-Yourself Catridge. This is pretty easy. Just log into your Openshift account and choose create application. Choose the following catridge

After that, just follow the instructions and you are done. This is really easy. Believe me!

Step 3: Prepare your client for the cloud
Well, this actually depends on your OS. You can read a detailed instruction about it here:

On a Mac: Open Terminal and enter:

enpitmac:~ak$ sudo gem install rhc
Successfully installed jruby-pageant-1.1.1

This will install the RedHat Client tools. Test the availability of rhc via

enpitmac:~ ak$ rhc -version
rhc 0.98.16
enpitmac:~ ak$ 

Setup OpenShift environment on your client

enpitmac:~ ak$ rhc setup

Starting Interactive Setup for OpenShift's command line interface
To connect to enter your OpenShift login (email or Red
Hat login id): <your id>
Password: *******

Next step: I would like to access the cloud by ssh. So to get this, we need to setup up an SSH equivalence, which actually the red hat client tools are doing for us. For me it was done, when I just send the first command with rhc, i.e.

enpitmac: ak$ rhc app
Password: *******

Starting Interactive Setup for OpenShift's command line interface

It looks like you have not configured or used OpenShift client tools on this computer. We'll help you configure the client tools with a few quick questions.

The OpenShift client tools have been configured on your computer.  You can run this setup wizard at any time by using the command 'rhc setup' We will now execute your original command (rhc app)
enpitmac:~ ak$ 

Well, the command 'rhc app' does not exists, but it helped to setup the ssh equivalence.

Step 4: Install Glassfish
OK, now the fun part starts. After we have setup OpenShift, lets get glassfish running . The easiest way is to log into your open shift cloud through ssh and download the glassfish right into your repository directory.

Goto choose your application and then expand 'WANT TO LOG I TO YOUR APPLICATION' Item. Here you will see the ssh command which allows you to login from your local machine.

Once logged in grab the latest GlassFish binaries into your repository directory:

Since it is not allowed to start more than one http-listener on port 8080 on openshift cloud, we have to adjust the glassfish domain.xml configuration. (Read more about this here: )

In order to make life easier you can download the preconfigured domain.xml from our server.

In short: it contains the following (main) changes which are needed in order to be able to run Glassfish for ADF Essentials on Openshift.

b) deactivate http-listener2 (Openshift only allows to run one listener, no admin console will be available)


c) ADJUST MaxPermSize to:
d) Configure simple MDS Cache:

C.4.3 How to Configure the JVM Cache 
for detailed instructions of the Oracle ADF Admin Guide.)

Start / Stop Glassfish by start / stop hooks of your OpenShift application

Adjust start script hook
# The logic to start up your application should be put in this
# script. The application will work only if it binds to
cd $OPENSHIFT_REPO_DIR/diy/glassfish3/glassfish/domains/domain1/config/
mv domain.xml domain.xml_2
sed 's/'$( grep serverName domain.xml_2 | cut -d\" -f 2 )'/'$OPENSHIFT_INTERNAL_IP'/g' domain.xml_2 > domain.xml
../../../bin/asadmin start-domain &> $OPENSHIFT_LOG_DIR/server.log

Adjust stop script  hook
kill `ps -ef | grep glassfish3 | grep -v grep | awk '{ print $2 }'` > /dev/null 2>&1
exit 0

TEST if your Glassfish is running by typing from your client terminal

enpitmac:~ ak$ rhc app start -a adf

Check on Browser


Well, the basis is done. Now we need to get the ADF Share Libraries onto Glassfish
C.3 Configuring GlassFish with ADF Runtime Libraries 
for detailed instructions of the Oracle ADF Admin Guide.)

Copy onto the $GF_DOMAIN_HOME/lib with scp und unzip (with -j , this is important) 
enpitmac:~ ak$ scp Downloads/                                                                          100%   21MB  25.6KB/s   13:48   
enpitmac:~ ak$ ssh
[ ~]\> cd adf/repo/diy/glassfish3/glassfish/domains/domain1/lib
[ lib]\> unzip -j
Label: JDEVADF_11.
  inflating: adf-controller-security.jar 
  inflating: adf-share-security.jar 
[ lib]\>

Now restart glassfish to grab the changes! ~]\> ./adf/repo/.openshift/action_hooks/stop
.. ~]\> ./adf/repo/.openshift/action_hooks/start

Create a simple ADF Application and copy it into the autodeploy folder
enpitmac:~ ak$ cd Workspace/enpit-base/development/enpit.sample/

enpitmac:deploy ak$ scp enpit-sample-app1.ear <.....><...>/adf/repo/diy/glassfish3/glassfish/domains/domain1/autodeploy
enpit-sample-app1.ear                                                                       100%   64MB  18.1KB/s   59:55   
enpitmac:deploy ak$ 

(BTW: I must say the size of the EAR for ONE single ADF UI View just sucks: more than 60MB.  IMHO not ready for the cloud!)

Anyway, after doing all that above the running application should be satisfying ;)


  • Hopefully Oracle will unveil the Oracle Cloud for everyone who wants to run / try out ADF ;). Please !