Wow, I broke my brains over this for the last three days.

I installed the apex listener as mentioned in the manual. It mentions you can use Java 6 Update 20 JDK or later.

However, what they mean is that you should use Java 6 JDK, and you can use update 20 or later.

What I did in my stupidity is to use Java 7. That’s later then Java 6 upd 20 right?

wrong!

If you use Java 7 your listener might work (which was the case in my situation) but connecting to it using SQL Developer is a “no go” 🙁

Be warned.

regards, Richard

Watching our visitors and how they arrive on warp11.com I cam across this page:

http://krisrice.blogspot.com/2010/12/listener-startupshutdown-script.html

definately worthwile caching… here we go:

Kris gives a script, which I altered a little bit.

#!/bin/sh
#
#
# chkconfig: 2345 80 05
# description: This is a program that is responsible for taking care of
# starting the apex-listener as a service. 
#
# processname: apxlistener
# Red Hat or SuSE config: /etc/sysconfig/apxlistener
# Debian or Ubuntu config: /etc/default/apxlistener
#
. /etc/rc.d/init.d/functions
NAME="Oracle Application Express Listener"
JAVA="/usr/java/jdk1.7.0_04/bin/java"
APEX_LISTENER_HOME="/u01/app/oracle/product/1.1.3/apex-listener"
APEX_IMAGES="/u01/app/oracle/product/4.1/apex/images/"
LOGFILE="$APEX_LISTENER_HOME/apex_listener.log"
PIDFILE="$APEX_LISTENER_HOME/apex_listener.pid"

start() {
        echo -n "Starting $NAME: "
        if [ -f $PIDFILE ]; then
                PID=`cat $PIDFILE`
                echo APEX Listener already running: $PID
                exit 2;
        else
            nohup $JAVA -Dapex.home="$APEX_LISTENER_HOME/tmp.apxlistener" -Dapex.images="$APEX_IMAGES" -Dapex.port=8080 -jar "$APEX_LISTENER_HOME/apex.war" 2>&1 > $LOGFILE  &
            RETVAL=$!
            echo Started PID: $RETVAL
            echo
            echo $RETVAL >>$PIDFILE
            return $RETVAL
        fi

}

status() {
        echo -n "Status $NAME: "
        if [ -f $PIDFILE ]; then
                PID=`cat $PIDFILE`
                echo APEX Listener already running: $PID
                ps -ef | grep $PID
        else
                echo APEX Listener not running
        fi
}

stop() {
        if [ -f $PIDFILE ]; then
                PID=`cat $PIDFILE`
                echo -n "Shutting down $NAME PID:$PID"
                echo
                kill $PID
                rm -f $PIDFILE
        else
                echo APEX Listener not running
        fi
        return 0
}

log() {
        tail -f $LOGFILE
}

info() {
    echo Before first use you must run the command below manually to initiate the service.
    echo 
    echo $JAVA -Dapex.home="$APEX_LISTENER_HOME/tmp.apxlistener" -Dapex.images="$APEX_IMAGES" -Dapex.port=8080 -jar "$APEX_LISTENER_HOME/apex.war"
    echo 
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        status
        ;;
    restart)
        stop
        start
        ;;
    log)
        log
        ;;
    info)
        info
        ;;
    *)
        echo
        echo "Usage:  {start|stop|status|restart|log|info}"
        echo
        info
        exit 1
        ;;
esac
exit $?

You should edit highlighted lines:
JAVA: the location of your JDK. be advised the minimum version your listener needs
APEX_LISTENER_HOME: the location the listener uses to store its config files
APEX_IMAGES: the location of the apex images directory

Create the file as /etc/init.d/apxlistener

Now set it as executable

chmod a+x /etc/init.d/apxlistener

add it to the startup-list:

chkcondig --add apxlistener
chkconfig apxlistener on

Now we’re allmost there. The listener needs a console to do the initial configuration. If you would start the service as is, it will not have a console.

I added an option “info” that echoes the commandline the service will use:

so.. execute:

/etc/init.d/apxlistener info

will give you something like this:

Before first use you must run the command below manually to initiate the service.

/usr/java/jdk1.7.0_04/bin/java -Dapex.home=/u01/app/oracle/product/1.1.3/apex-listener/tmp.apxlistener -Dapex.images=/u01/app/oracle/product/4.1/apex/images/ -Dapex.port=8080 -jar /u01/app/oracle/product/1.1.3/apex-listener/apex.war

execute that line in your console, it will ask for two usernames ( I used “admin” in both cases) and passwords.

Enter them as requested after which you can go to http://yourserver:8080/apex/listernerConfigure

Here you can enter your details as described in the apex listener.

after a reboot the listener should start automatically.

This is part two of my series regarding a fully freeware APEX setup.

Post 1 coveres the installation of Oracle XE 11 beta on CentOS 5

Shut Down Apex-EPG

Log in as system into the XE database using SQL*plus. We must close the EPG within the database, because Tomcat is going to use the same port (8080)

execute dbms_xdb.sethttpport(0);

Tomcat installation

I took this from here.

su -
cd /etc/yum.repos.d
wget 'http://www.jpackage.org/jpackage50.repo' yum update
yum install tomcat6 tomcat6-webapps tomcat6-admin-webapps
service tomcat6 start

Tomcat is running!

tomcat_01

That was easy enough. We need to do some configuration.

If you get dependency errors please have a look at the original post essentially it says to try this:

rpm -Uvh http://plone.lucidsolutions.co.nz/linux/centos/images/jpackage-utils-compat-el5-0.0.1-1.noarch.rpm

and then try again.

Firewall configuration

setup
"Firewall configuration"
"Customize"
"Other ports" 8080:tcp
"Ok"
service tomcat6 restart

Downloads: APEX Listener and APEX itself

Even though XE 11g is shipped with Apex preconfigured, for this setup we do need to link to the images folder. We do this by downloading the full Apex archive. At the same time we can allready download the listener as well:

Unzip Apex:

unzip apex_4.0.2.zip
unzip apex_listener.1.1.2.131.15.23.zip -d apex_listener

We only need the images folder from the apex distribution. Nevertheless it can come in handy when the full apex installer is available.

The Tomcat htmlroot (or docroot) is located at /var/lib/tomcat6/webapps.

We copy the apex and the listener installer files into the Oracle tree and create a symbolic link in tomcats’ webapps folder:

su -
mkdir $ORACLE_BASE/product/4.0.2
cp -r apex $ORACLE_BASE/product/4.0.2/apex/
ln -s $ORACLE_BASE/product/4.0.2/apex/images /var/lib/tomcat6/webapps/i
mkdir $ORACLE_BASE/product/1.1.2
cp -r apex_listener $ORACLE_BASE/product/1.1.2/apex_listener

Tomcat configuration

Edit the /etc/tomcat6/tomcat-users.xml. We’re still root..

gedit /etc/tomcat6/tomcat-users.xml

replace the last line (having “</tomcat-users>”). Replace the username and password as desired.

  <role rolename="manager"/>
  <role rolename="admin"/>
  <role rolename="Manager"/>
  <role rolename="Admin"/>
  <user username="apex" password="verysecret" roles="manager,admin,Manager,Admin"/>
</tomcat-users>

It’s a bit silly that the roles are mentioned twice, but apparently not all implementations use the same casing.
I’m using the “apex” user here with the password “verysecret”

Save the file (Duhh 😉 )

Now we must make sure that Tomcat gets started at boot-time:

chkconfig --add tomcat6
chkconfig tomcat6 on
reboot

That should do the trick. So far for Tomcat for now.

Installing the APEX listener

First we need to unlock the “apex_public_user” and set its password. Open up the SQL*plus commandline and enter:

alter user apex_public_user account unlock;
alter user apex_public_user identified by the_secret_password;

Now open Tomcat manager: http://localhost:8080/manager/html. Go to the section: WAR file to deploy.

tomcat_manager_01

Click the browse button and select the warfile from /u01/app/oracle/product/1.1.2/apex_listener/apex.war

Click the “deploy” button.

Now you’re ready to configure the listener

<EDIT sept 2, 2011>

Today oracle released the definitive version of Oracle XE 11.2. I haven’t had the opportunity to test that version against my blogs, but I’ll do that shortly. stay tuned

</EDIT>

In my effort to create a fully free APEX environment this post is step 1: Install CentOS-5 and Oracle XE 11g.

This series will consist of a number of posts:

This is post 1, covering the basic installation.

Install CentOS-5

In my first attempts to get to this fulle freeware APEX environment I decided to use Ubuntu server with the GNOME desktop. However I found out that most software is delivered in RedHats RPM format. Especially the Oracle HTTP server preferes to be installed on a RedHat compliant system. CentOS is just that.

Just do a clean install CentOS downloaded from their site. I used version 5. But make sure you use the 64 bit version.

After the clean install I installed the VirtualBox extensions:

  1. Choose “Devices” – “Install Guest Additions”
  2. Open a terminal:
    su -
    cd /media/VBOXADDITIONS_4.0.6_71416/
    ./VBoxLinuxAdditions.run

    This installs the VBox additions. We do need a reboot:

    shutdown -r now

Install Oracle XE 11g beta

  1. Download the installer here.
  2. Open a terminal and go to the directory where you downloaded the ZIP
    mkdir OracleXE
    unzip linux.x64_11gR2_OracleXE.zip -d OracleXE
    su -
    cd /home/apex/Downloads/OracleXE
    rpm -ivh oracle-xe-11.2.0-0.5.x86_64.rpm
  3. We’re still Super so we can kick the configuration straight away:
    /etc/init.d/oracle-xe configure

    the installer will ask for a port to run Apex (8080), a port to run the database listener (1521) a password to be used for both SYS and SYSTEM users and whether you’d like to have the database start automatically at system start (y). As a famous dutch beer-commercial states: “now we wait”.

  4. When the installer finishes I put the apex user (the one I use to log in into the system) to the dba group. If we ommit this step we’ll not be able to use SQL*plus as the regular user (in my case this user is called “apex”).
    usermod -G dba apex
  5. Now we need to edit the bashrc file to have the paths and system variables set correctly for everyone on the system.
    gedit /etc/profile

    In the editor at the end of the file add these lines:

    #ORACLE XE 11g Beta
    export ORACLE_SID=XE
    export ORACLE_BASE=/u01/app/oracle
    export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/xe
    export ORACLE_TERM=xterm
    export NLS_LANG=american_america.utf8
    export TNS_ADMIN=$ORACLE_HOME/network/admin
    export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib
    export PATH=$ORACLE_HOME/bin:$PATH
  6. Now let’s reboot. We’re finished installing XE !
    shutdown -r now
  7. In the menu go to: Applications – Oracle Database 11g…. – Get Started
    This starts the browser and opens the APEX environment.When the page opens correctly we know that:

    1. The database starts automatically
    2. The EPG is running on port 8080

If you continue to use the EPG, you’re ready.

apex11g-01

if you want to use a different HTTP server you should continue:

You can also use the APEX listener in a stand-alone mode.