Oracle Apex - Installation version 4 with Oracle Application Express Listener

> Integrated development environment (ide) > Oracle Apex

1 - About

Installation steps of Apex 4.0 with Oracle Application Express Listener as HTTP Listener.

Oracle Application Express Listener is a Java-based Web server. It features file system caching, support for FOP transformations to PDF, offers improved file upload capability, and is certified against Web Logic, Tomcat, OC4J, and Oracle Glassfish Server.

3 - Pre-requis

3.1 - Oracle database version

Installation of an Oracle Database Enterprise Edition, Standard Edition or Standard Edition One, Express) that is release 10.2.0.3 or higher.

For instance, Oracle Database - Installation of 11gR1/R2 on Windows

Advertising

3.2 - Shared Pool Size

Minimum 100 Mo of Shared Pool Size

SQL> SHOW PARAMETER SHARED_POOL_SIZE

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
shared_pool_size                     big integer 0
SQL> ALTER SYSTEM SET SHARED_POOL_SIZE='100M' SCOPE=spfile;

System altered.

SQL> SHUTDOWN
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP
ORACLE instance started.

Total System Global Area  778387456 bytes
Fixed Size                  1374808 bytes
Variable Size             486540712 bytes
Database Buffers          285212672 bytes
Redo Buffers                5259264 bytes
Database mounted.
Database opened.
SQL> SHOW PARAMETER SHARED_POOL_SIZE

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
shared_pool_size                     big integer 104M

3.3 - Download

4 - Steps

4.1 - Disable password complexity for the default profile

Disable any existing password complexity rules for the default profile.

SQL> @?/rdbms/admin/undopwd.sql
 
Profile altered.

where the script undopwd.sql undo the default password security settings from Oracle Database 11g

You can run the secconf.sql script to apply the Release 11g default password settings.

A profile is a collection of parameters that sets limits on database resources. If you assign the profile to a user, then that user cannot exceed these limits. You can use profiles to configure database settings such as sessions per user, logging and tracing features, and so on. Profiles can also control user passwords. To find information about the current password settings in the profile, you can query the DBA_PROFILES data dictionary view.

SQL> SELECT RESOURCE_NAME, LIMIT FROM DBA_PROFILES
  2  WHERE profile = 'DEFAULT' AND resource_type = 'PASSWORD';
 
RESOURCE_NAME                    LIMIT
-------------------------------- --------------------------------
FAILED_LOGIN_ATTEMPTS            10
PASSWORD_LIFE_TIME               UNLIMITED
PASSWORD_REUSE_TIME              UNLIMITED
PASSWORD_REUSE_MAX               UNLIMITED
PASSWORD_VERIFY_FUNCTION         NULL
PASSWORD_LOCK_TIME               UNLIMITED
PASSWORD_GRACE_TIME              UNLIMITED
 
7 ROWS selected.
Advertising

4.2 - Install Oracle Application Express

Oracle Application Express must be installed from a writable directory on the file system

Code Syntax:

@script tablespace_apex tablespace_files tablespace_temp images

Where:

  • script is apexins.sql for a full environment or apxrtins.sql for a runtime environment
  • tablespace_apex is the name of the tablespace for the Oracle Application Express application user.
  • tablespace_files is the name of the tablespace for the Oracle Application Express files user.
  • tablespace_temp is the name of the temporary tablespace.
  • Images is the virtual directory for Oracle Application Express images. To support future Oracle Application Express upgrades, define the virtual image directory as /i/.

A Full development environment provides complete access to the Application Builder environment to develop applications. A Runtime environment enables users to run applications that cannot be modified.

Example for a full development environment

C:\temp\apex_4.0.2\apex>sqlplus / AS sysdba
 
SQL*Plus: Release 11.2.0.1.0 Production ON Thu Jun 9 11:52:34 2011
 
Copyright (c) 1982, 2010, Oracle.  ALL rights reserved.
 
 
Connected TO:
Oracle DATABASE 11g Enterprise Edition Release 11.2.0.1.0 - Production
WITH the Partitioning, OLAP, DATA Mining AND REAL Application Testing options
 
SQL> @apexins SYSAUX SYSAUX TEMP /i/
Thank you for installing Oracle Application Express.

Oracle Application Express is installed in the APEX_040000 schema.

The structure of the link to the Application Express administration services is as follows:
http://host:port/pls/apex/apex_admin (Oracle HTTP Server with mod_plsql)
http://host:port/apex/apex_admin     (Oracle XML DB HTTP listener with the embedded PL/SQL gateway)

The structure of the link to the Application Express development interface is as follows:
http://host:port/pls/apex (Oracle HTTP Server with mod_plsql)
http://host:port/apex     (Oracle XML DB HTTP listener with the embedded PL/SQL gateway)
Advertising

4.3 - Account

When Oracle Application Express installs it creates three new database accounts:

  • APEX_040000 - The account that owns the Oracle Application Express schema and metadata.
  • FLOWS_FILES - The account that owns the Oracle Application Express uploaded files.
  • APEX_PUBLIC_USER - The minimally privileged account used for Oracle Application Express configuration with Oracle HTTP Server and mod_plsql or Oracle Application Express Listener.

If you are upgrading from a previous release, FLOWS_FILES, already exists and APEX_PUBLIC_USER is created if it does not already exist.

4.4 - Change the Password for the ADMIN Account

C:\temp\apex_4.0.2\apex>sqlplus / AS sysdba
SQL> @apxchpwd
Enter a VALUE below FOR the password FOR the Application Express ADMIN USER.
Enter a password FOR the ADMIN USER              []
SESSION altered.
...changing password FOR ADMIN
PL/SQL PROCEDURE successfully completed.
Commit complete.

4.5 - Restart the process

After you install Oracle Application Express, you must restart the processes that you stopped before you began the installation, such as listener and other processes.

4.6 - Configure APEX_PUBLIC_USER Account

SQL> ALTER USER APEX_PUBLIC_USER ACCOUNT UNLOCK;
USER altered.
 
SQL> ALTER USER APEX_PUBLIC_USER IDENTIFIED BY pwd;
USER altered.
  • Where pwd is the new password you are setting for APEX_PUBLIC_USER. You will use this password when creating the DAD

In the default profile in Oracle Database 11g, the parameter PASSWORD_LIFE_TIME is set to 180. If you are using Oracle Database 11g with Oracle Application Express, this causes the password for APEX_PUBLIC_USER to expire in 180 days. As a result, your Oracle Application Express instance will become unusable until you change the password.

To prevent this behavior, create another profile in which the PASSWORD_LIFE_TIME parameter is set to unlimited and alter the APEX_PUBLIC_USER account and assign it the new profile.

4.7 - Download and Install Oracle Application Express Listener

the Installation Guide and follow instructions to complete installation and configuration steps is in the zip file

Oracle Application Express Listener can be installed:

  • standalone
  • with Oracle WebLogic Server
  • with Oracle GlassFish Server
  • with Oracle Containers for J2EE (OC4J)

4.7.1 - Standalone

C:\app\apex_listener>"%ProgramFiles%\Java\jre6\bin\java" -jar apex.war
INFO: Starting: C:\app\apex_listener\apex.war
 See: 'java -jar apex.war --help' for full range of configuration options
INFO: Extracting to: C:\Users\gerard\AppData\Local\Temp\apex
Enter the path to the directory containing the APEX static resources
          Example:  /Users/myuser/apex/images
         or press Enter to skip: C:\app\apex\images
INFO: Using classpath: file:/C:/Users/gerard/AppData/Local/Temp/apex/apex/____em
bedded/start.jar:file:/C:/Users/gerard/AppData/Local/Temp/apex/apex/WEB-INF/lib/
apex.jar:file:/C:/Users/gerard/AppData/Local/Temp/apex/apex/WEB-INF/lib/commons-
fileupload-1.2.1.jar:file:/C:/Users/gerard/AppData/Local/Temp/apex/apex/WEB-INF/
lib/je-4.0.103.jar:file:/C:/Users/gerard/AppData/Local/Temp/apex/apex/WEB-INF/li
b/ojdbc6.jar:file:/C:/Users/gerard/AppData/Local/Temp/apex/apex/WEB-INF/lib/ojmi
sc.jar:file:/C:/Users/gerard/AppData/Local/Temp/apex/apex/WEB-INF/lib/poi-3.6-20
091214.jar:file:/C:/Users/gerard/AppData/Local/Temp/apex/apex/WEB-INF/lib/ucp.ja
r:file:/C:/Users/gerard/AppData/Local/Temp/apex/apex/WEB-INF/lib/xdb-11.2.0.jar:
file:/C:/Users/gerard/AppData/Local/Temp/apex/apex/WEB-INF/lib/xmlparserv2-11.2.
0.jar:
INFO: Starting Embedded Web Container in: C:\Users\gerard\AppData\Local\Temp\ape
x
Enter a username for the APEX Listener Administrator [adminlistener]: admin
Enter a password for admin:
Confirm password for admin:
Enter a username for the APEX Listener Manager [managerlistener]: manager
Enter a password for manager:
Confirm password for manager:
9-jun-2011 14:01:13 ____bootstrap.Deployer deploy
INFO: Will deploy application path=C:\Users\gerard\AppData\Local\Temp\apex\apex\
WEB-INF\web.xml
9-jun-2011 14:01:14 ____bootstrap.Deployer deploy
INFO: deployed application path=C:\Users\gerard\AppData\Local\Temp\apex\apex\WEB
-INF\web.xml
Using config file: C:\Users\gerard\AppData\Local\Temp\apex\apex-config.xml
APEX Listener version : 1.1.2.131.15.23
APEX Listener server info: Grizzly/1.9.18-o
9-jun-2011 14:01:15 com.sun.grizzly.Controller logVersion
INFO: Starting Grizzly Framework 1.9.18-o - Thu Jun 09 14:01:15 CEST 2011
INFO: Please complete configuration at: http://localhost:8080/apex/listenerConfigure
Database connection not yet configured

Password: pwd

Example:

"%ProgramFiles%\Java\jre6\bin\java" -Dapex.home=C:\temp\apex -Dapex.images=C:\app\apex\images -Dapex.port=8080 -Dapex.erase -jar apex.war

Specifying the options above produces the following results:

  • Erase the contents of C:\temp\apex.
  • Extract the runtime files to C:\temp\apex.
  • Configure the runtime to listen on HTTP port 8080.
  • Use the contents of C:\app\apex\images for serving the static content required by Oracle Application Express.

To display a full list of available commands, execute the following command:

java –jar apex.war --help

4.7.2 - Oc4j

4.7.2.1 - Create the user and group
  • Copy the directory content from <apex directory>/images to <oc4j install directory>/j2ee/home/default-web-app/i/
  • Start the OC4J Server
  • Start the application server console (aka Enterprise Manager) http://localhost:8888/em or http://localhost:9704/em for OBI
  • Administration > Security Providers and click the Go To Task > Instance Level Security > Realms
  • Use an existing realm or create a realm
  • Add the role Admin and Manager
  • Add the user adminlistener (role admin) and managerlistenr (role manager)
4.7.2.2 - Deploy
  • Name > Apex
  • Deployment Settings > Configure Class Loading page > Deselect the Inherit parent application's shared library imports check box.
  • Deploy
  • Verify that apex is listed on the Applications page and the Status displays a green up-arrow indicating that it is Active.

4.7.3 - Listener Configuration

4.8 - Apex Connection

4.9 - Post Installation Task

4.9.1 - Enable Network Services in Oracle Database 11g

By default, the ability to interact with network services is disabled in Oracle Database 11g release 1 or 2.

Therefore, if you are running Oracle Application Express with Oracle Database 11g release 1 or 2, you must use the new DBMS_NETWORK_ACL_ADMIN package to grant connect privileges to any host for the APEX_040000 database user. Failing to grant these privileges results in issues with:

  • Sending outbound mail in Oracle Application Express.
  • Users can call methods from the APEX_MAIL package, but issues arise when sending outbound email.
  • Using Web services in Oracle Application Express.
  • PDF/report printing.
  • Searching for content in online Help (that is, using the Find link).

See the section 3.3.7 Enable Network Services in Oracle Database 11g to find the scripts to run.

The following example demonstrates how to grant connect privileges to any host for the APEX_040000 database user. This example assumes you connected to the database where Oracle Application Express is installed as SYS specifying the SYSDBA role.

DECLARE
  ACL_PATH  VARCHAR2(4000);
  ACL_ID    RAW(16);
BEGIN
  -- Look for the ACL currently assigned to '*' and give APEX_040000
  -- the "connect" privilege if APEX_040000 does not have the privilege yet.
 
  SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS
   WHERE HOST = '*' AND LOWER_PORT IS NULL AND UPPER_PORT IS NULL;
 
  -- Before checking the privilege, ensure that the ACL is valid
  -- (for example, does not contain stale references to dropped users).
  -- If it does, the following exception will be raised:
  --
  -- ORA-44416: Invalid ACL: Unresolved principal 'APEX_040000'
  -- ORA-06512: at "XDB.DBMS_XDBZ", line ...
  --
  SELECT SYS_OP_R2O(EXTRACTVALUE(P.RES, '/Resource/XMLRef')) INTO ACL_ID
    FROM XDB.XDB$ACL A, PATH_VIEW P
   WHERE EXTRACTVALUE(P.RES, '/Resource/XMLRef') = REF(A) AND
         EQUALS_PATH(P.RES, ACL_PATH) = 1;
 
  DBMS_XDBZ.ValidateACL(ACL_ID);
   IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, 'APEX_040000', 
     'connect') IS NULL THEN 
      DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH, 
     'APEX_040000', TRUE, 'connect'); 
  END IF;
 
EXCEPTION
  -- When no ACL has been assigned to '*'.
  WHEN NO_DATA_FOUND THEN
  DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('power_users.xml',
    'ACL that lets power users to connect to everywhere',
    'APEX_040000', TRUE, 'connect');
  DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('power_users.xml','*');
END;
/
COMMIT;

5 - Support

5.1 - java.lang.NoClassDefFoundError: ûjar

C:\app\apex_listener>java -jar apex.war
Exception in thread "main" java.lang.NoClassDefFoundError: ûjar
Caused by: java.lang.ClassNotFoundException: ûjar
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: ÔÇôjar.  Program will exit.

Solution:

C:\app\apex_listener>"%ProgramFiles%\Java\jre6\bin\java" -jar apex.war

6 - Documentation / Reference