JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle GlassFish Server 3.1 Application Deployment Guide
search filter icon
search icon

Document Information

Preface

1.  Overview of Oracle GlassFish Server 3.1 Application Deployment

2.  Deploying Applications

A.  The asadmin Deployment Subcommands

B.  GlassFish Server Deployment Descriptor Files

C.  Elements of the GlassFish Server Deployment Descriptors

activation-config

Superelements

Subelements

activation-config-property

Superelements

Subelements

activation-config-property-name

Superelements

Subelements

activation-config-property-value

Superelements

Subelements

admin-object-resource

Superelements

Subelements

Attributes

Properties

as-context

Superelements

Subelements

archive-name

Superelements

Subelements

auth-method

Superelements

Subelements

auth-realm

Superelements

Subelements

Attributes

Example

backend-principal

Superelements

Subelements

Attributes

bean-cache

Superelements

Subelements

Example

bean-pool

Superelements

Subelements

Example

cache

Superelements

Subelements

Attributes

Properties

Cache Class Names

cache-helper

Superelements

Subelements

Attributes

cache-helper-ref

Superelements

Subelements

cache-idle-timeout-in-seconds

Superelements

Subelements

cache-mapping

Superelements

Subelements

call-property

Superelements

Subelements

caller-propagation

Superelements

Subelements

cert-db

Superelements

Subelements

Attributes

check-all-at-commit

Superelements

check-modified-at-commit

Superelements

Subelements

check-version-of-accessed-instances

Superelements

Subelements

checkpoint-at-end-of-method

Superelements

Subelements

checkpointed-methods

Superelements

class-loader

Superelements

Subelements

Attributes

Properties

client-container

Superelements

Subelements

Attributes

Properties

client-credential

Superelements

Subelements

Attributes

cmp

Superelements

Subelements

cmp-field-mapping

Superelements

Subelements

cmp-resource

Superelements

Subelements

cmr-field-mapping

Superelements

Subelements

cmr-field-name

Superelements

Subelements

cmt-timeout-in-seconds

Superelements

Subelements

column-name

Superelements

Subelements

column-pair

Superelements

Subelements

commit-option

Superelements

Subelements

compatibility

Superelements

Subelements

confidentiality

Superelements

Subelements

connector-connection-pool

Superelements

Subelements

Attributes

Properties

connector-resource

Superelements

Subelements

Attributes

consistency

Superelements

Subelements

constraint-field

Superelements

Subelements

Attributes

constraint-field-value

Superelements

Subelements

Attributes

context-root

Superelements

Subelements

cookie-properties

Superelements

Subelements

Properties

create-tables-at-deploy

Superelements

Subelements

custom-resource

Superelements

Subelements

Attributes

database-vendor-name

Superelements

Subelements

debugging-enabled

Superelements

Subelements

default

Superelements

Subelements

default-helper

Superelements

Subelements

Properties

default-resource-principal

Superelements

Subelements

description

Superelements

Subelements

disable-nonportable-jndi-names

Superelements

Subelements

dispatcher

Superelements

Subelements

drop-tables-at-undeploy

Superelements

Subelements

ejb

Superelements

Subelements

Attributes

Example

ejb-name

Superelements

Subelements

ejb-ref

Superelements

Subelements

ejb-ref-name

Superelements

Subelements

eligible

Superelements

Subelements

endpoint-address-uri

Superelements

Subelements

Example

enterprise-beans

Superelements

Subelements

Example

entity-mapping

Superelements

Subelements

establish-trust-in-client

Superelements

Subelements

establish-trust-in-target

Superelements

Subelements

external-jndi-resource

Superelements

Subelements

Attributes

fetched-with

Superelements

Subelements

field-name

Superelements

Subelements

finder

Superelements

Subelements

flush-at-end-of-method

Superelements

Subelements

gen-classes

Superelements

Subelements

glassfish-application

Superelements

Subelements

glassfish-application-client

Superelements

Subelements

glassfish-ejb-jar

Superelements

Subelements

glassfish-web-app

Superelements

Subelements

Attributes

Properties

group-map

Superelements

Subelements

Attributes

group-name

Superelements

Subelements

http-method

Superelements

Subelements

idempotent-url-pattern

Superelements

Subelements

Attributes

Example

integrity

Superelements

Subelements

ior-security-config

Superelements

Subelements

is-cache-overflow-allowed

Superelements

is-one-one-cmp

Superelements

is-read-only-bean

Superelements

Subelements

java-method

Superelements

Subelements

java-web-start-access

Superelements

Subelements

jdbc-connection-pool

Superelements

Subelements

Attributes

GlassFish Server Properties

Database Properties

jdbc-resource

Superelements

Subelements

Attributes

jms-durable-subscription-name

Superelements

Subelements

jms-max-messages-load

Superelements

Subelements

jndi-name

Superelements

Subelements

jnlp-doc

Superelements

Subelements

jsp-config

Superelements

Subelements

Properties

keep-state

Superelements

Subelements

key-field

Superelements

Subelements

Attributes

level

Superelements

Subelements

local-home-impl

Superelements

Subelements

local-impl

Superelements

Subelements

locale-charset-info

Superelements

Subelements

Attributes

locale-charset-map

Superelements

Subelements

Attributes

Example Agents

localpart

Superelements

Subelements

lock-when-loaded

Superelements

Subelements

lock-when-modified

Superelements

log-service

Superelements

Subelements

Attributes

login-config

Superelements

Subelements

mail-resource

Superelements

Subelements

Attributes

Properties

manager-properties

Superelements

Subelements

Properties

mapping-properties

Superelements

max-cache-size

Superelements

Subelements

max-pool-size

Superelements

Subelements

max-wait-time-in-millis

Superelements

mdb-connection-factory

Superelements

Subelements

mdb-resource-adapter

Superelements

Subelements

message

Superelements

Subelements

message-destination

Superelements

Subelements

message-destination-name

Superelements

Subelements

message-destination-ref

Superelements

Subelements

message-destination-ref-name

Superelements

Subelements

message-security

Superelements

Subelements

message-security-binding

Superelements

Subelements

Attributes

message-security-config

Superelements

Subelements

Attributes

method

Superelements

Subelements

method-intf

Superelements

Subelements

method-name

Superelements

Subelements

Examples

method-param

Superelements

Subelements

method-params

Superelements

Subelements

name

Superelements

Subelements

named-group

Superelements

Subelements

namespaceURI

Superelements

Subelements

none

Superelements

Subelements

one-one-finders

Superelements

Subelements

operation-name

Superelements

Subelements

parameter-encoding

Superelements

Subelements

Attributes

pass-by-reference

Superelements

Subelements

password

Superelements

Subelements

per-request-load-balancing

Superelements

Subelements

pm-descriptors

Superelements

pool-idle-timeout-in-seconds

Superelements

Subelements

port-component-name

Superelements

Subelements

port-info

Superelements

Subelements

prefetch-disabled

Superelements

Subelements

principal

Superelements

Subelements

principal-map

Superelements

Subelements

Attributes

principal-name

Superelements

Subelements

Attributes

property (with attributes)

Superelements

Subelements

Attributes

Example

property (with subelements)

Superelements

Subelements

Example

provider-config

Superelements

Subelements

Attributes

query-filter

Superelements

Subelements

query-method

Superelements

Subelements

query-ordering

Superelements

Subelements

query-params

Superelements

Subelements

query-variables

Superelements

Subelements

read-only

Superelements

Subelements

realm

Superelements

Subelements

refresh-field

Superelements

Subelements

Attributes

refresh-period-in-seconds

Superelements

Subelements

removal-timeout-in-seconds

Superelements

Subelements

remote-home-impl

Superelements

Subelements

remote-impl

Superelements

Subelements

request-policy

Superelements

Subelements

Attributes

request-protection

Superelements

Subelements

Attributes

required

Superelements

Subelements

res-ref-name

Superelements

Subelements

resize-quantity

Superelements

Subelements

resource-adapter-config

Superelements

Subelements

Attributes

Properties

resource-adapter-mid

Superelements

Subelements

resource-env-ref

Superelements

Subelements

Example

resource-env-ref-name

Superelements

Subelements

resource-ref

Superelements

Subelements

Example

resources

Superelements

Subelements

response-policy

Superelements

Subelements

Attributes

response-protection

Superelements

Subelements

Attributes

role-name

Superelements

Subelements

sas-context

Superelements

Subelements

schema

Superelements

Subelements

Examples

schema-generator-properties

Superelements

Subelements

Properties

Example

secondary-table

Superelements

Subelements

security

Superelements

Subelements

security-map

Superelements

Subelements

Attributes

security-role-mapping

Superelements

Subelements

service-endpoint-interface

Superelements

Subelements

service-impl-class

Superelements

Subelements

service-qname

Superelements

Subelements

service-ref

Superelements

Subelements

service-ref-name

Superelements

Subelements

servlet

Superelements

Subelements

servlet-impl-class

Superelements

Subelements

servlet-name

Superelements

Subelements

session-config

Superelements

Subelements

session-manager

Superelements

Subelements

Attributes

session-properties

Superelements

Subelements

Properties

ssl

Superelements

Subelements

Attributes

steady-pool-size

Superelements

Subelements

store-properties

Superelements

Subelements

Properties

stub-property

Superelements

Subelements

Properties

Example

sun-cmp-mapping

Superelements

Subelements

sun-cmp-mappings

Superelements

Subelements

table-name

Superelements

Subelements

target-server

Superelements

Subelements

Attributes

tie-class

Superelements

Subelements

timeout

Superelements

Subelements

Attributes

transport-config

Superelements

Subelements

transport-guarantee

Superelements

Subelements

unique-id

Superelements

Subelements

url-pattern

Superelements

Subelements

user-group

Superelements

Subelements

use-thread-pool-id

Superelements

Subelements

value

Superelements

Subelements

valve

Superelements

Subelements

Attributes

Example

vendor

Superelements

Subelements

version-identifier

Superelements

Subelements

victim-selection-policy

Superelements

Subelements

Example

web

Superelements

Subelements

web-uri

Superelements

Subelements

webservice-description

Superelements

Subelements

webservice-description-name

Superelements

Subelements

webservice-endpoint

Superelements

Subelements

work-security-map

Superelements

Subelements

Attributes

wsdl-override

Superelements

Subelements

Example

wsdl-port

Superelements

Subelements

wsdl-publish-location

Superelements

Subelements

Example

Index

jdbc-connection-pool

Defines the attributes and properties that are required for creating a JDBC connection pool.

Superelements

resources (glassfish-resources.xml)

Subelements

The following table describes subelements for the jdbc-connection-pool element.

Table C-73 jdbc-connection-pool Subelements

Element
Required
Description
zero or one
Contains a text description of this element.
zero or more
Specifies a property or a variable.

Attributes

The following table describes attributes for the jdbc-connection-pool element. Changing the following attributes requires a server restart or the redeployment or disabling and re-enabling of applications that refer to the resource: datasource-classname, associate-with-thread, lazy-connection-association, and lazy-connection-enlistment.

Table C-74 jdbc-connection-pool Attributes

Attribute
Default
Description
name
none
Specifies the name of the connection pool. A jdbc-resource element’s pool-name attribute refers to this name.
datasource-classname
none
(optional) Specifies the class name of the associated vendor-supplied data source. This class must implement javax.sql.DataSource, javax.sql.XADataSource , javax.sql.ConnectionPoolDatasource, or a combination.
res-type
none
(optional) Specifies the interface the data source class implements. The value of this attribute can be javax.sql.DataSource, javax.sql.XADataSource , javax.sql.ConnectionPoolDatasource, or java.sql.Driver. To support configuration of JDBC drivers and applications that use java.sql.Driver implementations, set this attribute to java.sql.Driver. This attribute must be specified to avoid ambiguity when a data source class implements two or more of these interfaces or when a driver-classname is specified. An error occurs if this attribute has a legal value and the indicated interface is not implemented by the data source class.
driver-classname
none
(optional) Specifies the vendor-supplied JDBC driver class name. This driver must implement the java.sql.Driver interface.
ping
false
(optional) Specifies whether to ping the pool during pool creation or reconfiguration to identify and warn of any erroneous attribute values.
steady-pool-size
8
(optional) Specifies the initial and minimum number of connections maintained in the pool.
max-pool-size
32
(optional) Specifies the maximum number of connections that can be created to satisfy client requests.
max-wait-time-in-millis
60000
(optional) Specifies the amount of time, in milliseconds, that the caller is willing to wait for a connection. If 0, the caller is blocked indefinitely until a resource is available or an error occurs.
pool-resize-quantity
2
(optional) Specifies the number of idle connections to be destroyed if the existing number of connections is above the steady-pool-size (subject to the max-pool-size limit).

This is enforced periodically at the idle-timeout-in-seconds interval. An idle connection is one that has not been used for a period of idle-timeout-in-seconds. When the pool size reaches steady-pool-size, connection removal stops.

idle-timeout-in-seconds
300
(optional) Specifies the maximum time that a connection can remain idle in the pool. After this amount of time, the pool can close this connection.

This timeout value must be kept shorter than the server side (database) timeout value to prevent the accumulation of unusable connections in the application.

transaction-isolation-level
default JDBC driver isolation level
(optional) Specifies the transaction isolation level on the pooled database connections. Allowed values are read-uncommitted, read-committed , repeatable-read, or serializable.

Applications that change the isolation level on a pooled connection programmatically risk polluting the pool, which can lead to errors. See is-isolation-level-guaranteed for more details.

is-isolation-level-guaranteed
true
(optional) Applicable only when transaction-isolation-level is explicitly set. If true, every connection obtained from the pool is guaranteed to have the desired isolation level. This might impact performance on some JDBC drivers. Only set this attribute to false if you are certain that the hosted applications do not return connections with altered isolation levels.
is-connection-validation-required
false
(optional) Specifies whether connections have to be validated before being given to the application. If a resource’s validation fails, it is destroyed, and a new resource is created and returned.
connection-validation-method
table
(optional) Legal values are as follows:
  • auto-commit, which uses Connection.setAutoCommit(Connection.getAutoCommit())

  • meta-data, which uses Connection.getMetaData()

  • table, which performs a query on a table specified in the validation-table-name attribute

  • custom-validation, which uses a user-defined validation mechanism specified by the custom implementation class in validation-classname.

Because many JDBC drivers cache the results of auto-commit and meta-data calls, they do not always provide reliable validations. Check with the driver vendor to determine whether these calls are cached or not.

The table must exist and be accessible, but it doesn't require any rows. Do not use an existing table that has a large number of rows or a table that is already frequently accessed.

validation-table-name
none
(optional) Specifies the table name to be used to perform a query to validate a connection. This parameter is mandatory if and only if connection-validation-method is set to table.
validation-classname
none
(optional) Specifies the custom validation implementation class name. This parameter is mandatory if connection-validation-method is set to custom-validation. The classname provided must be accessible to the GlassFish Server. The specified class must implement the org.glassfish.api.jdbc.ConnectionValidation interface.

GlassFish Server provides the following custom validation class templates for MSSQL, DB2, and Sybase databases. All of them implement the org.glassfish.api.jdbc.ConnectionValidation interface.

  • org.glassfish.api.jdbc.MSSQLConnectionValidation

  • org.glassfish.api.jdbc.DB2ConnectionValidation

  • org.glassfish.api.jdbc.SybaseConnectionValidation

init-sql
none
(optional) Specifies an SQL string to be executed whenever a connection is created (not reused) in the pool. This initializes the state of the connection.
fail-all-connections
false
(optional) If true, closes all connections in the pool if a single validation check fails. This parameter is mandatory if and only if is-connection-validation-required is set to true.
non-transactional-connections
false
(optional) If true, non-transactional connections can be made to the JDBC connection pool. These connections are not automatically enlisted with the transaction manager.
allow-non-component-callers
false
(optional) If true, non-Java-EE components, such as servlet filters, lifecycle modules, and third party persistence managers, can use this JDBC connection pool. The returned connection is automatically enlisted with the transaction context obtained from the transaction manager. Standard Java EE components can also use such pools. Connections obtained by non-component callers are not automatically closed at the end of a transaction by the container. They must be explicitly closed by the caller.
validate-atmost-once-period-in-seconds
0
(optional) Specifies the time interval within which a connection is validated at most once. Minimizes the number of validation calls.

A value of zero implies that GlassFish Server does not attempt to minimize the number of validation requests by a connection. That is, a value of zero disables this attribute. As a result, the same connection is validated every time the application acquires the connection.

connection-leak-timeout-in-seconds
0
(optional) Detects potential connection leaks by the application. A connection that is not returned back to the pool by the application within the specified period is assumed to be potentially leaking, and a stack trace of the caller is logged. A zero value disables leak detection. A nonzero value enables leak tracing.

Use this attribute along with connection-leak-reclaim to avoid potential connection leaks from the application.

connection-leak-reclaim
false
(optional) If true, the pool will reclaim a connection after connection-leak-timeout-in-seconds occurs.
connection-creation-retry-attempts
0
(optional) Specifies the number of attempts to create a new connection in case of a failure.
connection-creation-retry-interval-in-seconds
10
(optional) Specifies the time interval between attempts to create a connection when connection-creation-retry-attempts is greater than 0.
statement-leak-timeout-in-seconds
0
(optional) Detects potential statement leaks by the application. A statement that is not closed by the application within the specified period is assumed to be potentially leaking, and a stack trace of the caller is logged. A zero value disables leak detection. A nonzero value enables leak tracing.

Use this attribute along with statement-leak-reclaim to avoid potential statement leaks from the application.

statement-leak-reclaim
false
(optional) If true, the reclaim of a statement after statement-leak-timeout-in-seconds occurs.
statement-timeout-in-seconds
-1
(optional) Sets the query timeout property of a statement to enable termination of abnormally long running queries. The default value of -1 disables this feature.

An abnormally long running JDBC query executed by an application may leave it in a hanging state unless a timeout is explicitly set on the statement. This attribute guarantees that all queries automatically time out if not completed within the specified period. When statements are created, the queryTimeout is set according to the value specified in this attribute. This works only when the underlying JDBC driver supports queryTimeout for Statement, PreparedStatement, CallableStatement, and ResultSet.

lazy-connection-enlistment
false
(optional) If true, a connection is not enlisted in a transaction until it is used. If false, any connection object available to a transaction is enlisted in the transaction.
lazy-connection-association
false
(optional) If true, a physical connection is not associated with a logical connection until it is used. If false, a physical connection is associated with a logical connection even before it is used.
associate-with-thread
false
(optional) Specifies whether connections are associated with the thread to enable the thread to reuse the connections. If true, allows connections to be saved as ThreadLocal in the calling thread. Connections get reclaimed only when the calling thread dies or when the calling thread is not in use and the pool has run out of connections. If false, the thread must obtain a connection from the pool each time the thread requires a connection.

This attribute associates connections with a thread such that when the same thread is in need of connections, it can reuse the connections already associated with that thread. In this case, the overhead of getting connections from the pool is avoided. However, when this value is set to true, you should verify that the value of the max-pool-size attribute is comparable to the max-thread-pool-size attribute of the associated thread pool. If the max-thread-pool-size value is much higher than the max-pool-size value, a lot of time is spent associating connections with a new thread after dissociating them from an older one. Use this attribute in cases where the thread pool should reuse connections to avoid this overhead.

match-connections
false
(optional) Specifies whether a connection that is selected from the pool should be matched with the connections with certain credentials. If true, enables connection matching. You can set to false if connections are homogeneous.

If the connection pool is used by applications that have multiple user credentials, match-connections must be true. The connection pool matches the request's credential with the connections in the pool and returns a matched connection for use. For new requests with different credentials, unmatched free connections are automatically purged to provide new connections to satisfy the new requests. This attribute need not be true if it is known that there is only one credential used by the applications and therefore the pool has homogeneous connections.

max-connection-usage-count
0
(optional) Specifies the number of times a connections is reused by the pool, after which it is closed. A zero value disables this feature. By limiting the maximum number of times a connection can be reused, you can avoid statement leaks if the application does not close statements.
sql-trace-listeners
none
(optional) Specifies that SQL statements executed by applications need to be traced. Helps administrators analyze the statements. Expects as a value a comma-separated list of listener implementation class names. Enables easy filtering of log messages for the SQL statements. SQL trace listeners must implement the org.glassfish.api.jdbc.SQLTraceListener interface.
statement-cache-size
0
(optional) Specifies the number of statements to be cached using the lru (Least Recently Used) caching mechanism. The default value of 0 disables statement caching.
pooling
true
(optional) If false, disables connection pooling.
wrap-jdbc-objects
true
(optional) If true, wrapped JDBC objects are returned for Statement, PreparedStatement, CallableStatement, ResultSet, and DatabaseMetaData.

This option ensures that Statement.getConnection() is the same as DataSource.getConnection(). Therefore, this option should be true when both Statement.getConnection() and DataSource.getConnection() are done. The default is false to avoid breaking existing applications.

GlassFish Server Properties

The following table describes properties for the jdbc-connection-pool element that are specific to GlassFish Server.

Table C-75 jdbc-connection-pool Database Properties

Property
Default
Description
dynamic-reconfiguration-wait-timeout-in-seconds
none
Specifies the timeout for dynamic reconfiguration of the pool. In-progress connection requests must complete before this timeout expires or they must be retried. New connection requests wait for this timeout to expire before acquiring connections to the reconfigured pool. If this property exists and has a positive value, it is enabled.

If this property is not set and pool reconfiguration results in pool recreation, in-progress connection requests must be retried.

number-of-top-queries-to-report
10
Specifies the number of most frequently used queries to display. For example, the default value of 10 displays the top ten queries.

This property is disabled when jdbc-connection-pool monitoring is set to LOW or OFF. It is enabled when jdbc-connection-pool monitoring is set to HIGH and the sql-trace-listeners attribute is set.

time-to-keep-queries-in-minutes
5
Specifies the time to retain queries in a cache before they are purged.

This property is disabled when jdbc-connection-pool monitoring is set to LOW or OFF. It is enabled when jdbc-connection-pool monitoring is set to HIGH and the sql-trace-listeners attribute is set.

Database Properties

Most JDBC drivers allow use of standard property lists to specify the user, password, and other resource configuration information. Although properties are optional with respect to the GlassFish Server, some properties might be necessary for most databases. For details, see the JDBC 4.0 Standard Extension API.

When properties are specified, they are passed to the vendor’s data source class (specified by the datasource-classname attribute) as is using setName(value) methods.

The user and password properties are used as the default principal if container managed authentication is specified and a default-resource-principal is not found in the application deployment descriptors.

The following table describes some common properties for the jdbc-connection-pool element.

Changing JDBC driver properties requires a server restart.

Table C-76 jdbc-connection-pool Database Properties

Property
Description
user
Specifies the user name for connecting to the database.
password
Specifies the password for connecting to the database.
databaseName
Specifies the database for this connection pool.
serverName
Specifies the database server for this connection pool.
port
Specifies the port on which the database server listens for requests.
networkProtocol
Specifies the communication protocol.
roleName
Specifies the initial SQL role name.
datasourceName
Specifies an underlying XADataSource, or a ConnectionPoolDataSource if connection pooling is done.
description
Specifies a text description.
url
Specifies the URL for this connection pool. Although this is not a standard property, it is commonly used.