10 Replies Latest reply on Jun 27, 2015 7:58 PM by GregoryG.

    Apex 5 with EPG - The server requires a username and password

    John_K

      Hi,

      I have set up the latest version of Apex 5 on a Oracle 12.1.0.2.0 64bit Database (Linux 86x64), inside a single pluggable database only (pdbdev). Here are the steps I performed.


      1) Removed the existing APEX 4 installation from the container and all PDB's. I believe this isn't strictly necessary but I did so anyway just in case. I also tried without doing this and it was the same.

      2) Downloaded Apex 5, unzipped and copied to $ORACLE_HOME.

      3) Created an apex tablespace.

      4) Ran the installer from inside my PDB container -all went ok. Command: @apexins apex apex temp /i/

      5) Followed the steps for using the embedded pl/sql gateway (ran apex_epg_config.sql). Command: @apex_epg_config $ORACLE_HOME - All this went ok - no errors reported. Have also tried this with $ORACLE_HOMe typed explicitly but to no avail.

      6) Set the HTTP port to 8080 and unlocked the ANONYMOUS account.

      7) Performed this step from the config guide: Granting Connect Privileges in Oracle Database 12c

      8) Changed job queue processes

      9) Bounced the entire instance (i.e. not just the listener, but restarted the whole box).


      However whenever I go to http://myserver:8080/apex" I get a prompt asking for a username and password :


      "The server xxx requires a username and password. The server says: XDB".


      Clicking cancel yields a 401 - Unauthorized error.


      So I've tried a whole host of different suggestions I've found in other forum posts and on metalink but to no avail. I've tried:

      * Unlocking the XDB user

      * Re-running the apex_epg_config.sql script

      * Changing the xdb port to something else

      * Note 1581364.1 - Verified that the we have the correct ACL"

      * Trying the whole thing again from scratch

      * ANONYMOUS account was expired so on one instance I unexpired this using the existing password.

       

      Here is my output from epgstat:

      SQL> @$ORACLE_HOME/rdbms/admin/epgstat
      +--------------------------------------+
      | XDB protocol ports:                  |
      |  XDB is listening for the protocol   |
      |  when the protocol port is non-zero. |
      +--------------------------------------+
      
      HTTP Port FTP Port
      --------- --------
           8080        0
      
      1 row selected.
      
      +---------------------------+
      | DAD virtual-path mappings |
      +---------------------------+
      
      Virtual Path                     DAD Name
      -------------------------------- --------------------------------
      /apex/*                          APEX
      
      1 row selected.
      
      +----------------+
      | DAD attributes |
      +----------------+
      
      DAD Name     DAD Param                DAD Value
      ------------ ------------------------ ----------------------------------------
      APEX         database-username        ANONYMOUS
                   default-page             apex
                   document-table-name      wwv_flow_file_objects$
                   request-validation-funct wwv_flow_epg_include_modules.authorize
                   ion
      
                   path-alias-procedure     wwv_flow.resolve_friendly_url
                   nls-language             american_america.al32utf8
                   path-alias               r
      
      7 rows selected.
      
      +---------------------------------------------------+
      | DAD authorization:                                |
      |  To use static authentication of a user in a DAD, |
      |  the DAD must be authorized for the user.         |
      +---------------------------------------------------+
      
      no rows selected
      
      +----------------------------+
      | DAD authentication schemes |
      +----------------------------+
      
      DAD Name             User Name                        Auth Scheme
      -------------------- -------------------------------- ------------------
      APEX                 ANONYMOUS                        Anonymous
      
      1 row selected.
      
      +--------------------------------------------------------+
      | ANONYMOUS user status:                                 |
      |  To use static or anonymous authentication in any DAD, |
      |  the ANONYMOUS account must be unlocked.               |
      +--------------------------------------------------------+
      
      Database User   Status
      --------------- --------------------
      ANONYMOUS       OPEN
      
      1 row selected.
      
      +-------------------------------------------------------------------+
      | ANONYMOUS access to XDB repository:                               |
      |  To allow public access to XDB repository without authentication, |
      |  ANONYMOUS access to the repository must be allowed.              |
      +-------------------------------------------------------------------+
      
      Allow repository anonymous access?
      ----------------------------------
      true
      
      1 row selected.
      
      SQL>

      And here is the output from the listener:

      oracle@slax:~$ lsnrctl status
      
      LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 07-MAY-2015 07:52:48
      
      Copyright (c) 1991, 2014, Oracle.  All rights reserved.
      
      Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
      STATUS of the LISTENER
      ------------------------
      Alias                     LISTENER
      Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
      Start Date                07-MAY-2015 07:48:04
      Uptime                    0 days 0 hr. 4 min. 43 sec
      Trace Level               off
      Security                  ON: Local OS Authentication
      SNMP                      OFF
      Listener Parameter File   /opt/oracle/app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
      Listener Log File         /opt/oracle/app/oracle/diag/tnslsnr/slax/listener/alert/log.xml
      Listening Endpoints Summary...
        (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=slax.slaxdomain)(PORT=1521)))
        (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
        (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=slax.slaxdomain)(PORT=8080))(Presentation=HTTP)(Session=RAW))
      Services Summary...
      Service "orcl" has 1 instance(s).
        Instance "orcl", status READY, has 1 handler(s) for this service...
      Service "orclXDB" has 1 instance(s).
        Instance "orcl", status READY, has 1 handler(s) for this service...
      Service "pdbdev" has 1 instance(s).
        Instance "orcl", status READY, has 1 handler(s) for this service...
      The command completed successfully
      

      My system setup isn't anything complicated - it's simply a single linux 64 bit machine with a 12c database installed. Nothing complicated on the network (load balancers, proxy etc), just a single internal network.

       

      I get the unauthorized message when trying to connect via either another machine on the network on locally on the server.

      oracle@slax:~$ wget http://localhost:8080/apex
      --2015-05-07 07:55:22--  http://localhost:8080/apex
      Resolving localhost (localhost)... 127.0.0.1
      Connecting to localhost (localhost)|127.0.0.1|:8080... connected.
      HTTP request sent, awaiting response... 401 Unauthorized
      Authorization failed.
      

       

      Any help would be greatly appreciated.

       

      John

        • 1. Re: Apex 5 with EPG - The server requires a username and password
          Kiran Pawar

          Hi ORA-01033,

           

               The reason for this issue are listed by Jason Straub in the following thread:

               Refer : Re: Apex installation ( 4.2.2 on 12c )

           

          Regards,

          Kiran

          • 2. Re: Apex 5 with EPG - The server requires a username and password
            John_K

            Hi,

            Thanks, however I believe I have done all of the things listed correctly?

             

            1. EPG was not configured properly - I ran apex_epg_config.sql which reported it had finished successfully and without any errors. epgstat.sql shows everything seems to be ok.
            2. ANONYMOUS is not unlocked - I unlocked the account - epgstat.sql verifies this.
            3. Images have not been loaded properly - epg_config.sql loads images - I ran it and it completed with no errors. I have run verification scripts that I found online which show the images are loaded.

             

            I notice the post says this:

             

            Yes, it is mandatory in this case, and that is because you ran apxremov_con.sql prior to installation 4.2.2 into the CDB. apxremov_con.sql (which calls apxremov.sql) will also remove the /apex "DAD" from EPG. Since /apex is no longer known to EPG after running apxremov_con.sql, you need to run apex_epg_config_con.sql to restore it.

            However that script doesn't exist in APEX 5. I tried running apex_epg_config_cdb.sql instead however it fails with:

            SQL> @apex_epg_config_cdb.sql
            
            PL/SQL procedure successfully completed.
            
            Performing installation in multitenant container database in the background.
            The installation progress is spooled into apex_epg_config_cdb*.log files.
            
            Please wait...
            
            /bin/bash: ^OH_HOME/perl/bin/perl: No such file or directory
            
            • 3. Re: Apex 5 with EPG - The server requires a username and password
              Kiran Pawar

              Hi ORA-01033,

              ORA-01033 wrote:

               

              Hi,

              Thanks, however I believe I have done all of the things listed correctly?

               

              1. EPG was not configured properly - I ran apex_epg_config.sql which reported it had finished successfully and without any errors. epgstat.sql shows everything seems to be ok.
              2. ANONYMOUS is not unlocked - I unlocked the account - epgstat.sql verifies this.
              3. Images have not been loaded properly - epg_config.sql loads images - I ran it and it completed with no errors. I have run verification scripts that I found online which show the images are loaded.

               

              I notice the post says this:

               

              Yes, it is mandatory in this case, and that is because you ran apxremov_con.sql prior to installation 4.2.2 into the CDB. apxremov_con.sql (which calls apxremov.sql) will also remove the /apex "DAD" from EPG. Since /apex is no longer known to EPG after running apxremov_con.sql, you need to run apex_epg_config_con.sql to restore it.

              However that script doesn't exist in APEX 5. I tried running apex_epg_config_cdb.sql instead however it fails with:

              SQL> @apex_epg_config_cdb.sql
              
              PL/SQL procedure successfully completed.
              
              Performing installation in multitenant container database in the background.
              The installation progress is spooled into apex_epg_config_cdb*.log files.
              
              Please wait...
              
              /bin/bash: ^OH_HOME/perl/bin/perl: No such file or directory
              

                   There are two types of APEX installations in 12c, CDB-Based and PDB-Based. As you have done proper PDB-Based installation the running of apex_epg_config_cdb.sql is unnecessary/not required.

                   As your's is a PDB based installation, and when you restart Oracle DB 12c instance, PDB's by default are not up, so check whether your PDB is in READ WRITE state. Refer : Re: Installing Oracle Application Express on a PDB in 12c

                   Also there may be privilege issue with ANONYMOUS user.

               

              Regards,

              Kiran

              • 4. Re: Re: Apex 5 with EPG - The server requires a username and password
                Kiran Pawar

                Hi ORA-01033,

                ORA-01033 wrote:

                 

                However that script doesn't exist in APEX 5. I tried running apex_epg_config_cdb.sql instead however it fails

                    Because in APEX 5.0 installables they have removed the *_con.sql scripts and replaced with normal script names which used to be earlier.

                    So, your question would be which scripts should be run to when going for CDB Based installation?

                    The answer is the same scripts apexins.sql/apex_epg_config.sql scripts work for both CDB and PDB. Prohibit from running of _cdb.sql scripts as they are not documented in the installation guide for APEX 5.0. The scripts in APEX 5.0, i think automatically detects the database version and if 12c they also detect the container from which they are run and do the configurations accordingly.

                    The *_con.sql scripts you will find in APEX 4.2 installables which were meant for root container.

                 

                Regards,

                Kiran

                • 5. Re: Apex 5 with EPG - The server requires a username and password
                  John_K

                  Hi,

                  Yes, all PDB's are open. This is a test machine, so my startup script starts the database, opens all pluggable databases (there's only one) and starts the listener.

                   

                  I've also tried "GRANT CREATE SESSION TO ANONYMOUS" as per the permissions issue post, however that hasn't worked.

                  • 6. Re: Apex 5 with EPG - The server requires a username and password
                    John_K

                    One thing I did notice, if I revert my machine back to post-12c install (i.e. before doing any APEX config) and then attempt to install APEX in the PDB without removing the APEX 4 install from the CDB, it runs as if it's in the CDB! However I'm definitely connected to the PDB.

                    oracle@slax:~/app/oracle/product/12.1.0/dbhome_1/apex$ pwd
                    /opt/oracle/app/oracle/product/12.1.0/dbhome_1/apex
                    oracle@slax:~/app/oracle/product/12.1.0/dbhome_1/apex$ sqlplus / as sysdba
                    
                    SQL*Plus: Release 12.1.0.2.0 Production on Thu May 7 10:09:21 2015
                    
                    Copyright (c) 1982, 2014, Oracle.  All rights reserved.
                    
                    
                    Connected to:
                    Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
                    With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
                    
                    SQL> alter session set container=pdbdev;
                    
                    Session altered.
                    
                    SQL> create tablespace apex datafile 'apex.dbf' size 100M autoextend on next 1M;
                    
                    Tablespace created.
                    
                    SQL> @apexins apex apex temp /i/
                    
                    PL/SQL procedure successfully completed.
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    PL/SQL procedure successfully completed.
                    
                    
                    
                    
                    
                    
                    PL/SQL procedure successfully completed.
                    
                    
                    Session altered.
                    
                    
                    FOO3
                    ------------------------------
                    install2015-05-07_10-15-03.log
                    
                    . ORACLE
                    .
                    . Application Express (APEX) Installation.
                    ..........................................
                    .
                    ... Checking prerequisites (MANUAL)
                    .
                    
                    PL/SQL procedure successfully completed.
                    
                    
                    PL/SQL procedure successfully completed.
                    
                    
                    PL/SQL procedure successfully completed.
                    
                    
                    PL/SQL procedure successfully completed.
                    
                    
                    PL/SQL procedure successfully completed.
                    
                    
                    PL/SQL procedure successfully completed.
                    
                    .
                    ... Prerequisite checks passed.
                    .
                    Performing installation in multitenant container database in the background.
                    The installation progress is spooled into apexins_cdb*.log files.
                    
                    Please wait...
                    
                    catcon: ALL catcon-related output will be written to coreins_catcon_1117.lst
                    catcon: See coreins*.log files for output generated by scripts
                    catcon: See coreins_*.lst files for spool files, if any
                    A process terminated prior to completion.
                        Review the coreins*.log files to identify the failure
                    Died at /opt/oracle/app/oracle/product/12.1.0/dbhome_1/rdbms/admin/catcon.pm line 6149.
                    
                    

                    SO - it fails with a load of various issues, however why does it try to run in container mode in the frst place?
                    This was attempting the install on a completely vanilla 12c install.

                    • 7. Re: Apex 5 with EPG - The server requires a username and password
                      John_K

                      I have just tried doing the install again, exactly the same steps, but within the container database, and it works perfectly. ???

                      • 8. Re: Apex 5 with EPG - The server requires a username and password
                        Kiran Pawar

                        Hi ORA-01033,

                        ORA-01033 wrote:

                         

                        I have just tried doing the install again, exactly the same steps, but within the container database, and it works perfectly. ???

                             Yes, it will work as it is mentioned in the Application Express Installation Guide for APEX 5.0 here:

                             http://docs.oracle.com/cd/E59726_01/install.50/e39144/db_pluggable.htm#HTMIG29327

                             For installing APEX locally in a PDB, you have to uninstall it from CDB (using apxremov.sql) and run the installation script viz. apexins.sql in PDB.

                             And for reverting back to CDB, you have to connect to root container and run the installation script viz. apexins.sql.

                         

                             Well, I have PDB based APEX 5.0 installation running on EPG and in another PDB, I have APEX 4.2.6 running on ORDS.

                             For APEX installation choices in Oracle 12c refer the following documentation:

                         

                        Regards,

                        Kiran

                        • 9. Re: Apex 5 with EPG - The server requires a username and password
                          John_K

                          Thanks, I've been through the documentation and as far as I can see I've following everything as I should to install only in the PDB?

                           

                          - Uninstall the existing version from the CDB

                          - Install into the PDB

                          - Perform the epg setup from within the PDB (setting http port etc)

                           

                          Do I need to configure the DAD then as removing it from the container removes the DAD entry but then installing back into a PDB doesn't put it back in?

                           

                          Regards

                          • 10. Re: Apex 5 with EPG - The server requires a username and password
                            GregoryG.

                            Hello, I've hit the same issue, i.e. "Died at ...admin/catcon.pm line 6149". After reviewing the log in detail, the reason was due to bug/patch 20618595 (as written in the installation documentation). I've removed APEX, installed the patch and reinstall APEX in the PDB and it has been working just fine. Best Regards, Gregory