Configuring the OC4J Server

In this third part of a series that focuses on managing OC4J and configuring J2EE applications, we look at how to configure the OC4HJ server. It is excerpted from chapter eight of the Oracle 10g Application Server Exam Guide, written by Sam Alapati (McGraw-Hill; ISBN: 0072262710).


The OC4J Server Configuration Files

The OC4J server configuration files (also known as OC4J configuration files) help configure the OC4J server and are located in the following directory:


The OC4J server configuration files configure various OC4J instance-–related items such as ports, security, and basic J2EE services. These XML files are purely

exam watch: The configuration settings in the OC4J configuration files apply directly to the OC4J server, not the deployed J2EE applications. 

about configuring the OC4J instance itself and aren’t directly related to the deployment of the J2EE applications.

The OC4J server configuration files consist mainly of a set of Server XML configuration files and a set of Web site XML files. The server configuration files specify various properties of the OC4J server such as the listening ports, passwords, security, and related basic J2EE services as well as the data sources and Web sites. The Web site XML files are used to configure ports, Web contexts, and protocols to facilitate the functioning of the OC4J Web site.

Let’s review the important OC4J server XML files.


The server.xml file is the key OC4J server configuration file; it contains references to most of the files used by the OC4J server. Besides configuring the OC4J server, the server.xml file also points to other configuration files, such as the jms.xml file for JMS support. This way, you can configure the various services in their own configuration files, but by referring to them in the server.xml file, you let it be known that these services are for the use of the OC4J instance. The server configuration files are OC4J instance specific and refer to the key J2EE configuration files. You don’t usually need to modify the OC4J server configuration files when you deploy J2EE applications. Here’s how the server.xml file references other configuration files:

  |—-> jms.xml
  |       |——–→principals.xml
  |       ———→data-sources.xml

Together, the server.xml, the application.xml, and the default-web-site.xml files define an application’s configuration.

You use the server.xml file for the following purposes:

  • Configuring OC4J
  • Referencing other configuration files
  • Specifying J2EE applications

Let’s look at each of these three categories of tasks in detail in the following subsections.

{mospagebreak title=Configuring OC4J}

You configure the OC4J server by modifying the following elements in the server.xml file:

  • Global application, global Web application, and default Web site
  • Number of HTTP connections the OC4J server will permit
  • Logging settings
  • Transaction time-input settings
  • SMTP host

Referencing Other Configuration Files

You can reference other configuration XML files and directories in the server.xml file. Following are the important configuration files referenced in the server.xml file:

  • data-sources.xml location
  • jazn-data.xml location
  • jms.xml and rmi.xml locations

on the job:  If you’re using a standalone OC4J instance, port 8888 is used by default to access the OC4J listener. In the OracleAS environment, OPMN overrides this port setting. OracleAS by default allocates port 7777 for access via the Oracle HTTP Server when you enable the OracleAS Web Cache.

{mospagebreak title=Specifying Other J2EE Applications}

You specify the deployed J2EE applications in the server.xml file by using the <application> element.

Structure of the server.xml File

The server.xml file consists of several elements, each of which is responsible for a certain area of OC4J-related configuration. Here’s a typical server.xml file:

<?xml version="1.0" standalone=’yes’?>
<!DOCTYPE application-server PUBLIC "Orion Application Server Config" "">
<rmi-config path="./rmi.xml" />
      <!–Interoperability config link–>
      <sep-config path="./internal-settings.xml" />
      <!–JMS-server config link, uncomment to activate the JMS service–>
      <jms-config path="./jms.xml" />
      <javacache-config path="../../../javacache/admin/javacache.xml" />
      <j2ee-logging-config path="./j2ee-logging.xml" />
<file path="../log/server.log" />
           <!–Uncomment this if you want to use ODL logging capabilities
           <odl path="../log/server/" max-file-size="1000" max-directory-size=

      <global-application name="default" path="application.xml" />
      <global-web-app-config path="global-web-application.xml" />
      <!–<web-site path="./secure-web-site.xml" />–>
      <web-site default="true" path="./default-web-site.xml" />
        <!–Add the http-web-site in this way and uncomment this line
      <web-site path="./http-web-site.xml" />

Note that all the directories referred to inside the server.xml file are relative to the $ORACLE_HOME/j2ee/config directory. In the example shown previously, there are several elements such as application-server and the like. I’ll briefly describe the important elements of the server.xml file in the rest of this section. Note that the example file shown in the previous section doesn’t happen to contain all of the following elements.

<application-server>  You use the top-level element of the server.xml file, called the <application-server> element, to specify the application server configuration information. The <application-server> element has attributes such as the following:

  • The application-auto-deploy element specifies the directory the OC4J server automatically deploys applications from.
  • The application-directory element specifies the directory where the OC4J instance will store the application .ear files. If you don’t specify any directory values for this element, the .ear files are, by default, stored in the $ORACLE_HOME/j2ee/home/applications directory. The application-directory element specifies that any files placed in the directory you specify for this element should be automatically deployed.
  • The deployment-directory element specifies the directory where the OC4J instance should store the files it generates for permanent storage. Each of the applications you deploy will have its own deployment-directory element.

<application>  The <application> element specifies the name of the application and the path to the application archive (EAR).

<global-application>  The <global-application> element specifies the default application for an OC4J server.

<global-web-app-config>  The <global-web-app-config> element specifies the location of the web-application.xml file.

<jms-config> and <rmi-config>    The <jms-config> and <rmi-config>  elements specify the path to the jms.xml and the rmi.xml files, respectively.

<max-http-connections>   The <max-http-connections> element specifies the number of maximum concurrent connections that the Web site can accept.

<web-site> The <web-site> element specifies the path to a web-site.xml file that’s used to define a Web site, as shown in the following example:

  Path=”. . . /my-web-site.xml”

{mospagebreak title=Other OC4J Server XML Files}

Besides the main OC4J configuration file, server.xml, several other OC4J server XML files help to configure the OC4J instance. Let’s take a quick look at these.

jazn.xml and jazn-data.xml   The jazn-data.xml and the jazn.xml files are used for security configuration if you’re using the Java Authentication and Authorization (JAAS) Service. The file contains user and group configuration information for the default JAZNUserManager client-admin console.

The data-sources.xml file   To make their applications portable across servers, application developers use logical representation of databases and publish these data sources in the Java Naming and Directory Interface (JNDI) tree. The applications retrieve database connections through javax.sql.dataSource objects and look up the objects through the JNDI. These objects are called data sources, and the deployer must specify the mapping between a logical dataSource object and the physical databases. The connection methods that are specified are used by the applications to connect to the specified database.

on the job:  The properties and methods of the data source objects are specified by the javax.sql.DataSource interface.

The data-sources.xml file lets you configure OC4J database sources used by the various applications hosted by the OC4J instance. In addition, the file contains information on retrieving JDBC connections. The data-sources.xml file contains the following types of information:

  1. JDBC driver
  3. Database schema
  4. Maximum number of database connections allowed
  5. Username and password for the data source
  6. JNDI name in the JNDI lookup, to retrieve the data source

Note that the data-sources.xml file establishes the data source object definitions at the OC4J instance level. These global data sources are specified by an XML tag, and the XML attributes for each data source include the JDBC connection string and sometimes the username and password information. All applications deployed in the OC4J container can share the data sources defined at the container level. Applications can also use application-specific data sources by incorporating the <data-sources> tag in the application.xml file to refer to the data-sources.xml file and directly use the data sources defined therein.

When the OC4J instance starts, it parses the data-sources.xml file, instantiates the DataSource objects, and binds them into the JNDI namespace. After you deploy an application, the application accesses the data sources by looking up the JNDI tree. Note that there’s a separate JNDI namespace for each application.

The different types of data sources, such as emulated and non-emulated data sources as well as native data sources, are discussed in detail later in this chapter. Here’s a typical data-sources.xml file showing how to use the Oracle JDBC driver to create a JDBC thin connection type data source:

  class=<<">>com.evermind.sql. DriverManagerDataSource
   username="scott" password="->pwForScott"
   connection-retry-interval="1" />

In the sample data-sources.xml file, this is what the various elements stand for:

  • Class is the type of data resources or the DataSource class.
  • Name is the name of the data source—in our case, OracleDS, which is the default data source.
  • Location, xa-location, and ejb-location are the JNDI names that the data source will bind to. You must specify all three of the location attributes for emulated data sources, but you use only the value specified for the ejb-location attribute.
  • Connection-driver is the type of connection to be returned. This attribute refers to the class that actually implements the data source connection.
  • Username and password are the username and password for the database users.
  • url is the JDBC connection URL for the database being mapped to this data source.
  • Inactivity-timeout and connection-retry-interval are the default timeout and connection retry intervals, in seconds.

principals.xml   The principals.xml file contains user and group information as well as permissions and certificates.

rmi.xml   The rmi.xml file contains Remote Method Invocation (RMI) configuration information. The RMI listener, which provides remote access for EJBs, has its settings defined in this file as well. Here are the main components of the rmi.xml file:

  • Host name or IP address
  • Port number to which the RMI server binds
  • Clustering and log settings

jms.xml   The jms.xml file contains the OC4J Java Messaging Service (JMS) implementation configuration information. The following are the key components in this file:

  1. Host name or IP address
  2. Port number to which the JMS server binds
  3. Settings for queues bound to the JMDI tree
  4. Log settings

on the job:  The global application for the OC4J server acts as the parent for all applications in that OC4J instance. The applications inherit the parent application’s properties, but you can override the default parent application properties with application-specific properties.

{mospagebreak title=The Web Site XML Files}

The Web site–related XML files configure ports, protocols, and Web contexts for the OC4J Web site, and are in the following format:


The web-site.xml file contains the Web site configuration information, including the following:

  1. Host name, IP addresses, and listener ports
  2. Default Web application for the site
  3. SSL configuration
  4. Settings for user Web applications

Here’s a typical web-site.xml file:

<?xml version="1.0" standalone=’yes’?>
<!DOCTYPE web-site PUBLIC "OracleAS XML Web-site"  
<web-site host="localhost" port="3302" protocol="ajp13"
 display-name="My Java Web Site" cluster-island="1" >
<web-site port="3302" protocol="ajp13" display-name="My Java Web Site">
<!–The default web-app for this site, bound to the root–>
<default-web-app application="default" name="defaultWebApp" root="/j2ee" />
<web-app application="default" name="dms" root="/dmsoc4j" access-log="false" /> <access-log path="../log/default-web-access.log" />

exam watch:  The web-site.xml file is the OC4J Web server configuration file.

Here are the key elements of the web-site-xml file:

  • web-site   The name of your Web site.
  • host   The name of the server hosting the Web server.
  • display-name   A user-friendly Web site name.
  • default-web-app   The default Web application.
  • name   The name of the WAR file for the application, minus its .war extension.
  • port   The Oracle HTTP Server forwards requests over the AJP listening port defined here. The OPMN configuration contains information about the range of AJP ports that can be used.
  • protocol   The protocol used is AJP1.3, which is the Apache Jserver Protocol, used by mod_oc4j running on the Oracle HTTP Server (which is based on the Apache Web server), to communicate with the OC4J instance.
  • root   The value for this attribute is /j2ee in our example; note that this must match the value specified for the Oc4jMount command in the oc4j.conf file. The root variable shows the root context for the application off your Web site. If your Web site is http://myhost:7777/j2ee, you initiate your application by going to http://myhost:7777/j2ee/testapp (testapp is the name of your J2EE application).
  • access-log   Name of the log where access information is logged.

Please check back next week for the continuation of this article.

[gp-comments width="770" linklove="off" ]

chat sex hikayeleri Ensest hikaye