DEPLOYING TO APACHE JSERV.
Apache JServ is configured through several property files. The root property file is specified in mod_jserv module’s
main configuration file (usually jserv.conf) with ApJServProperties directive. Usually, this file is named
jserv.properties and is located in $APACHE_HOME/Jserv/conf/ directory. Several properties should be
changed or added to this file in purpose for the JOPA Servlet to function properly:
| wrapper.bin |
Set this to JRE 1.4 executable (for example, c:\j2sdk1.4.2_05\bin\java.exe). The
JOPA Servlet requires JRE 1.4.0 or later to function.
Note that this change may break the Oracle JSP engine – OJSP will be no longer able to compile the JSP pages because the new JRE has more recent class file format and the engine will use an older compiler. To fix this issue, you need to specify correct tools.jar from JDK 1.4 or later in zone properties file. Locate the line similar to the following:
wrapper.classpath=\jdk\lib\tools.jar
where is your Oracle HTTP Server home directory, and replace this path with the path to the tools.jar library from JDK 1.4 or later.
For example:
wrapper.classpath=c:\j2sdk1.4.2_05\lib\tools.jar
Alternatively, you can add the following OJSP initialization argument (in zone properties file):
servlet.oracle.jsp.JspServlet.initArgs=javaccmd=
where is full path (including executable name) to the Java compiler 1.4 or later (for example, c:\j2sdk1.4.2_05\bin\javac.exe.) |
| wrapper.classpath |
Add new wrapper.classpath property entry and specify full path including file name to the JOPA.war
wrapper.classpath=C:\j2sdk1.4.2_05\Jopa\jopa.war |
| zones |
This property defines so-called servlet zones. There may be several zones defined, each with
its own properties. Usually, one zone, called root is defined and is sufficient. |
| .properties |
Depending on zone names defined in zones, each defined zone should have its own properties
file. These files are defined with .properties property, where is replaced
with the zone name. For example, for the root zone, corresponding property will be
named root.properties. This property should contain full path including file name to the
zone properties file.
For example:
servlet.acc.code=com.nnetworks.jopa.JOPA servlet.acc.initArgs=cfgfile=C:\\j2sdk1.4.2_06\\Jopa\\jopa.cfg servlet.acc.initArgs=logfile=C:\\j2sdk1.4.2_06\\Jopa\\jopa.log servlet.acc.initArgs=loglevel=3 servlet.acc.initArgs=debuglevel=0
Access will be:
http://yorserver/servlets/acc/admin |
The zone properties file should also be edited and new servlet alias should be added to it. Assuming that you have
single zone defined, root, and properties for this zone are stored in zone.properties file (usually located in
$APACHE_HOME/Jserv/servlets/ directory), you need to open this file and do the following modifications to it:
Add the following entries:
### JOPA configuration start
servlet.jopa.code=com.nnetworks.jopa.JOPA
servlet.jopa.initArgs=cfgfile=path/to/jopa.cfg
The above additions specify new alias for the JOPA Servlet, jopa, and specify which class is the main servlet class
(com.nnetworks.jopa.JOPA). They also provide initialization arguments for the main servlet class. cfgfile is
mandatory argument – it specifies the location of the JOPA Servlet configuration file, which contains other servlet parameters
and DADs (Database Access Descriptors) definitions. The configuration file is an ASCII text file, which contains
servlet configuration parameters. Its syntax is similar to the Windows .INI file syntax – the file is broken into sections;
each section is delimited with section name in square brackets. Within each section there is one or more parameters
related to that section. Each parameter is on separate line in parameter_name=value form. Parameter
names are case-sensitive.
[Config] section defines global servlet configuration. Below is the list of all recognized servlet parameters, their
meaning and allowed values:
| log_prefix |
Defines a sequence of characters with which all log entries will be prefixed.
Default is blank (no prefix.) |
| error_prefix |
Defines a sequence of characters with which all error log entries will be prefixed.
Default is ** (double asterisks.) |
| logfile |
Log file name and location. If loglevel is higher than 0, the servlet will log its actions to the
specified file.
This parameter is optional and defaults to /jopa.log
( is extracted from cfgfile parameter.) It may also be specified in servlet
initialization property (servlet..initArgs.) |
| loglevel |
Logging level. Defines level of verbosity for servlet actions logging. Valid range of values is 0..5. 0
turns logging off, 5 is the most verbose level. Note that critical errors (unexpected exceptions, etc.)
are still logged to the log file even if loglevel is set to 0. Such errors are prefixed with a sequence
of characters defined by error_prefix parameter.
This parameter is optional and defaults to 0 (no log.) |
| debuglevel |
Console logging level. Defines level of verbosity for servlet actions log that goes to the system console.
Valid range of values is 0..5. 0 turns logging off, 5 is the most verbose level. This parameter
should be set to 0 in production environments and is only useful with text-mode servlet runners.
This parameter is optional and defaults to 0 (no log.) |
You now need to restart the Apache daemon, so that it will reload mod_jserv and the module will re-read its configuration
and recognize new settings for JRE, class path and new servlet definition. Servlet deployment is now complete
and the JOPA Servlet is accessible at //jopa/, where is
location configured in Apache to be handled by mod_jserv. However, you will also need to define some DADs before
you will be able to use it.
DAD definition format is discussed further in this chapter. |
Unlike Apache JServ, OC4J Standalone follows the J2EE specifications and is configured through XML configuration
files.
To deploy the JOPA Gateway Servlet on OC4J, you should first copy the jopa.war archive to the
{oc4jhome}/j2ee/home/applications directory, modify {oc4jhome}/j2ee/home/config/http-website.
xml file by adding new entry to the section:
and restart the OC4J. can be any prefix of your choice that will be used to access your
PL/SQL applications. For example, if you set it to /pls, you will access your PL/SQL applications through the JOPA
Servlet as http://server/pls///. is customizable,
too (see below.)
When you restart OC4J, the jopa.war archive will be automatically expanded into the
{oc4jhome}/j2ee/home/applications/jopa/ directory. You now need to modify the WEB-INF/web.xml file
in that directory to set correct value for the cfgfile servlet initialization parameter. Locate
cfgfile
jopa.cfg
tags in the web.xml file and alter the {path_to_config_file} tag to contain
full path to the servlet configuration file (default is jopa.cfg with no path, which resolves to the directory, from
which the JRE was started). You can store the configuration file anywhere on your file system. The default configuration
file will be in {oc4jhome}/j2ee/home/applications/jopa/ directory when OC4J auto-extracts the WAR
archive, so you can set the tag to {oc4jhome}/j2ee/home/applications/jopa/jopa.cfg
to use the default configuration file.
The servlet is now ready – OC4J will automatically reload the application configuration and re-deploy the servlet when
you save the web.xml file.
You can also alter to use in gateway access URLs by modifying the tag value
under tag in the web.xml file. Locate
jopa
/jpls/*
tags in the web.xml file and edit the contents of the tag. After you save the file, OC4J will automatically
re-deploy the servlet on next access and new mapping will be used. Default mapping is /jpls/*, so by default
you will access your PL/SQL applications through an URL similar to this:
http://server//jpls//... |