DBPrism 2.0.0 is primary developed and tested on OC4J servlet container. This document tends to help you how to configure DBPrism / Cocoon2 with the OC4J 9.0.x. Documents with instructions for differents servlet engines are located on section Documentation .
The Oracle9iAS new J2EE container, OC4J, is based on some technology licensed from Ironflare Corporation, which develops the OrionServer--one of the market's leading J2EE containers. This cotainer is written entirely in Java that executes on the standard Java Development Kit (JDK) Virtual Machine (JVM), then I will show step by step install instructions on Unix platform but these steps are similar to win32 platform.
Installing OC4J requires two simple steps:
- Unpack the distribution , unziping the distribution file
- Launch the installer , through the java virtual machine
OC4J could be unpacked on any directory, but Oracle recomends into $ORACLE_HOME directory, then excecute these commands logged as oracle owner.
# cd $ORACLE_HOME # ls -l /mnt/cdrom total 14100 -r--r--r-- 1 root root 9515023 May 24 13:53 oc4j.zip -r--r--r-- 1 root root 4890141 May 24 13:53 petstore.zip # unzip /mnt/cdrom/oc4j.zip Archive: /mnt/cdrom/oc4j.zip creating: j2ee/ creating: j2ee/home/ inflating: j2ee/home/admin.jar .... inflating: j2ee/home/lib/xalan.jar inflating: j2ee/home/lib/xerces.jar # cd $ORACLE_HOME/j2ee/home
Excecute install command, the installation prompts you for an administration username and password, which is used for the administration console command-line tool:
# java -jar oc4j.jar -install Enter an admin password to use: admin Confirm admin password: admin Installation done #
Test your installed server launching it with the following command and navigate at the url http://localhost:8888/ , specially on JSP examples.
# java -jar oc4j.jar Oracle9iAS (9.0.3.0.0) Containers for J2EE initialized
Starting, Stoping and Re-starting through scripts. OC4J is operated through java -jar commands, but in many cases a shell or .bat script is the best solution, here there is an examples to do it:
#!/bin/bash # Shutdown script (start.sh) export DISPLAY=localhost:0.0 export JAVA_HOME=/usr/java/jdk1.3 export PATH=$JAVA_HOME/bin:$PATH java -server -Xnoclassgc -Duser.language=en -showversion -Xmx128m \ -Xbootclasspath/a:lib/xerces.jar:lib/xalan.jar -jar oc4j.jar -userThreads
#!/bin/sh # Shutdown script (shutdown.sh) export PATH=/usr/local/jdk1.3.1/bin:$PATH java -jar admin.jar ormi://localhost/ admin admin -shutdown force
#!/bin/sh # Restart script (restart.sh) export PATH=/usr/local/jdk1.3.1/bin:$PATH java -jar admin.jar ormi://localhost/ admin admin -restart
Oracle recommend that you tunnel requests to the J2EE Container from Apache using mod_proxy. Although this is not necessary, it ensures that all pages that are served by the Oracle9i Application Server can benefit from other Oracle9i Application Server services--such as SSL and WebCache. This avoids wasting Java resources for serving static pages.
This is a simple step that could be done adding these lines to Apache httpd.conf file:
<IfModule mod_proxy.c>
ProxyRequests Off
ProxyPass /dbprism/ http://<oc4j-host>:8888/dbprism/
ProxyPassReverse /dbprism/ http://<oc4j-host>:8888/dbprism/
</IfModule>
A more structured way is to create a file called oc4j.conf file with the above lines and to modify Apache httpd.conf with the line:
include "/u01/app/oracle/product/8.1.7/Apache/Apache/conf/oc4j.conf"
OC4J 9.0.x version uses Oracle XML parser instead of Xalan and Xerces then, instead of replace the version of these products is necessary to set xalan and xerces in front of oc4j.jar
-
Copy
from
xerces-xml-apis.jarto$CMS_HOME/dbprism/WEB-INF/lib$ORACLE_HOME/j2ee/home/lib/xerces.jar -
Copy
from
xalan.jarto$CMS_HOME/dbprism/WEB-INF/lib$ORACLE_HOME/j2ee/home/lib/xalan.jar - Finally replace the start.sh script adding the corresponding flag to the java interprete for inserting xalan and xerces in front of xmlparserv2.jar, here the example:
#!/bin/sh # Start script (start.sh) # adds path to java virtual machine executable file export PATH=/usr/local/jdk1.3.1/bin:$PATH java -showversion -Xmx256m -Xbootclasspath/a:lib/xerces.jar:lib/xalan.jar -jar orion.jar
Every zone on OC4J architecture requires three simple steps to work.
- Makes an EAR file distribution , packing all requires files by the zone
- Edits server.xml file , located on $ORACLE_HOME/j2ee/home/config directory
- Edits http-web-site.xml file , located on $ORACLE_HOME/j2ee/home/config directory.
/dpls zone stand for DBPrism pls mount point and tends to emulate Apache mod_plsql zone /pls, this zone is pre-configured with DBPrism working on IAS mod_plsql/OAS/OWS backward compatibility.
build-dpls.bat makes a dpls.ear file, which is ready to be excecuted at $PRISM_HOME/applications directory for windows and build-dpls.sh for unix. Here the code of .bat and .sh version.
@echo off @echo requires PATH including JAVA_HOME/bin directory @echo Building dpls.ear .... mkdir ..\stage\dpls xcopy /e dpls ..\stage\dpls @echo including last minute changes on Prism.jar... mkdir ..\stage\dpls\dpls\WEB-INF\lib copy ..\bin\Prism.jar ..\stage\dpls\dpls\WEB-INF\lib\Prism.jar cd ..\stage\dpls\dpls jar cvf ../dpls.war . cd .. rmdir /q /s dpls jar cvf ../dpls.ear . cd .. rmdir /q /s dpls copy dpls.ear ..\bin del dpls.ear cd ..\applications @echo Building dpls.ear done. (look at ..\bin directory)
echo "requires path including JAVA_HOME/bin directory" echo "Building dpls.ear ...". mkdir ../stage/dpls cp -rp dpls ../stage echo "Including last minute changes on Prism.jar" cp ../bin/Prism.jar ../stage/dpls/dpls/WEB-INF/lib cd ../stage/dpls/dpls jar cvf ../dpls.war . cd .. rm -rf dpls jar cvf ../dpls.ear . cd .. rm -rf dpls mv dpls.ear ../bin cd ../applications echo "Building dpls.ear done. (look at ../bin directory)"
Before run these scripts set JAVA_HOME variable in order to provide to the script the availability of run java jar utility.
Into PRISM_HOME/bin directory a file called dpls.ear has been created, copy this file to ORACLE_HOME/j2ee/home/applications directory. Then edits the files server.xml, http-web-site.xml located into ORACLE_HOME/j2ee/home/config directory adding these lines:
server.xml , this line says to OC4J server where dpls.ear is located
<application name="dpls" path="../applications/dpls.ear" />
http-web-site.xml , this line says to OC4J server which directory is used as mount point for this application (
http://server:port/dpls/dad_name/pkg.proc
<web-app application="dpls" name="dpls" root="/dpls" />
This pre-packaged file includes DBPrism configured as IAS mod_plsql/OAS/OWS compatibility. To avoid the problem of different configuration, it includes a private copy of Prism.jar located on ORACLE_HOME/j2ee/home/applications/dpls/dpls/WEB-INF/lib directory and a private copy of prism.properties file located on ORACLE_HOME/j2ee/home/applications/dpls/dpls directory.
web.xml file which includes the definition for the DADs has a simple DAD defined called sample , edits prism.properties file with the correct values for username, password and connect string for the target database.
To add or configure more than one DAD, do these steps
- add the DAD name , to the parameter global.alias on prism.properties file.
- set username,password , and so on on prism.properties file too.
- create an alias , on web.xml file (servlet mapping section).
Here an example for a DAD demo which will be used with the url http://server:port/dpls/demo/package_name.procedure_name?args
-
on
prism.properties
file located on
ORACLE_HOME/j2ee/home/applications/dpls/dpls directory.
global.alias=sample examples lite java demo demo.dbusername=scott demo.dbpassword=tiger demo.connectString=jdbc:oracle:thin:@localhost:1521:orcl demo.errorLevel=2 demo.errorPage=http://localhost/error.html demo.compat=8i demo.toolkit=4x demo.StateLess=true
-
on
web.xml
file located on
ORACLE_HOME/j2ee/home/applications/dpls/dpls/WEB-INF directory.
<servlet-mapping>
<!-- Servlet mappimg for DAD demo -->
<servlet-name>
dpls
</servlet-name>
<url-pattern>
/demo/*
</url-pattern>
</servlet-mapping>
/dbprism zone is a mainly zone for DBPrism , this zone is pre-configured with DBPrism working with Cocoon2 and with Java Stored Procedure support. Also is configured for DBPrism CMS. The Cocoon jar included into this application deployment is based on Cocoon 2.0.3 release, to upgrade this version first upgrade the respective jars detailed on the section Preparing OC4J to run Cocoon2 and DBPrism , then upgrade the cocoon.jar and other related libs located in this application directory and finally update cocoon.xconf and sitemat.xmap which are strongly related to the version of cocoon.
To build and deploy dbprism.ear file you can use Oracle JDeveloper 9i, open the project named CMS.prj located into $CMS_HOME directory, navigate to the Deployment branch into the System Navigator and use webapp.deploy file.
To manually dbprism.ear file, copy this file to ORACLE_HOME/j2ee/home/applications directory. Then edits the files server.xml, and http-web-site.xml located into ORACLE_HOME/j2ee/home/config directory adding these lines:
server.xml , this line says to OC4J server where dbprism.ear is located
<application name="dbprism" path="../applications/dbprism.ear" />
http-web-site.xml , this line tells to OC4J server which directory is used as mount point for this application (
http://server:port/dbprism/dad_name/pkg.proc
<web-app application="dbprism" name="dbprism" root="/dbprism" />
This pre-packaged file includes DBPrism configured to work with Cocoon 2. To avoid the problem of differents configuration, it includes a private copy of Prism.jar and cocoon.jar located on ORACLE_HOME/j2ee/home/applications/dbprism/dbprism/WEB-INF/lib directory and a private copy of prism.properties file located on ORACLE_HOME/j2ee/home/applications/dbprism/dbprism directory.
web.xml is based on Cocoon's web.xml file, it only has a simple servlet mapping entry which redirects every url (starting at /dbprism) to Cocoon framework, request which are redirected to DBPrism will be proecessed first by the Cocoon engine.
Unlike dpls.ear file this deployment profile do not require to edit web.xml file to add other DADs, this is based on the parameter global.behavior=1 which tells to DBPrism that extracts the DAD from Path Info information of the servlet request.
Also this pre-packaged file includes Cocoon's configuration files with the necessary changes for the DBPrism / Cocoon CMS and the examples. Look at the Cocoon Files section for more details.


