Thursday, December 8, 2011

APEX Using Tomcat 7 & DPLS(mod_plsql)


Oracle Application Express (APEX) Using Tomcat 7 & DPLS (mod_plsql. This is done on linux x86-64 platform.


I am going to discuss methods for using APEX. This can be useful for all mod_plsql applications. I have discussed in detail for DPLS and tomcat7. Please refer that here -http://modplsql.blogspot.com/


Steps:


1- Please download and install JDK6 - http://www.oracle.com/technetwork/java/javase/downloads/index.html


2-Please download and install tomcat7 as oper the URL provided above


3- Please download the dpls.war and deploy in the tomcat7 as per the URL provided above.


4- cd  $CATALINA_HOME/webapps/dpls/WEB-INF  and edit the prism.xconf  as indicated below:


Variable section at the top:


     <variable name="demo.db" value="jdbc:oracle:thin:@amghost2.cup.com:1521:soa"/>


Now go to DAD_APEX and change following:


    <category name="DAD_apex">
    <property name="dbusername" value="APEX_PUBLIC_USER"/>
    <property name="dbpassword" value="apex11g"/>


5- copy ojdbc6.jar to $CATALINA_HOME/lib and $CATALINA_HOME/webapps/dpls/WEB-INF/lib


6- Restart the tomcat and try following URLS ( You can restart the DPLS apps from the tomcat management as an other option):


7- Make sure the APEX users in the 11g DB where it comes with APEX install - has ACL and account acess. Well, it does not hurt running following:


USERS:

SQL> alter user APEX_PUBLIC_USER account unlock;


User altered.


SQL> alter user ANONYMOUS account unlock;


User altered.


SQL> alter user ANONYMOUS identified by apex11g;


User altered.


SQL> alter user APEX_PUBLIC_USER identified by apex11g;


User altered.




SQL> select owa_util.get_version from dual;  ## It will return the version - if so you are all good. If not then something is wrong and follow the URL for APEX install and Upgrade here - http://apexdplsepg.blogspot.com/2011/12/install-upgrade.html




SQL> @apxchpwd.sql   ## Will change password for the apex admin user  atemporary password that you will then change at the apex_admin URL below at first login.


ACL:


DECLARE
  ACL_PATH  VARCHAR2(4000);
  ACL_ID    RAW(16);
BEGIN
  -- Look for the ACL currently assigned to 'localhost' and give APEX_040100
  -- the "connect" privilege if APEX_040100 does not have the privilege yet.
  SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS
   WHERE HOST = 'localhost' 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_040100'
  -- 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_040100', 
     'connect') IS NULL THEN 
      DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH, 
     'APEX_040100', TRUE, 'connect'); 
  END IF;


EXCEPTION
  -- When no ACL has been assigned to 'localhost'.
  WHEN NO_DATA_FOUND THEN
  DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('local-access-users.xml',
    'ACL that lets power users to connect to everywhere',
    'APEX_040100', TRUE, 'connect');
  DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('local-access-users.xml','localhost');
END;
/
COMMIT;





8- Following are the URL to access APEX.


    http://<host>:<port>/dpls/apex    ## APEX developer page






  
  http://<host>:<port>/dpls/apex/apex_admin  # APEX administrator page









Hope it Helps ...

No comments:

Post a Comment