Skip Headers

Oracle Application Server Containers for J2EE Stand Alone User's Guide
10g (9.0.4)

Part Number B10323-01
Go To Documentation Library
Home
Go To Table Of Contents
Contents
Go To Index
Index

Go to previous page Go to next page

A
Additional Information

This appendix contains complete information about the following topics:

Description of XML File Contents

OC4J uses configuration and deployment XML files. The following sections describe each of these files and their function.

OC4J Configuration XML Files

This section describes the following XML files, which are necessary for OC4J configuration:

server.xml

This file contains the configuration for the application server. The server.xml file is the root configuration file--it contains references to other configuration files. In this file, specify the following:

http-web-site.xml

This file contains the configuration for a Web site. In the http-web-site.xml file, specify the following:

jazn-data.xml

This file contains security information for the OC4J server. It defines the user and group configuration for employing the default JAZNUserManager.

In the jazn-data.xml file, specify the following:

principals.xml

This file contains security information for the OC4J server. It defines the user and group configuration for employing the XMLUserManager, which is no longer the default security manager. In the principals.xml file, specify the following:

data-sources.xml

This file contains configuration for the data sources that are used. In addition, it contains information on how to retrieve JDBC connections. In the data-sources.xml file, specify the following:

jms.xml

This file contains the configuration for the OC4J Java Message Service (JMS) implementation. In the jms.xml file, specify the following:

rmi.xml

This file contains configuration for the Remote Method Invocation (RMI) system. It contains the setting for the RMI listener, which provides remote access for EJBs. In the rmi.xml file, specify the following:

J2EE Deployment XML Files

The OC4J-specific deployment XML files contain deployment information for different components. If you do not create the OC4J-specific files, they are automatically generated when the application is deployed. You can edit OC4J-specific deployment XML files manually. OC4J uses these files to map environment entries, resources references, and security-roles to actual deployment-specific values.

This section describes the following XML files necessary for J2EE application deployment:

The J2EE application.xml File

This file identifies the Web or EJB applications that are contained within the J2EE application. See "Elements in the application.xml File" for a list of the elements.

The OC4J-Specific orion-application.xml File

This file configures the global application. In the orion-application.xml file, specify the following:

See "Elements in the orion-application.xml File" for a list of the elements.

The J2EE ejb-jar.xml File

This file defines the deployment parameters for the EJBs in this JAR file. See the Sun Microsystems EJB specification for a description of these elements.

The OC4J-Specific orion-ejb-jar.xml File

This file is the OC4J-specific deployment descriptor for EJBs. In the orion-ejb-jar.xml file, specify the following:

See the appendix in the Oracle Application Server Containers for J2EE Enterprise JavaBeans Developer's Guide for description of the elements.

The J2EE web.xml File

This file contains deployment information about the servlets and JSPs in this application. See the Sun Microsystems specifications for a description of these elements.

The OC4J-Specific orion-web.xml File

This is the OC4J-specific deployment descriptor for mapping Web settings. This XML file contains the following:

See the appendix in the Oracle Application Server Containers for J2EE Servlet Developer's Guide for description of the elements.

The J2EE application-client.xml File

This file contains JNDI information for accessing the server application and other client information. See "Elements in the application-client.xml File" for a list of the elements.

The OC4J-Specific orion-application-client.xml File

This OC4J-specific deployment file is for the client application. It contains JNDI mappings and entries for the client.

See "Elements in the orion-application-client.xml File" for a list of the elements.

Elements in the server.xml File

The server.xml file is where you perform the following tasks:

Configure OC4J

Configuring the OC4J server includes defining the following elements in the server.xml file:

Reference Other Configuration Files

Referencing other configuration files in the server.xml file includes specifying the following:

Several XML files and directories are defined in the server.xml file. The path to these files or directories can be relative or absolute. If relative, the path should be relative to the location of the server.xml file.

<application-server> Element Description

The top level element of the server.xml file is the <application-server> element.

<application-server>

This element contains the configuration for an application server.

Attributes:

Elements Contained Within <application-server>

Within the <application-server> element, you can configure the following elements, which are listed alphabetically and not by DTD ordering:

<application>

An application is an entity with its own set of users, Web applications, and EJB JAR files.

Attributes:

<compiler>

This element is deprecated for version 9.0.4 and later. See the <java-compiler> element for the alternative. For previous releases, it specifies an alternative compiler (such as Jikes) for EJB/JSP compiling.

Attributes:

<execution-order>

This element defines the order in which the startup classes are executed. The value is an integer. OC4J loads from 0 on up. If there are duplicate numbers, then OC4J chooses the ordering for those classes.

<global-application>

The default application for this server. This element acts as a parent to other applications for object visibility.

Attributes:

<global-thread-pool>

You can specify unbounded, one, or two thread pools for an OC4J process through this element. If you do not specify this element, then an infinite number of threads can be created. See "Thread Pool Settings" for a full description.

Attributes:

<global-web-app-config>

Attributes:

<init-library>

Attributes:

<init-param>

Attributes:

<javacache-config>

Attributes:

<java-compiler>

You can specify an alternative compiler--either in or out of process--for your JSP and EJB compilation. The default compiler is an out of process javac compiler found in the JDK bin directory.

Attributes:

The following four examples define alternate compilers in this element:

<java-compiler name="jikes" bindir="C:\java\jikes\bin" 
	in-process="false" />
<java-compiler name="ojc" bindir="C:\java\jdev\jdev\bin" 
	in-process="false"/>
<java-compiler name="classic" in-process="true" />
<java-compiler name="modern" in-process="true" />

<jms-config>

Attribute:

<log>

<max-http-connections>

Defines the maximum number of concurrent connections any given Web site can accept at a single point in time. If text exists inside the element, it is used as a redirect-URL when the limit is reached.

Attributes:

<rmi-config>

Attribute:

<sep-config>

The <sep-config> element in this file specifies the pathname, normally internal-settings.xml, for the server extension provider properties.

Attribute:

<sfsb-config>

Passivation for stateful session beans is automatically done, unless you set the enable-passivation attribute for this element to false. For more information on stateful session bean passivation, see the Advanced chapter in the Oracle Application Server Containers for J2EE Enterprise JavaBeans Developer's Guide.

Attribute

<shutdown-classes>

Shutdown classes can be defined by the user, and are executed after undeployment, but before the core services are stopped.

<shutdown-class>

Each startup class is defined within the <startup-class> element.

Attributes:

<startup-classes>

Startup classes can be defined by the user, and will be executed after the core services (JMS, RMI) are started, but before applications are deployed. The shutdown classes are executed after undeployment, but before the core services are stopped.

<startup-class>

Each startup class is defined within the <startup-class> element.

Attributes:

<transaction-config>

Transaction configuration for the server.

Attribute:

<web-site>

Attribute:

Elements in the application.xml File

<application> Element Description

The top level element of the application.xml file is the <application> element.

Elements Contained Within <application>

Within the <application> element, the following elements, which are listed alphabetically and not by DTD ordering, can be configured:

<alt-dd>path/to/dd</alt-dd>

The alt-dd element specifies an optional URI to the post-assembly version of the deployment descriptor file for a particular J2EE module. The URI must specify the full pathname of the deployment descriptor file relative to the application's root directory. If alt-dd is not specified, the deployer must read the deployment descriptor from the default location and file name required by the respective component specification.

<connector>context</connector>

The connector element specifies the URI of a resource adapter archive file, relative to the top level of the aplication package.

<context-root>thedir/</context-root>

The context-root element specifies the context root of a web application.

<description>A description.</description>

The description element provides a human readable description of the application. The description element should include any information that the application assembler wants to provide the deployer.

<display-name>The name.</display-name>

The display-name element specifies an application name. The application name is assigned to the application by the application assembler and is used to identify the application to the deployer at deployment time.

<ejb>pathToEJB.jar</ejb>

The ejb element specifies the URI of a EJB JAR, relative to the top level of the application package.

<icon>

The icon element contains a small-icon and a large-icon element which specify the location within the application for a small and large image used to represent the application in a GUI tool.

<java>pathToClient.jar</java>

The java element specifies the URI of a Java application client module, relative to the top level of the application package.

<large-icon>path/to/icon.gif</large-icon>

The large-icon element contains the location within the application of a file containing a large (32x32 pixel) icon image. The image must be either GIF or JPEG format and the filename must end with the extension of ".gif" or ".jpg".

<module>

The module element represents a single J2EE module and contains an EJB, Java, or Web element, which indicates the module type and contains a path to the module file, and an optional alt-dd element, which specifies an optional URI to the post-assembly version of the deployment descriptor. The application deployment descriptor must have one module element for each J2EE module in the application package.

<role-name>nameOfRole</role-name>

The name of the role.

<security-role>

The security-role element contains the definition of a security role which is global to the application. The definition consists of a description of the security role, and the security role name. The descriptions at this level override those in the component level security role definitions and must be the descriptions tool display to the deployer.

<small-icon>path/to/icon.gif</small-icon>

The small-icon element contains the location within the application of a file containing a small (16x16 pixel) icon image. The image must be either GIF or JPEG format and the filename must end with the extension of ".gif" or ".jpg".

<web>

The web element contains the web-uri and context-root of a Web application module.

<web-uri>pathTo.war</web-uri>

The web-uri element specifies the URI of a web application file, relative to the top level of the application package.

Elements in the orion-application.xml File

<orion-application> Element Description

The top level element of the orion-application.xml file is the <orion-application> element.

Attributes:

Elements Contained Within <orion-application>

Within the <orion-application> element, the following elements, which are listed alphabetically and not by DTD ordering, can be configured:

<argument value="theValue" />

An argument used when invoking the client.

Attribute:

<arguments>

A list of arguments to used when invoking the application client if starting it in-process (auto-start="true").

<client-module auto-start="true|false" deployment-time="073fc2ab513bc3ce" path="myappclient.jar" user="theUser">

An application client module of the application. An application client is a GUI or console-based standalone client that interacts with the server.

Attributes:

<commit-coordinator>

Configure the two-phase commit engine.

<commit-class class="com.evermind.server.OracleTwoPhaseCommitDriver" />

Attribute:

<connectors path="./oc4j-connectors.xml" />

Attribute:

<data-sources path="./data-sources.xml" />

Attribute:

<description>A short description</description>

A short description of this component.

<ejb-module path="myEjbs.jar" remote="true|false" />

An EJB JAR module of the application.

Attributes:

<file path="../log/server.log" />

A relative/absolute path to log events to.

Attribute:

<group name="theGroup" />

A group that this security-role-mapping implies. That is, all members of the specified group are included in this role.

Attribute:

<jazn provider="XML" location="./jazn-data.xml" />

Configure the OracleAS JAAS Provider to use the XML-based provider type.

Attributes:

<jazn-web-app auth-method="SSO" runas-mode="false" doasprivileged-mode="true" />

The filter element of JAZNUserManager.

Attributes:

<library path="../lib/" />

A relative/absolute path/URL to a directory or a JAR/ZIP to add as a library-path for this server. Directories are scanned for JARS/ZIP files to include at startup.

Attribute:

<log>

Logging settings.

<mail address="my@mail.address" />

An e-mail address to log events to. A valid mail-session also needs to be specified if this option is used.

Attribute:

<mail-session location="mail/TheSession" smtp-host="smtp.server.com">

The session SMTP-server host (if using SMTP).

Attributes:

<namespace-access>

Namespace (naming context) security policy for RMI clients.

<namespace-resource root="the/path">

A resource with a specific security setting.

Attribute:

<password-manager>

Specifies the UserManager that is used for the lookup of hidden passwords. If omitted, the current UserManager is used for authentication and authorization. For example, you can use a OracleAS JAAS Provider LDAP UserManager for the overall UserManager, but use a OracleAS JAAS Provider XML UserManager for checking hidding passwords.

To identify a UserManager, provide a <jazn> element definition within this element, as follows:

<password-manager>
	<jazn ...>
</password-manager>

<persistence path="./persistence" />

A relative (to the application root) or absolute path to a directory where application state should be stored across restarts.

Attribute:

<principals path="principals.xml" />

Attribute:

<property name="theName" value="theValue" />

Contains a name/value pair initialization param.

Attributes:

<read-access>

The read-access policy.

<resource-provider>

Define a JMS resource provider. To add a custom <resource-provider>, add the following to your orion-application.xml file:

<resource-provider class="providerClassName" name="JNDI name"> 
  <description> description </description> 
  <property name="name" value="value" /> 
</resource-provider>

In place of the user-replaceable constructs (those in italics) in the preceding code, do the following:

<security-role-mapping impliesAll="true|false" name="theRole">

The runtime mapping (to groups and users) of a role. Maps to a security-role of the same name in the assembly descriptor.

Attributes:

<user name="theUser" />

A user that this security-role-mapping implies.

Attribute:

<user-manager class="com.name.of.TheUserManager" display-name="Friendly UserManager name">

Specifies an optional user-manager to use. For example, user-managers are com.evermind.sql.DataSourceUserManager, com.evermind.ejb.EJBUserManager, and so on. These are used to integrate existing systems and provide custom user-managers for Web applications.

Attributes:

<web-module id="myWebApp" path="myWebApp.war" />

A Web application module of the application. Each Web application can be installed on any site and in any context on those sites (for instance http://www.myserver.com/myapp/).

Attributes:

<write-access>

The write access policy.

Elements in the application-client.xml File

<application-client> Element Description

The top level element of the application-client.xml file is the <application-client> element.

<application-client>

The application-client element is the root element of an application client deployment descriptor. The application client deployment descriptor describes the EJB components and external resources referenced by the application client.

Elements Contained Within <application-client>

Within the <application-client> element, the following elements, which are listed alphabetically and not by DTD ordering, can be configured:

<callback-handler>

The callback-handler element names a class provided by the application. The class must have a no args constructor and must implement the javax.security.auth.callback.CallbackHandler interface. The class will be instantiated by the application client container and used by the container to collect authentication information from the user.

<description>The description</description>

A short description.

<display-name>The name</display-name>

The display-name element contains a short name that is intended to be displayed by tools.

<ejb-link>EmployeeRecord</ejb-link>

The ejb-link element is used in the ejb-ref element to specify that an EJB reference is linked to an enterprise bean in the encompassing J2EE Application package. The value of the ejb-link element must be the ejb-name of an enterprise bean in the same J2EE Application package.

<ejb-ref>

The ejb-ref element is used for the declaration of a reference to an enterprise bean's home. The declaration consists of an optional description; the EJB reference name used in the code of the referencing application client; the expected type of the referenced enterprise bean; the expected home and remote interfaces of the referenced enterprise bean; and an optional ejb-link information. The optional ejb-link element is used to specify the referenced enterprise bean.

<ejb-ref-name>ejb/Payroll</ejb-ref-name>

The ejb-ref-name element contains the name of an EJB reference. The EJB reference is an entry in the enterprise bean's environment. It is recommended that name is prefixed with "ejb/".

<ejb-ref-type>Entity/Session</ejb-ref-type>

The ejb-ref-type element contains the expected type of the referenced enterprise bean. The ejb-ref-type element must be one of the following: Entity Session

<env-entry>

The env-entry element contains the declaration of an Enterprise JavaBean's environment entries. The declaration consists of an optional description, the name of the environment entry, and an optional value.

<env-entry-name>minAmount</env-entry-name>

The env-entry-name element contains the name of an Enterprise JavaBean's environment entry.

<env-entry-type>java.lang.String</env-entry-type>

The env-entry-type element contains the fully-qualified Java type of the environment entry value that is expected by the enterprise bean's code. The following are the legal values of env-entry-type: java.lang.Boolean, java.lang.String, java.lang.Integer, java.lang.Double, java.lang.Byte, java.lang.Short, java.lang.Long, and java.lang.Float.

<env-entry-value>100.00</env-entry-value>

The env-entry-value element contains the value of an Enterprise JavaBean's environment entry.

<home>com.aardvark.payroll.PayrollHome</home>

The home element contains the fully-qualified name of the Enterprise JavaBean's home interface.

<icon>

The icon element contains a small-icon and large-icon element which specify the URIs for a small and a large GIF or JPEG icon image used to represent the application client in a GUI tool.

<large-icon>lib/images/employee-service-icon32x32.jpg</large-icon>

The large-icon element contains the name of a file containing a large (32 x 32) icon image. The file name is a relative path within the application client JAR file. The image must be either in the JPEG or GIF format, and the file name must end with the suffix ".jpg" or ".gif" respectively. The icon can be used by tools.

<remote>com.wombat.empl.EmployeeService</remote>

The remote element contains the fully-qualified name of the Enterprise JavaBean's remote interface.

<res-auth>Application/Container</res-auth>

The res-auth element specifies whether the Enterprise JavaBean code signs on programmatically to the resource manager, or whether the Container will sign on to the resource manager on behalf of the bean. In the latter case, the Container uses information that is supplied by the Deployer. The value of this element must be one of the two following: Application or Container

<resource-env-ref>

The resource-env-ref element contains a declaration of an application's reference to an administered object associated with a resource in the application's environment. It consists of an optional descrioption, the resource environment reference name, and an indication of the resource environment reference type expected by the application code.

<resource-env-ref-name>

The resource-env-ref-name element specifies the name of a resource environment entry name used in the application code.

<resource-env-ref-type>

The resource-env-ref-type element specifies the type of a resource environment reference.

<resource-ref>

The resource-ref element contains a declaration of Enterprise JavaBean's reference to an external resource. It consists of an optional description, the resource factory reference name, the indication of the resource factory type expected by the enterprise bean code, and the type of authentication (Bean or Container).

<res-ref-name>name</res-ref-name>

The res-ref-name element specifies the name of a resource factory reference.

<res-sharing-scope>Shareable</res-sharing-scope>

The res-sharing-scope element specifies whether connections obtained through the given resource manager connection factory reference can be shared. The value of this element, if specified, must be one of the following: Shareable or Unshareable. The default value is Shareable.

<res-type>javax.sql.DataSource</res-type>

The res-type element specifies the type of the data source. The type is specified by the Java interface (or class) expected to be implemented by the data source.

<small-icon>lib/images/employee-service-icon16x16.jpg
</small-icon>

The small-icon element contains the name of a file containing a small (16 x 16) icon image. The file name is a relative path within the application client JAR file. The image must be either in the JPEG or GIF format, and the file name must end with the suffix ".jpg" or ".gif" respectively. The icon can be used by tools.

Elements in the orion-application-client.xml File

<orion-application-client> Element Description

The top level element of the orion-application-client.xml file is the <orion-application-client> element.

<orion-application-client>

An orion-application-client.xml file contains the deploy time information for a J2EE application client. It complements the application client assembly information found in application-client.xml.

Elements Contained Within <orion-application-client>

Within the <orion-application-client> element, the following elements, which are listed alphabetically and not by DTD ordering, can be configured:

<context-attribute name="name" value="value" />

An attribute sent to the context. The only mandatory attribute in JNDI is the 'java.naming.factory.initial,' which is the classname of the context factory implementation.

Attributes:

<ejb-ref-mapping location="ejb/Payroll" name="ejb/Payroll" />

The ejb-ref element is used for the declaration of a reference to another enterprise bean's home. The ejb-ref-mapping element ties this to a JNDI-location when deploying.

Attributes:

<env-entry-mapping name="theName">deploymentValue</env-entry-mapping>

Overrides the value of an env-entry in the assembly descriptor. It is used to keep the EAR (assembly) clean from deployment-specific values. The body is the value.

Attribute:

<lookup-context location="foreign/resource/location">

The specification of an optional javax.naming.Context implementation used for retrieving the resource. This is useful when hooking up with third party modules, such as a third party JMS server for instance. Either use the context implementation supplied by the resource vendor or if none exists write an implementation which in turn negotiates with the vendor software.

Attributes:

<resource-env-ref-mapping location="jdbc/TheDS" >

The resource-env-ref element is used for the declaration of a reference to an external resource, such as a data source, JMS queue, mail session, or similar. The resource-env-ref-mapping ties that element to a JNDI location during deployment.

Attributes:

<resource-ref-mapping location="jdbc/TheDS" name="jdbc/TheDSVar">

The resource-ref element is used for the declaration of a reference to an external resource such as a data source, JMS queue, mail session or similar. The resource-ref-mapping ties this to a JNDI-location when deploying.

Attributes:

Standalone OC4J Command-Line Options and Properties

You start OC4J through oc4j.jar. You manage OC4J through the admin.jar tool. The following sections describe the options for each JAR.

Options for the OC4J Server JAR

The oc4j.jar command-line options enable you to start, stop, and install OC4J.

Table A-2 lists all the oc4j.jar command-line options:

Table A-2 OC4J Command-Line Options  
Command-Line Options Description

-install

Installs the server and activates the admin account. Rewrites text files to match the operating system line feed. This should be used only the first time.

-quiet

Supress standard output.

-config

Specifies a location for the server.xml file.

-out [file]

Specifies a file to route the standard output to. The file contains messages that are printed to System.out, as well as the messages sent to output through the servlet logging interface. If not specified, all output is written to standard out.

-err [file]

Specifies a file to route standard error to. The file contains messages that are printed to System.err. If not specified, all errors are written to standard error.

-verbosity

Define an integer between 1 and 10 to set the verbosity level of the message output. Example: -verbosity 10. See Example 2-5 for an example of this option.

-monitorResourceThreads

Enables backup debugging of thread resources. Enable this only if you have problems that relates to threads getting stuck in critical sections of code.

-userThreads

Enables context lookup support from user-created threads.

-version

Prints the version and exits.

-? -help

Prints the help message.

Options for the OC4J Administration Management JAR

The admin.jar command-line tool enables you to administer any stand alone OC4J from a client-admin console using a command line.

The syntax is as follows:

java -jar admin.jar ormi://oc4j_host:oc4j_ormi_port admin_id 
admin_password options

The options for the admin.jar command-line tool cover the four subjects below:

General OC4J Administration

Table A-3 lists the admin.jar options for general OC4J administration. For example, the following command shuts down the OC4J server:

java -jar admin.jar ormi://oc4j_host:oc4j_ormi_port admin_id 
admin_password -shutdown
Table A-3 Options for OC4J Administration  
Option Description

-shutdown
[ordinary | force]
[reason]

Shuts down the OC4J server. The default is "ordinary." Ordinary allows each thread to terminate normally. Force terminates all threads immediately. The reason is a string that is logged with the termination.

-restart
[reason]

Restarts the OC4J server. The container must have been started with oc4j.jar. The reason is a string that is logged with the restart.

Application Deployment

Table A-4 lists the admin.jar options for OC4J application administration. For example, the following command structure is used to deploy an application:

java -jar admin.jar ormi://oc4j_host:oc4j_ormi_port admin_id 
admin_password -deploy -file path/filename
-deploymentName app_name -targetPath deploy_dir

The following command structure is used to bind a Web application:

java -jar admin.jar ormi://oc4j_host:oc4j_ormi_port admin_id 
admin_password -bindWebApp app_name web_app_name
web_site_name context_root
Table A-4 Options for Application Deployment  
Option Description

-deploy

Deploy (redeploy) an application. Supply application information in the following subswitches:

-file path/filename: Required. The path and filename of the EAR file to deploy.

-deploymentName app_name: Required. The user-defined application deployment name. This same name is used to identify the application within OC4J. It is also provided when you want to undeploy the application.

-targetPath deploy_dir: Optional. The path on the server node to deploy archive into. Default is the applications/ directory. It is best to provide a target path to the directory where the EAR file is copied for deployment.

If -targetPath is not specified, the EAR file is copied to the applications/ directory. OC4J maintains a unique name for the EAR file. Thus, when you redeploy the EAR file, OC4J renames the file by prepending an underscore character ('_') in front of the name to ensure that another application's EAR file is not overwritten. Each successive deployment will cause another underscore character to be prepended to the EAR file. However, if it is the same application, the applications/ directory contains a separate EAR file for each deployment. If you provide a target path, this problem does not occur.

-parent parent_appname: Optional. The parent application of this application. When deployed, any method within the child application can invoke any method within the parent application. This is a means to enable methods in one JAR to see EJBs that have been deployed in another JAR. This is useful to deploy all service EJBs in a single JAR file, where its users declare the service application as its parent. The default is the global application.

-deploymentDirectory path: Optional. If not specified, the application is deployed into the application-deployments/ directory. To change where the application is deployed, provide a path with this option. If you supply the string "[NONE]", the deployment configurations are always read from the EAR file each time the application is deployed.

-bindWebApp
app_name web_app_name
web_site_name context_root

Bind a Web application to the specified site and root.

  • app_name is the application name, which is the same name used in -deploymentName on the -deploy option. Also note that this is the same name that is saved in the <application name=app_name> attribute in the server.xml file.

  • web_app_name is the name of the WAR file contained within the EAR file--without the .WAR extension.

  • web_site_name is the name of the name-web-site.xml file that denotes the Web site that this Web application should be bound to. This is the file that will receive the Web application definition.

  • context_root is the root context for the Web module.

This option creates an entry in the OC4J name-web-site.xml configuration file that was denoted in the web_site_name variable.

-updateConfig

If you have set check-for-updates to false, then OC4J does not automatically refresh modifications of the XML files. You have to execute this flag to have OC4J upload all of the new changes to these files.

-undeploy app_name

Removes the deployed J2EE application from the OC4J Web server. The app_name is the name provided on the -deploymentName subswitch. This results in the following:

  • Application is removed from the OC4J runtime and the server.xml file.

  • Bindings for all the application's Web modules are removed from all the Web sites to which the Web modules were bound.

  • Application files are removed from both the applications and application-deployments directories.

-keepFiles: Optional subswitch that prevents application files from being removed. However, the application is removed from the runtime and the Web modules are unbound.

-deploymentDirectory "[NONE]"

If you specify this flag as "[NONE]", then OC4J uses the orion-ejb-jar.xml deployment descriptor in the current deployment to be used instead of the deployment descriptor from a previous deployment within the application-deployments directory.

-iiopClientJar

You can convert an EJB to use RMI/IIOP, making it possible for EJBs to invoke one another across EJB containers. See the RMI/IIOP chapter in the Oracle Application Server Containers for J2EE Services Guide for full details.

Adding Web Sites

The -site option enables you to add Web site configuration to the XML files. Table A-5 lists all the subswitches for the -site option of the admin.jar command-line tool.

For example, the following command structure installs a new Web site:

java -jar admin.jar ormi://oc4j_host:oc4j_ormi_port admin_id 
admin_password -site -add -host hostname -port portnumber
-display-name name -virtual-hosts virtual_host
Table A-5 Options for Web Site Administration  
-site options Description

-site -add

Installs a new Web site. Supply information with the following subswitches:

-host hostname: The host where the web site exists.

-port portnum: The Web site port.

-display-name name: The name of the Web site.

-virtual-hosts virtual_hosts: The virtual hosts of the Web site.

-secure true|false: The value is true if the Web site is secure, otherwise the value is false.

-factory factory_name: The name of the SSLServerSocketFactory class if you are not using the Java Secure Socket Extension (JSSE). The JSSE defines a provider interface that other security providers can implement. Sun Microsystems provides its own implementation in com.sun.net.ssl.internal.ssl.Provider.

-keystore keystore: The relative or absolute path to a keystore.

-storepass password: The keystore password.

-provider provider: The provider used if using JSSE, defaults to com.sun.net.ssl.internal.ssl.Provider.

-needs-client-auth true|false: If set to true, a client that wants to access a J2EE Web site needs to identify itself with a digital certificate. If set to false, a client does not need to identify itself with a digital certificate. The default is false.

-site -remove

Removes an existing Web site. Supply the host and port of this Web site with the following subswitches:

-host hostname: The Web site host to be removed.

-port portnum: The Web site port to be removed.

-site -test

Tests an existing Web site. Supply the host and port of the Web site to be tested with the following subswitches:

-host hostname: The Web site host to be tested.

-port portnum: The Web site port to be tested.

-site -list

Lists all existing Web sites.

-site -update

Updates an existing Web site. Supply information with the following subswitches:

-oldHost hostname: The old host of the Web site. You can change the Web site host and port with the "old" and "new" subswitches.

-oldPort portnum: The old port of the Web site.

-newHost hostname: The new host of the Web site.

-newPort portnum: The new port of the Web site.

-display-name name: The new display name of the Web site.

-virtual-hosts vhosts: The new virtual hosts of the Web site.

-secure true|false: If set to true, the Web site is secure. If set to false, the Web site is not secure. The default is false.

-factory classname: The new name of the SSLServerSocketFactory class if you are not using JSSE.

-keystore path: The new relative or absolute path to a keystore.

-storepass password: The new keystore password.

-provider provider: The new provider used if you are not using JSSE.

-needs-client-auth true|false: If set to true, a client that wants to access a J2EE Web site needs to identify itself with a digital certificate. If set to false, a client does not need to identify itself with a digital certificate. The default is false.

DataSource And Application Options

Table A-6 lists the -application option subswitches for the admin.jar command-line tool. The -application takes in a name of an application before the subswitch command. This name can be one of the following:

This name, while a string, should not be enclosed in quotes. For example, the following command lists all data source objects defined:

java -jar admin.jar ormi://oc4j_host:oc4j_ormi_port admin_id 
admin_password -application default -listDataSource
Table A-6 Options For Application And Data Source Management  
-application Option Description

-application name -restart

Restarts the application. This triggers auto-deployment if enabled and a file has been touched.

-application name -addUser username password

Adds a user to the security file (principals.xml).

-application name -dataSourceInfo

Retrieves the dynamic usage information about the installed DataSource objects.

-application name -listDataSource

Retrieves the statically configured information about each installed DataSource object.

-application name -testDataSource

Tests an existing DataSource. Supply information with the following subswitches:

-location location: The namespace location for the DataSource. For example, jdbc/DefaultDS. Required.

-username username: The username you use to login along with a password. Optional.

-password password: The password to log in with. Optional.

-application name -installDataSource

Installs a new DataSource. Supply information within the following subswitches:

-jar JARfile: The JAR file containing the driver that is to be added to the library of the server.

-url URL: The JDBC database URL.

-location JNDIlocation: The namespace location for the raw source. For example, "jdbc/DefaultPooledDS". Required.

-pooledLocation JNDIlocation: The namespace location for the pooled source. For example, "jdbc/DefaultPooledDS".

-xaLocation JNDIlocation: The namespace location for the XA source. For example, "jdbc/xa/DefaultXADS". Requied if -ejbLocation is specified.

-ejbLocation JNDIlocation: The namespace location for the container-managed transactional data source. This is the only data source that can perform global JTA transactions. For example, "jdbc/DefaultDS".

-username username: The username to log in with.

-password password: The password to log in with.

-connectionDriver driverClass: The JDBC database driver class.

-classname DSclass: The data source class name, such as com.evermind.sql.DriverManagerDataSource. Required.

-sourceLocation jndiDS: The underlying data source of this specialized data source.

-xaSourceLocation jndiXADS: The underlying XA data source of this specialized data source.

-application name -removeDataSource

Remove an existing DataSource. Supply information with the following subswitches:

-location JNDIlocation: The namespace location for the DataSource. For example, jdbc/DefaultDS. Required.

-application name -updateDataSource

Update an existing DataSource. Supply information with the following subswitches:

-oldLocation JNDIlocation: The old namespace location for the DataSource. For example, jdbc/DefaultDS. Required.

-newLocation JNDIlocation: The new namespace location for the DataSource. For example, jdbc/DefaultDS.

-jar JAR: The JAR file containing the driver to add to the library of the server.

-url URL: The JDBC database URL.

-pooledLocation JNDIlocation: The namespace location for the pooled source. For example, jdbc/DefaultPooledDS.

-xaLocation JNDIlocation: The namespace location for the XA DataSource. For example, jdbc/xa/DefaultXADS. Required if -ejbLocation is specified.

-ejbLocation JNDIlocation: The namespace location for the data source for container-managed transactions. This is the only data source that can perform global JTA transactions. For example, jdbc/DefaultDS.

-username username: The username you use to login.

-password password: The password you use to login.

-connectionDriver driverClass: The JDBC database driver class. For example, com.mydb.Driver.

-className dsClass: The data source class name. For example, com.evermind.sql.DriverManagerDataSource.

-sourceLocation jndiDS: The underlying data source of this specialized data source.

-xaSourceLocation jndiXADS: The underlying XA data source of this specialized data source.

OC4J System Properties

You can set system properties on the OC4J command-line before startup. If OC4J is running, you must restart the instance for these to take effect. All system properties are prefaced with a -D. For example, -DGenerateIIOP.

For more information about debugging properties, see "OC4J Debugging".

Configuration and Deployment Examples

The following examples show how to configure and deploy a J2EE application within OC4J. See "Configuring the FAQ Application Demo" to learn how to modify the XML configuration files for the FAQ application demo.

J2EE Application XML Configuration Example

In this example, the myapp application contains a Java client, an EJB assembled into a JAR file, servlets and JSPs assembled into a WAR file, and an EAR file that contains both the EJB JAR file and the Web application WAR file. The tree structure showing the location of all the XML configuration files, the Java class files, and the JSP files is shown in Figure A-1. Notice that you can separate all the configuration files into logical directories within the application directory.

Figure A-1 Application EAR Structure

Text description of apdx_aa.gif follows

Text description of the illustration apdx_aa.gif

application.xml Example

The myapp/META-INF/application.xml file lists the EJB JAR and Web application WAR file that is contained in the EAR file using the <module> elements.

<?xml version="1.0"?>
<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE 
Application 1.3//EN" 
"http://java.sun.com/j2ee/dtds/application_1_3.dtd">
<application>
  <display-name>myapp j2ee application</display-name>
  <description>
     A sample J2EE application that uses a Container Managed
     Entity Bean and JSPs for a client.
  </description>
  <module>
    <ejb>myapp-ejb.jar</ejb>
  </module>
  <module>
    <web>
      <web-uri>myapp-web.war</web-uri>
      <context-root>/myapp</context-root>
    </web>
  </module>
</application>

web.xml Example

The myapp/web/WEB-INF/web.xml file contains the class definitions for EJBs, servlets, and JSPs that are executed within the Web site. The myapp Web module specifies the following in its descriptor:

The Web server looks for the following:

ejb-jar.xml Example

The ejb-jar.xml file contains the definitions for a container-managed persistent EJB. The myapp EJB deployment descriptor contains the following:

server.xml Addition

When you deploy the application using the admin.jar -deploy option, this adds the location of the application EAR file to the server.xml file. This causes the application to be started every time that OC4J is started. If you do not want the application to be started with OC4J, change the auto-start attribute to FALSE.


Note:

If you set auto-start to FALSE, you can manually start the application using the admin.jar tool or it is automatically started when a client requests the application.


<application name="myapp" path="../myapp/myapp.ear" 
auto-start="true" />

where

http-web-site.xml Addition

You must designate the WAR file name and define the root context for the Web application, which was deployed in the WAR file. You can either bind the Web context through the admin.jar -bindWebApp option or edit the http-web-site.xml file and add the following:

<web-app application="myapp" name="myapp-web" root="/myapp" /> 

Client Example

The application client that accesses the myapp application has a descriptor, which describes where to find the EJB stubs (home and remote interface) and its JNDI name.

The client XML configuration is contained in two files: application-client.xml and orion-application-client.xml.

The application-client.xml file contains a reference for an EJB, as follows:

<application-client>
	<display-name>TemplateBean</display-name>
	<ejb-ref>
		<ejb-ref-name>TemplateBean</ejb-ref-name>
		<ejb-ref-type>Entity</ejb-ref-type>
		<home>mTemplateHome</home>
		<remote>Template</remote>
	</ejb-ref>
</application-client>

The orion-application-client.xml file maps the EJB reference logical name to the JNDI name for the EJB. For example, this file maps the <ejb-ref-name> element, "TemplateBean," defined in the application-client.xml, to the JNDI name, "myapp/myapp-ejb/TemplateBean", as follows:

<orion-application-client>
	<ejb-ref-mapping name="TemplateBean" 
location="myapp/myapp-ejb/TemplateBean" />
</orion-application-client>
JNDI Properties for the Client

Set the JNDI properties for a regular client so it finds the initial JNDI context factory in one of the following manners:

Deploying Example

After developing your J2EE application, assemble the different modules of your J2EE application (EJB, Web, and client) into an EAR file. This section provides an example of a J2EE application with a EJB, Web, and client sections.

To deploy this application from the client using the admin.jar command-line tool, perform the following from the myapp directory. Notice that it defines the EAR file in the -file option and the target path for copying the EAR file into in the -targetPath option. Because the path where the EAR resides and the target path is the same, no copying occurs.

% java -jar $J2EE_HOME/admin.jar ormi://oc4j_host admin welcome 
-deploy -file ./myapp.ear -deploymentName myapp Auto-deploying myapp (New server version detected)... Auto-deploying myapp-ejb.jar (ejb-jar.xml had been touched since the previous deployment)... done. Auto-deploying myapp web application (New server version detected)...


Note:

The EJB JAR file is immediately unpacked; the WAR file is unpacked when you navigate to /myapp on the Web server.


EJB Module

When you deployed the EJB module, the following messages were received:

Auto-deploying myapp (New server version detected)...
Auto-creating table: create table TemplateBean (col_1 NUMBER not null 
primary key, col_2 VARCHAR2(255) null, col_3 FLOAT null)
Auto-deploying myapp-ejb.jar (Class 'myapp.myapp-ejb.Template' had been 
updated)... done.

OC4J created the TemplateBean table for you; however, you must first install a data source. You can use the admin.jar command-line tool to install the data source, as follows:

% java -jar admin.jar ormi://oc4j_host admin welcome  
-installDataSource -jar $ORACLE_HOME/jdbc/classes12.jar
-url jdbc:oracle:thin:@oc4j_host:1521:orcl
-connectionDriver oracle.jdbc.driver.OracleDriver
-location jdbc/DefaultOracleDS -username scott -password tiger

Web Module--Servlet and JSP Calling EJBs

To bind the Web component (WAR file) of a J2EE application (EAR file) on a Web site, do the following:

% java -jar admin.jar ormi://oc4j_host admin welcome 
-bindWebApp myapp myapp-web http-web-site /myapp

This adds the following to http-web-site.xml:

<web-app application="myapp" name="myapp-web" root="/myapp" />

Client Module--Standalone Java Client Invoking EJBs

Package your client module in a JAR file with the descriptor META-INF/application-client.xml.

Manifest File for the Client

Package the client in a runable JAR with a manifest that has the main class to run and required CLASSPATH, as shown below. Check that the relative paths in this file are correct. Verify that you point to the relative location of the required OC4J class libraries.

manifest.mf
-----------
Manifest-Version: 1.0
Main-Class: myapp.myapp-client.TemplateClient
Name: "TemplateClient"
Created-By: 1.2 (Sun Microsystems Inc.)
Implementation-Vendor: "Oracle"
Class-Path: ../../../j2ee/home/oc4J.jar ../../../j2ee/home/lib/jndi.jar 
../../../j2ee/home/lib/ejb.jar ../myapp-ejb.jar
Executing the Client

To execute the client, perform the following:

% java -jar myapp-client.jar 
TemplateClient.main(): start
Enter integer value for col_1: 1
Enter string value for col_2: BuyME
Enter float value for col_3: 99.9
Record added through bean


Go to previous page Go to next page
Oracle
Copyright © 2002, 2003 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Table Of Contents
Contents
Go To Index
Index