This This document is intended to give non-expert users (DBPrism, Cocoon, OC4J) a head-start, so they can see DBPrism/OC4J in action. Some text of this document is directly copied from the document OC4J.html , which was written by Marcelo F. Ochoa - mochoa@ieee.org , the creator of DBPrism.
This manual is not intended as a general installation guide for DBPrism: only use the versions of the software components as they are given below or you're in for a disappointment. The goal of this manual is to set up a working DBPrism configuration on a Linux machine as quickly and easily as possible. This means that certain things you might want (such as setting up new DADs) are outside the scope of this document. Refer to the standard DBPrism documentation for these topics. If you have comments/remarks, please email them to Roel Franken, rfranken@importalis.com , so that I can improve this document.
DBPrism is a servlet that can be used in two modes:
- A mode emulating the Oracle Apache mod_plsql. This will allow you to execute stored procedures in the Oracle database through the DBPrism servlet.
- A mode that makes DBPrism behave as an XML producer for Cocoon. Instead of outputting directly to the web-server, XML is directed towards Cocoon, using Cocoon as an XML publishing framework.
In this installation manual we will start to describe how the general components (such as Java) must be installed. Then the installation of each of these modes is described. .
The installation described in this document is restricted to a particular configuration of software modules (in bold), which are defined in the table below:
| Software | Version | Where to get it |
|---|---|---|
| DBPrism | 2.0.0-alpha1 | HERE |
| Cocoon | 2.0 | ...from Apache.org: HERE |
| OC4J | 1.0.2.2.1 | ...from Oracle Technet: HERE |
| Java Runtime Environment | Java(TM) 2 Runtime Environment, SE (build 1.3.1_02-b02) | ...from Sun Corp: HERE |
| Linux Kernel | Linux 2.4.10-4GB | - |
| Oracle rdbms | 8.1.7/9.0.x | ...from Oracle Technet: |
| Apache | 1.3.20 | ...from Apache.org |
It is wise not to install the DBPrism-components as user
root.
oracle
/opt/oracle
oinstall,
dba
Using DBPrism (in either mode) requires installing a number of general components. Apart from Linux (OS) and Oracle (rdbms), which are not described in this document, the following general software components must be installed:
- a Java Runtime Environment (JRE)
- The Oracle Container for Java (OC4J)
- Apache webserver
The Java distribution from Sun comes as a self-extracting BIN-file or a TAR-archive. Download the distribution (see " Table 1 : Software Configuration .") and install (as user
oracle)
In this example we install Java in
/usr/local/jdk1.3.1_02
If you want it there too and you 're using the BIN-file, do the following:
-
Log on as
oracle -
Download the BIN-file and put it in
/usr/local - Extract. The directory jdk1.3.1_02 with subdirectories is created
Now modify the
.profile
oracle
PATH=/usr/local/jdk1.3.1_02/bin:$PATH JAVA_HOME=/usr/local/jdk1.3.1_02
Log on again or do a
oracle@linux:~>. ~/.profile
command to reload the profile settings.
Then issue the
oracle@linux:~>which java
command to verify the correct JRE settings.
The result should be:
/usr/local/jdk1.3.1_02/bin/java
To check if the Apache webserver is running, load the following URL in the browser:
http://<your host>/index.html.en
If you see the test page then apache is running: go to step " Setting up the OC4J Servlet Container ". If you don 't see the test page, this can mean any of the following:
- That Apache is installed but not running
- That Apache is not installed
To find out which of the two is the case, do the following:
Connect as
root
root
oracle@linux:~>su root
Issue the command:
linux:~ # apachectl
If you get an error like:
linux:~ # bash: apachectl: command not found
Then Apache is not installed and you have to install it from the Linux cdrom or download in from the site mentioned above. Refer to the documentation provided from Apache Org. to install it.
If you get the help information for apachectl, then apache is installed but not running. Start Apache by issuing the command:
linux:~ # apachectl start
Result:
/usr/sbin/apachectl start: httpd started
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 container is written entirely in Java that executes on the standard Java Development Kit (JDK) Virtual Machine (JVM).
Installing OC4J requires the following simple steps:
- Unpack the distribution - unzipping the distribution file
- Install - through the java virtual machine
- Start OC4J
First, log on as the
oracle
OC4J could be unpacked on any directory, but Oracle recommends installing into
$ORACLE_HOME
oracle
$ORACLE_HOME
set | more
ORACLE_HOME=/opt/oracle
Now go to $ORACLE_HOME and create a directory oc4j:
oracle@linux:~> cd $ORACLE_HOME oracle@linux:~> md oc4j oracle@linux:~> cd oc4j
and download the oc4j.zip from Oracle Technet into the directory /opt/oracle/oc4j.
After that:
oracle@linux:~> ls -l /opt/oracle/oc4j totaal 9512 -r-xr-xr-x 1 oracle oinstall 9721825 jan 26 23:19 oc4j.zip
Then execute these commands:
oracle@linux:~> cd $ORACLE_HOME oracle@linux:~> unzip /opt/oracle/oc4j/oc4j.zip
Result:
Archive: /opt/oracle/oc4j/oc4j.zip creating: j2ee/home/ creating: j2ee/home/applications/ inflating: j2ee/home/applications/atm-install.txt inflating: j2ee/home/applications/estore-bugs.txt ... inflating: j2ee/home/jta.jar inflating: j2ee/home/jndi.jar inflating: j2ee/home/Readme.txt
Issue the command
oracle@linux:~> cd $ORACLE_HOME/j2ee/home
to go to the directory where OC4J was installed. Then issue:
oracle@linux:~> java -jar orion.jar -install Enter an admin password to use: admin Confirm admin password: admin Installation done
Now that OC4J is installed, all you have to do is start it. Starting, Stopping and Re-starting is done by scripts. OC4J is operated through java -jar commands, but in many cases a shell or script is the best solution.
Here are scripts to use for these functions:
For starting OC4J:
#!/bin/sh # Start script (start.sh) # adds path to java virtual machine executable file export JAVA_HOME=/usr/local/jdk1.3.1_02 export PATH=$JAVA_HOME/bin:$PATH java -jar orion.jar
Copy the above script, save it as start.sh in $ORACLE_HOME/j2ee/home and execute to start the OC4J container:
oracle@linux:~/j2ee/home> sh start.sh
Result
Oracle9iAS (1.0.2.2.1) Containers for J2EE initialized
For stopping OC4J:
#!/bin/sh # Shutdown script (shutdown.sh) # adds path to java virtual machine executable file export PATH=/usr/local/jdk1.3.1_02/bin:$PATH unset CLASSPATH export CLASSPATH= java -jar admin.jar ormi://localhost/ admin admin -shutdown
Restart script:
#!/bin/sh # Restart script (restart.sh) # adds path to java virtual machine executable file export PATH=/usr/local/jdk1.3.1/bin:$PATH # unset CLASSPATH export CLASSPATH= 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 by adding these lines to Apache httpd.conf file:
<IfModule mod_proxy.c> ProxyRequests On 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"
Now that the general components are set up, we can proceed with the installation of the MOD_PLSQL emulation. In this mode the DBPrism servlet is used to call stored procedures in the (Oracle) database and outputs the result directly to the webserver.
Log on as oracle user if you hadn't already done so
Download DBPrism from the URL given at " Software Configuration ".
Unpack the DBPrism distribution into directory /opt/dbprism.
Add the following lines to the .profile file:
#Set PRISM home: PRISM_HOME=/opt/dbprism/
Reload the .profile file so these settings take effect.
From the installation directory, an EAR-file has to be generated for deployment on the OC4J application server. An EAR file is a JAR archive that contains a J2EE application.
Creating an EAR-file can be done easily with the script
$PRISM_HOME/applications/build-dpls.sh
$PRISM_HOME/applications
oracle@linux:/opt/dbprism/applications> . build-dpls.sh Building dpls.ear using JAVA_HOME => /usr/local/jdk1.3.1_02 .... Including last minute changes on Prism.jar added manifest adding: examples-jsp/(in = 0) (out= 0)(stored 0%) adding: examples-jsp/demo.jsp(in = 352) (out= 219)(deflated 37%) ...
In the
$PRISM_HOME/bin
dpls.ear
Copy this file to
$ORACLE_HOME/j2ee/home/applications
$ORACLE_HOME/j2ee/home/applications/dpls/dpls/WEB-INF/lib
$ORACLE_HOME/j2ee/home/applications/dpls/dpls
First, start the OC4J server is it isn 't running.
The
server.xml
$ORACLE_HOME/j2ee/home/config/)
<application name="dpls" path="../applications/dpls.ear" />
Now in the window running the OC4J server, you should see the following:
Auto-unpacking /opt/oracle/j2ee/home/applications/dpls.ear... done. Auto-unpacking /opt/oracle/j2ee/home/applications/dpls/dpls.war... done. Auto-deploying dpls (New server version detected)...
The OC4J server has recognised the new application dpls.
The
default-web-site.xml
$ORACLE_HOME/j2ee/home/config
<web-app application="dpls" name="dpls" root="/dpls" />
(Again: Make sure you do not put this between the comment tags.)
This line tells to OC4J server which directory is used as a mount point for this application
This can be done in two ways:
- Simple: just create one stored procedure containing HTP.P commands to check the installation of the dpls zone
- Eleborate: Use the DBPRISM scripts to install the SCOTT account and test the demo?s
(You can do both of course)
As Oracle DBA: Create a user
prismtest
Grant connect and resource to this user.
Connect as
prismtest
CREATE OR REPLACE PROCEDURE simple_test IS
BEGIN htp.p('This is DBPrism. Connected as:');
htp.p(user);
END simple_test;
Modify the
prism.properties
$ORACLE_HOME/j2ee/home/applications/dpls/dpls
Set the DAD for sample to the following settings:
sample.dbusername=prismtest sample.dbpassword=<password for prismtest> sample.connectString=jdbc:oracle:thin:@<host>:<port>:<instance>
e.g.:
sample.connectString=jdbc:oracle:thin:@localhost:1521:orcl
Now in your browser request:
http://<your_server>:8888/dpls/sample/prismtest.simple_test
prismtest
and you will see:
This is DBPrism. Connected as: PRISMTEST
If you don't see this, try start and stop OC4J
Before you can test the demos for this zone, you must install the
scott
As dba:
/opt/dbprism/plsql/scott.sql:
Connect as SCOTT and execute:
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YY';
and
ALTER SESSION SET NLS_LANGUAGE=AMERICAN;
(Why? Because Oracle put dates in the
summit2.sql
Run
summit2.sql
Run
/opt/dbprism/plsql/xtp.sql
Run
/opt/dbprism/plsql/doctbl.sql
(there is an exit in this script, which is not nice)
Run
/opt/dbprism/plsql/demo.sql
Run
/opt/dbprism/plsql/show_open_sessions.prc
Run
/opt/dbprism/plsql/show_open_cursors.prc
Modify the prism.properties file located on
$ORACLE_HOME/j2ee/home/applications/dpls/dpls directory
sample.dbusername=scott sample.dbpassword=tiger
Now in your browser request:
http://<your_server>:8888/dpls/sample/
and you will see the DBPrism Demo Page:

Now that the /dpls zone is working correctly, we are going to set up the mode for communication with COCOON2. This means setting up a complete new application in the application server (OC4J), that is again copied from the DBPrism installation and deployed by means of an EAR-file.
OC4J comes with JAR-files that are conflicting with the COCOON2 library. So in order to get Apache Cocoon running the JAR-files need to be reshuffled. Do this by executing the following:
- Download and extract the COCOON2 distribution mentioned in the " Software Configuration " to /opt/cocoon/cocoon-2.0
- Stop the OC4J server if it is running.
-
Remove
the following files from the
:
$ORACLE_HOME/j2ee/home directory -
Set Cocoon home by modifying the .profile file for the user
; add the following line:
oracleAnd reload the .profile file.COCOON_HOME=/opt/cocoon/cocoon-2.0. -
Merge
from the Cocoon distribution with
xerces-1.4.4.jarinto one file namedxml-apis.jar. Do this by saving the following script asxerces.jar:merge.sh
echo "Merging Xerces and xml-apis jar..." mkdir /tmp/xerces cd /tmp/xerces jar xvf $COCOON_HOME/lib/xerces-1.4.4.jar (the Cocoon2.0 version) jar xvf $COCOON_HOME/lib/xml-apis.jar jar cvf ../xerces.jar *
-
Run
. The result is a 940155 bytes in size
merge.shonxerces.jar./tmp -
Copy this
from
xerces.jarto/tmp(remove old one first).$ORACLE_HOME/j2ee/home/xerces.jar -
Copy
from
xalan-2.2.0-D13.jartococoon/lib(remove old one first)$ORACLE_HOME/j2ee/home/xalan.jar
This involves the following steps:
- Make an EAR file distribution
- Edit the server.xml file
- Edit the default-web-site.xml file
As described in Creating the EAR file this is done by a script that comes with the installation. For the dbprism zone this script is called:
$PRISM_HOME/applications/build-dbprism.sh
Execute this script while on the
$PRISM_HOME/applications
$PRISM_HOME/bin
dbprism.ear
Copy this file to
$ORACLE_HOME/j2ee/home/applications.
This dbprism.ear file (like dpls.ear) includes a private copy of the prism.jar. It also includes a cocoon.jar which is based on COCOON2 and located in the
$ORACLE_HOME/j2ee/home/applications/dbprism/dbprism/WEB-INF/lib
$ORACLE_HOME/j2ee/home/applications/dbprism/dbprism
(See:Configuring the server.xml)
Add the following line for the /dbprism zone:
<application name="dbprism"
path="../applications/dbprism.ear" />
(See:Configuring the default-web-site.xml)
Add the following line for the /dbprism zone:
<web-app application="dbprism" name="dbprism" root="/dbprism"
/>
To test the use of COCOON2 through DBPrism, start the OC4J server again; then in your browser request:
http://<your host>:8888/dbprism/
You should see the Cocoon welcome page.
If you want to test the DB Prism 2.0.0-alpha1 / Cocoon2 - Demos (top left corner) you have to install these demos first.
The Oracle IAS's mod_plsql support demo will work only if you have tested in the 'eleborate ' way. This because this sample uses the SCOTT user with the demo's installed.
For testing the DB Prism Java Stored Procedures support you will have to edit the prism.properties file on
$ORACLE_HOME/j2ee/home/applications/dbprism/dbprism
- Change the XMLJ DAD:
xmlj.connectString=jdbc:oracle:thin:@<db server>:<db port>:<db instance name>
- If you installed the DEMO.SQL in another user 's schema you will also have to change the lines:
xmlj.dbusername=<your demo user> xmlj.dbpassword=<your demo user?s password>
Here are some problems you can run into when testing the DBPrism modes:
Problem: When using DBPrism in the Cocoon-mode (mode 2), an error page is returned in the browser saying:
type internal-server-error message The sitemap handler's sitemap is not available. Please check logs for the exact error.
Cause: You started OC4J in a session without a valid X server running (e.g. in a TELNET window on Windows).
Solution: start the OC4J server on an xterm. You could also use the Xvfb program. Install if necessary, start it:
/usr/bin/X11/Xvfb :1 -screen 0 800x600x8& export DISPLAY=:1
Problem: When I try to run the simple example I see the following error:
Servlet Wrapper Error Page I/O-exception: The Network Adapter could not establish the connection
Cause: You didn't specify the correct database server in prism.properties:
sample.dbusername=<username for prismtest> sample.dbpassword=<password for prismtest> sample.connectString=jdbc:oracle:thin:@<your_host>:<your_port>:<your_instance>
Solution: Test <your_host> by pinging it from the machine that's running OC4J and then correct the prism.properties entry.
Problem: I get a PL/SQL error telling me ROWS_IN or ROWS_OUT is/are not defined
Cause: In the DAD the toolkit property is set to '3x ' while it should be '4x '.
Solution: Change it from '3x' to '4x'. (at present the default is '3x ')
Problem: When I execute the
shutdown.sh
Cause: Cocoon2 does not shutdown gracefully on orions webservers (Orion and OC4J), this bug was corrected on the CVS (later) versions
Solution: Use shutdown with "force" option or you could use CTRL-C.


