Sun Java System Application Server Platform Edition 8.1 2005Q2 Update 2 Administration Reference

- Previous: Default Values
- Next: Element Referencing

## Variables

Variables and variable references are needed for two reasons:

- Parts of the Application Server share much configuration information but differ in specific details.

- Parts of the configuration come from the system environment but must still be captured in the configuration.

Variable references appear in the `domain.xml` file as strings that begin with the characters `${` and end with the character `}`. For example, the string `${com.sun.enterprise.myVar}` is a reference to the variable `com.sun.enterprise.myVar` .

Variables are defined both outside of and within `domain.xml`. Predefined variables that exist outside of `domain.xml` are defined as Java System Properties. Within `domain.xml`, a variable is defined using the system-property element or the jvm-options element.

The `system-property` element’s `name` attribute is the name of a variable; its `value` attribute is the definition of the variable. For example, the following `system-property` element defines a `port-number` variable with the value `6500`:

    <system-property name="port-number" value="6500"/>

Multiple `system-property` subelements are permitted within server, config, and domain elements.

A variable defined in the `jvm-options` element is a Java System Property with the `-D` flag. For example, the following `jvm-options` element defines a `port-number` variable with the value `5500`:

    <jvm-option>-Dport-number=5500</jvm-option>

Multiple definitions for the same variable are permitted. The Application Server determines the actual value of a variable by searching for its first definition in a strict hierarchy of the elements within `domain.xml`. The hierarchy is as follows:

    server -> config -> jvm-options -> domain -> System

Implicit in this hierarchy is the notion of reference and containment. A variable referenced in a `server` element is only looked up:

- In the `config` element that references that specific `server`

- In the `jvm-options` subelements of the `config` element referenced by that `server`

- Previous: Default Values
- Next: Element Referencing

- © 2010, Oracle Corporation and/or its affiliates