Installing APEX5 with ORDS3 on Apache-Tomcat

By | August 15, 2015
I was facing few problems like 404 page not found etc. so after going through the documentation and OTN forum I finally succeeded in setting up the Oracle XE+ Apex 5 + ORDS 3+Tomcat on my laptop. I thought of sharing it to everyone.

I assume that you have installation files of following with you.
  • Oracle XE 11g installation files
  • APEX 5.0.1 zip file
  • ORDS 3.0.1.177.18.02.zip
  • apache-tomcat-8.0.22.zip
  • Java Run time 

Here are the different directory/ paths that I have used, in case you have a different path for any installation make changes accordingly
.
  • Oracle XE – c:oralexe
  • APEX set up files – C:Toolsapex501

Step 1 – Install Oracle XE

I am not going through the installation of Oracle XE, the only thing you need to know is system password.
For sqlplus – in most cases you can also log in as sysdba without password in sqlplus using “/ as sysdba”

Step 2 – Install APEX

  1. Unzip the apex_5.0.1_en.zip file in C:Toolsapex501
  2. Go to command prompt, Change directory to C:Toolsapex501
  3. Log on to database using sqlplus as sysdba
  4. Create necessary Table spaces using following commands
    CREATE TABLESPACE APEX DATAFILE ‘C:oraclexeapporacleoradataXEAPEX.DBF’ SIZE 1200M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;

    CREATE TABLESPACE APEX_FILES DATAFILE ‘C:oraclexeapporacleoradataXEAPEX_FILES.DBF’ SIZE 300M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
  5.            Finally start the apex installation using 
@apexins APEX APEX_FILES temp /i/
The installation will take 15 minutes to 30 minutes depending on your PC configuration. Make sure that you see these lines finally, if you see this means your APEX installation was successful.
Session altered.
timing for: Complete Installation
Elapsed: 00:12:36.80
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
1 row selected.
Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 – Production

Step 3 Install JRE

Install JRE and note down the path. On my laptop it is
C:Program Files (x86)Javajre1.8.0_45binjava.exe

Step 4 Install Apache Tomcat server

Download latest version, I am using apache-tomcat-8.0.22.exe as of this writing. When you run the
Set-up make sure to use “Run as administrator” option.
1.       On Welcome screen click next
2.       Next screen is about the license agreement, click on “I Agree” button
3.       On the “Choose Options” button, again there is no need to change any selections so just click next button.
4.       The next screen is configuration. Here you need to specify the ports, the HTTP port is where the apex will be configured, I have used 8180 it was used by some other server on my laptop but you can use default 8080 if there is no conflict.

Also enter user administrator name in user name box and set password, make sure to note it down so you don’t end up missing it. Once done click next.
5.       The next screen is “Java Virtual Machine”. Apache set up will look for Java Virtual machine, most probably it will detect the java and populate the path properly, if not then refer step 3, and enter the java home like this  
C:Program Files (x86)Javajre1.8.0_45
Then click next.
6.       Next screen is “Choose Install Location”, no change needed. So click next.
7.   Click on install, finally you will see the “completing wizard” screen like this.
Keep the “Run Apache Tomcat” selected and click Finish.
Tomcat server will now start showing the start  progress.
When it is complete you will see the icon in the taskbar like this.
Check if the server is running, open browser and point to locahost:8180 , if you get following page then it means all is fine. 

Step 5 Prerequisites before setting up ORDS

Login in into database using system as sysdba
  
1.       EXEC DBMS_XDB.SETHTTPPORT(0);
Confirm if this is 0.
SELECT DBMS_XDB.GETHTTPPORT FROM DUAL;
2.       Unlock APEX_PUBLIC_USER account and set the new password
ALTER USER APEX_PUBLIC_USER ACCOUNT UNLOCK;
ALTER USER APEX_PUBLIC_USER identified by secret;
ALTER USER APEX_PUBLIC_USER identified by secret;
3.       Unlock APEX_REST_PUBLIC_USER  and set the password
ALTER USER APEX_REST_PUBLIC_USER ACCOUNT UNLOCK;
ALTER user APEX_REST_PUBLIC_USER identified by secret;

Step 6 ORDS Configuration.

1.   Extract the ORDS zip file in C:ToolsORDS
2.   Make a directory to hold the configuration. If you have any failures during the installation, remember to delete the contents of this directory before trying again.
C:ToolsORDS-Config
3.   Edit the following file
C:ToolsORDSparamsords_params.properties
And add following entries, please change according to your set up but if you are using default set up then this should be same. If required changed according to your set up.
db.hostname=localhost
db.port=1521
db.servicename=XE
db.sid=
db.username=APEX_PUBLIC_USER
migrate.apex.rest=false
rest.services.apex.add=
rest.services.ords.add=true
schema.tablespace.default=APEX
schema.tablespace.temp=TEMP
standalone.http.port=8180
standalone.static.images=
user.tablespace.default=USERS
user.tablespace.temp=TEMP

   Then set up the config directory using following command,

Note : For following command your Firewall might intervene

“C:Program Files (x86)Javajre1.8.0_45binjava.exe” -jar C:ToolsORDSORDS.war configdir C:ToolsORDS-Config
The above command will end with this message
INFO: Set config.dir to C:ToolsORDS-Config in: C:ToolsORDSords.war

     Configure ORDS using the following command.


 For simplicity in all the steps below wherever a password is asked , I have entered secret, you can use different passwords if you wish to and yes this is not recommended for production.
“C:Program Files (x86)Javajre1.8.0_45binjava.exe” -jar C:ToolsORDSORDS.war
Enter the database password for ORDS_PUBLIC_USER: secret
Confirm password:secret
Enter 1 if you want to use PL/SQL Gateway or 2 to skip this step [1]:1
Enter the database password for APEX_PUBLIC_USER:secret
Confirm password:secret

Enter 1 to specify passwords for Application Express RESTful Services database users (APEX_LISTENER, APEX_REST_PUBLIC_USER) or 2 to skip this step [1]:1
Enter the database password for APEX_LISTENER:secret
Confirm password:secret
Enter the database password for APEX_REST_PUBLIC_USER:secret
Confirm password:secret
Aug 14, 2015 9:06:30 PM oracle.dbtools.common.config.file.ConfigurationFilesBase update
INFO: Updated configurations: defaults, apex, apex_pu, apex_al, apex_rt
Aug 14, 2015 9:06:30 PM oracle.dbtools.rt.config.setup.SchemaSetup install
INFO: Oracle REST Data Services schema version 3.0.1.177.18.02
Enter 1 if you wish to start in standalone mode or 2 to exit [1]:2

Step 7 Deploy the war file to tomcat server.

Copy Ords.war file to C:Program FilesApache Software FoundationTomcat 8.0webapps
Once you copy the war file, Tomcat will expand it and create ords folder in webapss. There is no action for you but this is something you need to know, in case anything goes wrong in future as a clean-up you can delete it.

Step 8- Copy Images folder.

Copy content of imgaes folder
C:Toolsapex501images
to C:Program FilesApache Software FoundationTomcat 8.0webappsi folder. ( Note the folder name is “i”)

Step 9 Check the instance is running.

Go to localhost:8180/ords/apex

Step 10 Reset the admin password.

  1. Goto command prompt and change folder to  C:Toolsapex501
  2. log in to oracle as sysdba
  3. type @apxchpwd.sql and hit enter , enter the new password as directed.
  4. Go to http://localhost:8180/ords/apex_admin
  5. Enter user name and password.

You are into APEX as an instance administrator, create workspaces and users as required.
Happy APEXing !

4 thoughts on “Installing APEX5 with ORDS3 on Apache-Tomcat

  1. Vitek

    Hi,

    great tut.
    I had to run in addition apex_rest_config.sql, cause user APEX_REST_PUBLIC_USER was not created. Is that missing in the tutorial, or did I miss anything?

    Thanks
    Vitek

    Reply
  2. JJ

    @vitek: Yes, you need to run apex_rest_config.sql separately. You didn't miss anything.

    Reply
  3. bbmm7th

    hey thanks for the instructions, they're a nice addendum to the docs, for sure!

    Have a question though:
    When I go to the APEX url (http://machine:port/ords/) I'm getting this message:

    There are issues with the configuration of the Static Files in your environment. Please consult the "Configuring Static File Support" section in the Application Express Installation Guide.

    I can click past the message and get in to APEX.

    I've gone through those docs a bunch – I have REST installed and active. Just to make sure the REST DB ids are ok, I reset their passwords like so:
    Java -jar ords.war user APEX_LISTENER
    Java -jar ords.war user APEX_REST_PUBLIC_USER

    also, via the APEX Admin login, Manage Instance, Security
    I've set RESTful access= Yes.

    ..and yet I still get that "Static file" message. Any thoughts?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *