Monday, November 10, 2008

Using APEX into Oracle WebLogic Server 10.3

This post is about how to use APEX applications running inside Oracle WebLogic Server 10.3
I am not an Web Logic specialist so with a little help from Oracle JDeveloper 11g I can deploy latest DBPrism Servlet Engine to run APEX applications like the Apache mod_plsql embedded gateway.
The easy way to deploy APEX applications is using a WAR file download from SourceForge.net web site.
1.- Download latest DBPrism dpls WAR and rename as dpls.war.
2.- Create JDeveloper project from a WAR file, remember start JDeveloper with a J2EE role. Following screenshots shows the step by step guide.3.- Download and install APEX if your target database do not have APEX installed. Remember:
3.a Change the Password for the ADMIN Account
3.b Unlock the APEX_PUBLIC_USER Database User
3.c Change the Password for the APEX_PUBLIC_USER Database User
4.- Edit prism.xconf file to define your target database, prism.xconf file is under [Web Content]/WEB-INF project directory, change properties.
4.a demo.db with your JDBC thin or OCI connect string
4.b DAD_apex dbpassword with the value defined in 3.c

5.- Create a WAR file with APEX's static resources following:
[mochoa@mochoa ~]$ cd /usr/local/apex/images/
[mochoa@mochoa images]$ zip -r /home/mochoa/jdevhome/mywork/cms-2.1-applib/i.zip .
.....
adding: jump.gif (deflated 21%)
adding: wwv_edit2_old.gif (deflated 86%)
[mochoa@mochoa images]$ mv /home/mochoa/jdevhome/mywork/cms-2.1-applib/i.zip /home/mochoa/jdevhome/mywork/cms-2.1-applib/i.war
6.- Create a JDeveloper project named APEX-static following the steps of section 2 but using i.war file created in the step 5. This project will look like:
6.a Edit web.xml file of APEX-static project removing Faces Servlet entries. This file is located at [Web Content]/WEB-INF project directory.
6.b Remove all libraries dependency defined in this project due it only contains static resources, righ click on the project node and choose Project properties->Libraries and Classpath, the list must be empty.
7.- Start Oracle Web Logic 10.3 embedded web server using JDeveloper menu Run -> Start Server Instance, console log will show something like:
/home/mochoa/.jdeveloper/system11.1.1.0.31.51.56/DefaultDomain/bin/startWebLogic.sh
[waiting for the server to complete its initialization...]
.

DefaultServer startup time: 39999 ms.
DefaultServer started.
8.- Deploy APEX-static project, right click on the project node and choose option Deploy->i->to->IntegratedWLSConnection. The log window will show something like:
---- Deployment started. ---- Nov 10, 2008 10:54:59 AM
Target platform is (Weblogic 10.3).
Running dependency analysis...
Building...
2008-11-10 10:55:03.712: Writing WAR file to /home/mochoa/jdeveloper/mywork/DBPrism/APEX-static/deploy/i.war
2008-11-10 10:55:08.837: Wrote WAR file to /home/mochoa/jdeveloper/mywork/DBPrism/APEX-static/deploy/i.war
Redeploying Application...
Application Redeployed Successfully.
Elapsed time for deployment: 22 seconds
---- Deployment finished. ---- Nov 10, 2008 10:55:20 AM
You can test i.war deployment with this URL http://localhost:7101/i/htmldb/apex_logo.gif an Oracle Application Express logo is shown.
9.- Deploy APEX-dpls project, rigth click on the project node and choose Deploy-dpls-to-IntegratedWLSConnection, console log will show something like:
---- Deployment started. ---- Nov 10, 2008 10:59:29 AM
Target platform is (Weblogic 10.3).
Running dependency analysis...
Building...
2008-11-10 10:59:40.775: Writing WAR file to /home/mochoa/jdeveloper/mywork/DBPrism/APEX-dpls/deploy/dpls.war
2008-11-10 10:59:40.917: Wrote WAR file to /home/mochoa/jdeveloper/mywork/DBPrism/APEX-dpls/deploy/dpls.war
Redeploying Application...
Application Redeployed Successfully.
Elapsed time for deployment: 56 seconds
---- Deployment finished. ---- Nov 10, 2008 11:00:25 AM
You can test dpls.war deployment with this URL http://localhost:7101/dpls/ a DBPrism project welcome page is shown.
10.- Start your Oracle database if is not already done.
11.- Log into APEX admin page using the link http://localhost:7101/dpls/apex/apex_admin using ADMIN password defined into the step 3.a

Finally I want to remark that APEX-WebLogic integration implemented with DBPrism mod_plsql emulation has some benefits from a traditional mod_plsql or mod_proxy deployment:
  • You can integrate to other J2EE development trough JSP forward or include tags, which means that you can create a J2EE application mixing traditional JSP/ADF Faces components with some parts implemented in APEX integrated through taglibs.
  • You have a lot of logging using Apache Log4J, logging information can be customized with the file log4j.properties located into APEX-dpls project, [Application Sources] project directory.
  • You can use Oracle Proxy user support into APEX application, I will write a post ASAP with changes into APEX-dpls project to enable JAAS authentication integration into APEX.
Enjoy APEX inside your Oracle WLS, Marcelo.