bea.com | products | dev2dev | support | askBEA |
|
e-docs > WebLogic Server > Developing WebLogic Server Applications > Application Deployment Descriptor Elements |
Developing WebLogic Server Applications |
Application Deployment Descriptor Elements
The following sections describe deployment descriptors for J2EE applications on WebLogic Server. Two deployment descriptors are required: a J2EE standard deployment descriptor named application.xml, and a WebLogic-specific application deployment descriptor named weblogic-application.xml. The weblogic-application.xml file is optional if you are not using any WebLogic Server extensions.
application.xml Deployment Descriptor Elements
The following sections describe the application.xml file.
The application.xml file is the deployment descriptor for Enterprise Application Archives. The file is located in the META-INF subdirectory of the application archive. It must begin with the following DOCTYPE declaration:
<!DOCTYPE application PUBLIC "-//Sun Microsystems,
Inc.//DTD J2EE Application 1.3//EN"
"http://java.sun.com/dtd/application_1_3.dtd">
The following diagram summarizes the structure of the application.xml deployment descriptor.
The following sections describe each of the elements that can appear in the file.
application is the root element of the application deployment descriptor. The elements within the application element are described in the following sections.
Optional. The icon element specifies the locations of small and large images that represent the application in a GUI tool. This element is not currently used by WebLogic Server.
Optional. Specifies the location for a small (16x16 pixel) .gif or .jpg image used to represent the application in a GUI tool. Currently, this is not used by WebLogic Server.
Optional. Specifies the location for a large (32x32 pixel) .gif or .jpg image used to represent the application in a GUI tool. Currently, this element is not used by WebLogic Server.
Optional. The display-name element specifies the application display name, a short name that is intended to be displayed by GUI tools.
The optional description element provides descriptive text about the application.
The application.xml deployment descriptor contains one module element for each module in the Enterprise Archive file. Each module element contains an ejb, java, or web element that indicates the module type and location of the module within the application. An optional alt-dd element specifies an optional URI to the post-assembly version of the deployment descriptor.
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 you do not specify alt-dd, the deployer must read the deployment descriptor from the default location and file name required by the respective component specification.
Specifies the URI of a resource adapter (connector) archive file, relative to the top level of the application package.
Defines an EJB module in the application file. Contains the path to an EJB JAR file in the application.
<ejb>petStore_EJB.jar</ejb>
Defines a client application module in the application file.
<java>client_app.jar</java>
Defines a Web application module in the application.xml file. The web element contains a web-uri element and a context-root element. If you do not declare a value for the context-root, then the basename of the web-uri element is used as the context path of the Web application. (Note that the context path must be unique in a given Web server. More than one Web application may be using the same Web server, so you must avoid having context path clashes across multiple applications.)
Defines the location of a Web module in the application.xml file. This is the name of the WAR file.
Specifies a context root for the Web application.
<web>
<web-uri>petStore.war</web-uri>
<context-root>estore</context-root>
</web>
The security-role element contains the definition of a security role which is global to the application. Each security-role element contains an optional description element, and a role-name element.
Optional. Text description of the security role.
Defines the name of a security role or principal that is used for authorization within the application. Roles are mapped to WebLogic Server users or groups in the weblogic-application.xml deployment descriptor.
<security-role>
<description>the gold customer role</description>
<role-name>gold_customer</role-name>
</security-role>
<security-role>
<description>the customer role</description>
<role-name>customer</role-name>
</security-role>
weblogic-application.xml Deployment Descriptor Elements
The following sections describe the weblogic-application.xml file. The weblogic-application.xml file is the BEA WebLogic Server-specific deployment descriptor extension for the application.xml deployment descriptor from Sun Microsystems. This is where you configure features such as application-scoped JDBC Pools and EJB Caching.
The file is located in the META-INF subdirectory of the application archive. It must begin with the following DOCTYPE declaration:
<!DOCTYPE weblogic-application PUBLIC "-//BEA Systems, Inc.//DTD WebLogic Application 7.1.0//EN"
"http://www.bea.com/servers/wls710/dtd/weblogic-application_2_0.dtd";>
The following sections describe each element that can appear in the file.
The weblogic-application element is the root element of the application deployment descriptor.
Optional. The ejb element contains information that is specific to the EJB modules that are part of a WebLogic application. Currently, one can use the ejb element to specify one or more application level caches that can be used by the application's entity beans.
One or more. The entity-cache element is used to define a named application level cache that is used to cache entity EJB instances at runtime. Individual entity beans refer to the application-level cache that they must use, referring to the cache name. There is no restriction on the number of different entity beans that may reference an individual cache.
Application-level caching is used by default whenever an entity bean does not specify its own cache in the weblogic-ejb-jar.xml descriptor. Two default caches named ExclusiveCache and MultiVersionCache are used for this purpose. An application may explicitly define these default caches to specify non-default values for their settings. Note that the caching-strategy cannot be changed for the default caches. By default, a cache uses max-beans-in-cache with a value of 1000 to specify its maximum size.
<entity-cache>
<entity-cache-name>ExclusiveCache</entity-cache-name>
<max-cache-size>
<megabytes>50</megabytes>
</max-cache-size>
</entity-cache>
The entity-cache-name element specifies a unique name for an entity bean cache. The name must be unique within an ear file and may not be the empty string.
<entity-cache-name>ExclusiveCache</entity-cache-name>
Optional. The max-beans-in-cache element specifies the maximum number of entity beans that are allowed in the cache. If the limit is reached, beans may be passivated. If 0 is specified, then there is no limit. This mechanism does not take into account the actual amount of memory that different entity beans require.
The max-cache-size element is used to specify a limit on the size of an entity cache in terms of memory size—expressed either in terms of bytes or megabytes. A bean provider should provide an estimate of the average size of a bean in the weblogic-ejb-jar.xml descriptor if the bean uses a cache that specifies its maximum size using the max-cache-size element. By default, a bean is assumed to have an average size of 100 bytes.
Optional. The read-timeout-seconds element specifies the number of seconds between ejbLoad calls on a read-only entity bean. If read-timeout-seconds is set to 0, ejbLoad will only be called when the bean is brought into the cache.
Optional. The caching-strategy element specifies the general strategy that the EJB container uses to manage entity bean instances in a particular application level cache. A cache buffers entity bean instances in memory and associates them with their primary key value.
The caching-strategy element can only have one of the following values:
<caching-strategy>Exclusive</caching-strategy>
Optional. Allows you to configure the EJB container to start Message Driven BeanS (MDBS) with the application. If set to true, the container starts MDBS as part of the application. If set to false, the container keeps MDBS in a queue and the server starts them as soon as it has started listening on the ports.
Optional. The xml element contains information about parsers and entity mappings for XML processing that is specific to this application.
Optional. The parser-factory element contains three elements: saxparser-factory?, document-builder-factory?, and transformer-factory?.
Optional. The saxparser-factory element allows you to set the SAXParser Factory for the XML parsing required in this application only. This element determines the factory to be used for SAX style parsing. If you do not specify the saxparser-factory element setting, the configured SAXParser Factory style in the Server XML Registry is used.
Default Value: Server XML Registry setting
Optional. The document-builder-factory element allows you to set the Document Builder Factory for the XML parsing required in this application only. This element determines the factory to be used for DOM style parsing. If you do not specify the document-builder-factory element setting, the configured DOM style in the Server XML Registry is used.
Default Value: Server XML Registry setting
Optional. The transformer-factory element allows you to set the Transformer Engine for the style sheet processing required in this application only. If you do not specify a value for this element, the value configured in the Server XML Registry is used.
Default value: Server XML Registry setting.
Zero or more. The entity-mapping element is used to specify entity mapping. This mapping determines the alternative entity URI for a given public or system ID. The default place to look for this entity URI is the lib/xml/registry directory.
The entity-mapping-name element specifies the name for this entity mapping.
Optional. The public-id element specifies the public ID of the mapped entity.
Optional. The system-id element specifies the system ID of the mapped entity.
Optional. The entity-uri element specifies the entity URI for the mapped entity.
The default value is cache-on-reference.
Optional. The cache-timeout-interval element allows you to specify the integer value in seconds.
Optional. The security element specifies security information for the application.
Zero or more. The jdbc-connection-pool element specifies an application-scoped JDBC connection pool.u
The data-source-name element specifies the JNDI name in the application-specific JNDI tree.
The connection-factory element defines the number of physical database connections to create when the pool is initialized. The default value is 1.
The factory-name element specifies the name of a JDBCDataSourceFactoryMBean in the config.xml file.
Optional. The connection-properties element specifies the connection parameters that define overrides for default connection factory settings.
Optional. The pool-params element defines parameters that affect the behavior of the pool.
Optional. The size-params element defines parameters that affect the number of connections in the pool.
Optional. The xa-params element defines the parameters for the XA DataSources.
Optional. Integer value. The login-delay-seconds element sets the number of seconds to delay before creating each physical database connection. Some database servers cannot handle multiple requests for connections in rapid succession. This property allows you to build in a small delay to let the database server catch up. This delay occurs both during initial pool creation and during the lifetime of the pool whenever a physical database connection is created.
Optional. The leak-profiling-enabled element enables JDBC connection leak profiling. A connection leak occurs when a connection from the pool is not closed explicitly by calling the close() method on that connection. When connection leak profiling is active, the pool stores the stack trace at the time the connection object is allocated from the pool and given to the client. When a connection leak is detected (when the connection object is garbage collected), this stack trace is reported.
This element uses extra resources and will likely slowdown connection pool operations, so it is not recommended for production use.
Optional. The connection-check-params element defines whether, when, and how connections in a pool is checked to make sure they are still alive.
Optional. The driver-params element sets behavior on WebLogic Server drivers.
Optional. profiling-enabled boolean. The prepared-statement element enables the running of JDBC prepared statement cache profiling. When enabled, prepared statement cache profiles are stored in external storage for further analysis. This is a resource-consuming feature, so it is recommended that you turn it off on a production server. The default value is false.
Zero or more. The application-param element defines various parameters that affect container behavior. These parameters are as follows:
A classloader-structure element allows you to define the organization of classloaders for this application. The declaration represents a tree structure that represents the classloader hierarchy and associates specific modules with particular nodes. A module's classes are loaded by the classloader that its associated with in this structure.
<classloader-structure>
<module-ref>
<module-uri>ejb1.jar</module-uri>
<module-uri>ejb2.jar</module-uri>
<classloader-structure>
<module-uri>ejb3.jar</module-uri>
</classloader-structure>
</classloader-structure>
The listener element is used to register user defined application lifecycle listeners. These are classes that extend the abstract base class weblogic.application.ApplicationLifecycleListener.
The listener-class element is the name of the users implementation of ApplicationLifecycleListener.
Optional. The listener-uri is a JAR file within the EAR that contains the implementation. If you do not specify the listener-uri, it is assumed that the class is visible to the application.
Use the startup element to register user-defined startup classes.
Use the startup-class element to define the name of the class to be run when the application is being deployed.
Optional. Use the startup-uri element to define a JAR file within the EAR that contains the startup-class. If startup-uri is not defined, then its assumed that the class is visible to the application.
The shutdown element is used to register user defined shutdown classes.
Use the shutdown-class element to define the name of the class to be run when the application is undeployed.
Optional. The shutdown-uri element is used to define a JAR file within the EAR that contains the shutdown-class. If you do not define the shutdown-uri element, it is assumed that the class is visible to the application.