Apache Ant 1.6.2 is provided with Application Server and can be launched from the bin directory using the command asant. The Application Server also provides server-specific tasks for deployment, which are described in this section.
Make sure you have done these things before using asant:
Include install-dir/bin in the PATH environment variable (/usr/sfw/bin for Sun Java Enterprise System on Solaris). The Ant script provided with the Application Server, asant, is located in this directory. For details on how to use asant, see the Sun Java System Application Server Enterprise Edition 8.1 2005Q2 Reference Manual and the sample applications documentation in the install-dir/samples/docs/ant.html file.
If you are executing platform-specific applications, such as the exec or cvs task, the ANT_HOME environment variable must be set to the Ant installation directory.
The ANT_HOME environment variable for Sun Java Enterprise System must include the following:
/usr/sfw/bin - the Ant binaries (shell scripts)
/usr/sfw/doc/ant - HTML documentation
/usr/sfw/lib/ant - Java classes that implement Ant
The ANT_HOME environment variable for all other platforms is install-dir/lib.
Set up your password file. The argument for the passworfile option of each Ant task is a file. This file contains the password attribute name and its value, in the following format:
AS_ADMIN_PASSWORD=password
For more information about password files, see the Sun Java System Application Server Enterprise Edition 8.1 2005Q2 Reference Manual.
This section covers the following asant-related topics:
For more information about Ant, see the Apache Software Foundation web site at http://ant.apache.org/.
For information about standard Ant tasks, see the Ant documentation at http://antinstaller.sourceforge.net/manual/manual/.
Use the asant tasks provided by the Application Server for assembling, deploying, and undeploying modules and applications, and for configuring the server. The tasks are as follows:
Deploys any of the following to a local or remote Application Server instance.
Enterprise application (EAR file)
Web application (WAR file)
Enterprise Java Bean (EJB-JAR file)
Enterprise connector (RAR file)
Application client
The following table describes subelements for the sun-appserv-deploy task. These are objects upon which this task acts.
Table 3–5 sun-appserv-deploy Subelements
Element |
Description |
---|---|
An Application Server instance. |
|
A component to be deployed. |
|
A set of component files that match specified parameters. |
The following table describes attributes for the sun-appserv-deploy task.
Table 3–6 sun-appserv-deploy Attributes
Attribute |
Default |
Description |
---|---|---|
none |
(optional if a component or fileset subelement is present, otherwise required) The component to deploy. If this attribute refers to a file, it must be a valid archive. If this attribute refers to a directory, it must contain a valid archive in which all components have been exploded. If upload is set to false, this must be an absolute path on the server machine. |
|
name |
file name without extension |
(optional) The display name for the component being deployed. |
determined by extension |
(optional) Deprecated. |
|
true |
(optional) If true, the component is overwritten if it already exists on the server. If false, sun-appserv-deploy fails if the component exists. |
|
client stubs not saved |
(optional) The directory where client stubs are saved. This attribute is inherited by nested component elements. |
|
false |
(optional) If true, all JSP files found in an enterprise application (.ear) or web application (.war) are precompiled. This attribute is ignored for other component types. This attribute is inherited by nested component elements. |
|
false |
(optional) If true, syntax and semantics for all deployment descriptors are automatically verified for correctness. This attribute is inherited by nested component elements. |
|
file name without extension |
(optional) The context root for a web module (WAR file). This attribute is ignored if the component is not a WAR file. |
|
sun-ejb-jar.xml entry |
(optional) The name of the database vendor for which tables can be created. Allowed values are db2, mssql, oracle, pointbase, and sybase, case-insensitive. If not specified, the value of the database-vendor-name attribute in sun-ejb-jar.xml is used. If no value is specified, a connection is made to the resource specified by the jndi-name subelement of the cmp-resource element in the sun-ejb-jar.xml file, and the database vendor name is read. If the connection cannot be established, or if the value is not recognized, SQL-92 compliance is presumed. For details, see Generation Options. |
|
sun-ejb-jar.xml entry |
(optional) If true, causes database tables to be created for beans that need them. If false, does not create tables. If not specified, the value of the create-tables-at-deploy attribute in sun-ejb-jar.xml is used. For details, see Generation Options. |
|
sun-ejb-jar.xml entry |
(optional) If true, and if tables were automatically created when this application was last deployed, tables from the earlier deployment are dropped and fresh ones are created. If true, and if tables were not automatically created when this application was last deployed, no attempt is made to drop any tables. If tables with the same names as those that would have been automatically created are found, the deployment proceeds, but a warning indicates that tables could not be created. If false, settings of create-tables-at-deploy or drop-tables-at-undeploy in the sun-ejb-jar.xml file are overridden. For details, see Generation Options. |
|
sun-ejb-jar.xml entry |
(optional) If true, specifies that table names are unique within each application server domain. If not specified, the value of the use-unique-table-names property in sun-ejb-jar.xml is used. For details, see Generation Options. |
|
true |
(optional) If true, enables the component. |
|
none |
(optional) A deployment plan is a JAR file containing Sun-specific descriptors. Use this attribute when deploying an EAR file that lacks Sun-specific descriptors. |
|
false |
(optional) If true, enables high availability features, including persistence of HTTP sessions and checkpointing of the stateful session bean state. |
|
false |
(optional) If true, generates the static RMI-IIOP stubs and puts them in the client JAR file. |
|
true |
(optional) If true, the component is transferred to the server for deployment. If the component is being deployed on the local machine, set upload to false to reduce deployment time. If a directory is specified for deployment, upload must be false. |
|
default virtual server only |
(optional) A comma-separated list of virtual servers to be deployment targets. This attribute applies only to application (.ear) or web (.war) components and is ignored for other component types. This attribute is inherited by nested server elements. |
|
admin |
(optional) The user name used when logging into the application server administration instance. This attribute is inherited by nested server elements. |
|
password |
none |
(optional) Deprecated, use passwordfile instead. The password used when logging into the application server administration instance. This attribute is inherited by nested server elements. |
passwordfile |
none |
(optional) File containing passwords. The password from this file is retrieved for communication with the application server administration instance. This attribute is inherited by nested server elements. If both password and passwordfile are specified, passwordfile takes precedence. |
localhost |
(optional) Target server. When deploying to a remote server, use the fully qualified host name. This attribute is inherited by nested server elements. |
|
4849 |
(optional) The administration port on the target server. This attribute is inherited by nested server elements. |
|
name of default instance |
(optional) Target application server instance. This attribute is inherited by nested server elements. |
|
see description |
(optional) The installation directory for the local Application Server installation, which is used to find the administrative classes. If not specified, the command checks to see if the asinstalldir parameter has been set. Otherwise, administrative classes must be in the system classpath. |
|
see description |
(optional) Deprecated. Use asinstalldir instead. |
Here is a simple application deployment script with many implied attributes:
<sun-appserv-deploy file="${assemble}/simpleapp.ear" passwordfile="${passwordfile}" />
Here is an equivalent script showing all the implied attributes:
<sun-appserv-deploy file="${assemble}/simpleapp.ear" name="simpleapp" force="true" precompilejsp="false" verify="false" upload="true" user="admin" passwordfile="${passwordfile}" host="localhost" port="4849" target="${default-instance-name}" asinstalldir="${asinstalldir}" />
This example deploys multiple components to the same Application Server instance running on a remote server:
<sun-appserv-deploy passwordfile="${passwordfile}" host="greg.sun.com" asinstalldir="/opt/sun" > <component file="${assemble}/simpleapp.ear"/> <component file="${assemble}/simpleservlet.war" contextroot="test"/> <component file="${assemble}/simplebean.jar"/> </sun-appserv-deploy>
This example deploys multiple components to two Application Server instances running on remote servers. In this example, both servers are using the same admin password. If this were not the case, each password could be specified in the server element.
<sun-appserv-deploy passwordfile="${passwordfile}" asinstalldir="/opt/sun" > <server host="greg.sun.com"/> <server host="joe.sun.com"/> <component file="${assemble}/simpleapp.ear"/> <component file="${assemble}/simpleservlet.war" contextroot="test"/> <component file="${assemble}/simplebean.jar"/> </sun-appserv-deploy>
This example deploys the same components as the previous example because the three components match the fileset criteria, but note that it’s not possible to set some component-specific attributes. All component-specific attributes (name and contextroot) use their default values.
<sun-appserv-deploy passwordfile="${passwordfile}" host="greg.sun.com" asinstalldir="/opt/sun" > <fileset dir="${assemble}" includes="**/*.?ar" /> </sun-appserv-deploy>
Undeploys any of the following from a local or remote Application Server instance.
Enterprise application (EAR file)
Web application (WAR file)
Enterprise Java Bean (EJB-JAR file)
Enterprise connector (RAR file)
Application client
The following table describes subelements for the sun-appserv-undeploy task. These are objects upon which this task acts.
Table 3–7 sun-appserv-undeploy Subelements
Element |
Description |
---|---|
An Application Server instance. |
|
A component to be deployed. |
|
A set of component files that match specified parameters. |
The following table describes attributes for the sun-appserv-undeploy task.
Table 3–8 sun-appserv-undeploy Attributes
Attribute |
Default |
Description |
---|---|---|
name |
file name without extension |
(optional if a component or fileset subelement is present or the file attribute is specified, otherwise required) The display name for the component being undeployed. |
none |
(optional) The component to undeploy. If this attribute refers to a file, it must be a valid archive. If this attribute refers to a directory, it must contain a valid archive in which all components have been exploded. |
|
determined by extension |
(optional) Deprecated. |
|
sun-ejb-jar.xml entry |
(optional) If true, causes database tables that were automatically created when the bean(s) were last deployed to be dropped when the bean(s) are undeployed. If false, does not drop tables. If not specified, the value of the drop-tables-at-undeploy attribute in sun-ejb-jar.xml is used. For details, see Generation Options. |
|
false |
(optional) If true, deletes all connection pools and connector resources associated with the resource adapter being undeployed. If false, undeployment fails if any pools or resources are still associated with the resource adapter. This attribute is applicable to connectors (resource adapters) and applications with connector modules. |
|
admin |
(optional) The user name used when logging into the application server administration instance. This attribute is inherited by nested server elements. |
|
password |
none |
(optional) Deprecated, use passwordfile instead. The password used when logging into the application server administration instance. This attribute is inherited by nested server elements. |
passwordfile |
none |
(optional) File containing passwords. The password from this file is retrieved for communication with the application server administration instance. This attribute is inherited by nested server elements. If both password and passwordfile are specified, passwordfile takes precedence. |
localhost |
(optional) Target server. When deploying to a remote server, use the fully qualified host name. This attribute is inherited by nested server elements. |
|
4849 |
(optional) The administration port on the target server. This attribute is inherited by nested server elements. |
|
name of default instance |
(optional) Target application server instance. This attribute is inherited by nested server elements. |
|
see description |
(optional) The installation directory for the local Application Server installation, which is used to find the administrative classes. If not specified, the command checks to see if the asinstalldir parameter has been set. Otherwise, administrative classes must be in the system classpath. |
|
see description |
(optional) Deprecated. Use asinstalldir instead. |
Here is a simple application undeployment script with many implied attributes:
<sun-appserv-undeploy name="simpleapp" passwordfile="${passwordfile}" />
Here is an equivalent script showing all the implied attributes:
<sun-appserv-undeploy name="simpleapp" user="admin" passwordfile="${passwordfile}" host="localhost" port="4849" target="${default-instance-name}" asinstalldir="${asinstalldir}" />
This example demonstrates using the archive files (EAR and WAR, in this case) for the undeployment, using the component name (for undeploying the EJB component in this example), and undeploying multiple components.
<sun-appserv-undeploy passwordfile="${passwordfile}"> <component file="${assemble}/simpleapp.ear"/> <component file="${assemble}/simpleservlet.war"/> <component name="simplebean" /> </sun-appserv-undeploy>
As with the deployment process, components can be undeployed from multiple servers in a single command. This example shows the same three components being removed from two different instances of the Application Server. In this example, the passwords for both instances are the same.
<sun-appserv-undeploy passwordfile="${passwordfile}"> <server host="greg.sun.com"/> <server host="joe.sun.com"/> <component file="${assemble}/simpleapp.ear"/> <component file="${assemble}/simpleservlet.war"/> <component name="simplebean" /> </sun-appserv-undeploy>
Starts, stops, restarts, creates, or removes one or more application server instances.
The following table describes subelements for the sun-appserv-instance task. These are objects upon which this task acts.
Table 3–9 sun-appserv-instance Subelements
Element |
Description |
---|---|
An Application Server instance. |
The following table describes attributes for the sun-appserv-instance task.
Table 3–10 sun-appserv-instance Attributes
Attribute |
Default |
Description |
---|---|---|
none |
The control command for the target application server. Valid values are start, stop, restart, create, and delete. A restart sends the stop command followed by the start command. The restart command is not supported on Windows. |
|
false |
(optional) Deprecated. If action is set to start or restart, specifies whether the server starts in debug mode. This attribute is ignored for other values of action. If true, the instance generates additional debugging output throughout its lifetime. This attribute is inherited by nested server elements. |
|
none |
(optional) Deprecated. |
|
none |
(required if action is create, otherwise ignored) The name of the node agent on which the instance is being created. |
|
none |
(optional, applicable only if action is create) The clustered instance to be created. The server’s configuration is inherited from the named cluster. The config and cluster attributes are mutually exclusive. If both are omitted, a stand-alone server instance is created. |
|
none |
(optional, applicable only if action is create) The configuration for the new stand-alone instance. The configuration must exist and must not be default-config (the cluster configuration template) or an already referenced stand-alone configuration (including the administration server configuration server-config). The config and cluster attributes are mutually exclusive. If both are omitted, a stand-alone server instance is created. |
|
none |
(optional, applicable only if action is create) Defines system properties for the server instance. These properties override port settings in the server instance’s configuration. The following properties are defined: http-listener-1-port, http-listener-2-port, orb-listener-1-port, SSL-port, SSL_MUTUALAUTH-port, JMX_SYSTEM_CONNECTOR_port. System properties can be changed after instance creation using the system property commands. For details, see the Sun Java System Application Server Enterprise Edition 8.1 2005Q2 Reference Manual. |
|
admin |
(optional) The username used when logging into the application server administration instance. This attribute is inherited by nested server elements. |
|
password |
none |
(optional) Deprecated, use passwordfile instead. The password used when logging into the application server administration instance. This attribute is inherited by nested server elements. |
passwordfile |
none |
(optional) File containing passwords. The password from this file is retrieved for communication with the application server administration instance. This attribute is inherited by nested server elements. If both password and passwordfile are specified, passwordfile takes precedence. |
localhost |
(optional) Target server. If it is a remote server, use the fully qualified hostname. This attribute is inherited by nested server elements. |
|
4849 |
(optional) The administration port on the target server. This attribute is inherited by nested server elements. |
|
name of default instance |
(optional) Target application server instance. This attribute is inherited by nested server elements. |
|
see description |
(optional) The installation directory for the local Application Server installation, which is used to find the administrative classes. If not specified, the command checks to see if the asinstalldir parameter has been set. Otherwise, administrative classes must be in the system classpath. |
|
see description |
(optional) Deprecated. Use asinstalldir instead. |
This example starts the local Application Server instance:
<sun-appserv-instance action="start" passwordfile="${passwordfile}" instance="${default-instance-name}"/>
Here is an equivalent script showing all the implied attributes:
<sun-appserv-instance action="start" user="admin" passwordfile="${passwordfile}" host="localhost" port="4849" instance="${default-instance-name}" asinstalldir="${asinstalldir}" />
Multiple servers can be controlled using a single command. In this example, two servers are restarted, and in this case each server uses a different password:
<sun-appserv-instance action="restart" instance="${default-instance-name}"/> <server host="greg.sun.com" passwordfile="${password.greg}"/> <server host="joe.sun.com" passwordfile="${password.joe}"/> </sun-appserv-instance>
This example creates a new Application Server instance:
<sun-appserv-instance action="create" instanceport="8080" passwordfile="${passwordfile}" instance="development" />
Here is an equivalent script showing all the implied attributes:
<sun-appserv-instance action="create" instanceport="8080" user="admin" passwordfile="${passwordfile}" host="localhost" port="4849" instance="development" asinstalldir="${asinstalldir}" />
Instances can be created on multiple servers using a single command. This example creates a new instance named qa on two different servers. In this case, both servers use the same password.
<sun-appserv-instance action="create" instanceport="8080" instance="qa" passwordfile="${passwordfile}> <server host="greg.sun.com"/> <server host="joe.sun.com"/> </sun-appserv-instance>
These instances can also be removed from their respective servers:
<sun-appserv-instance action="delete" instance="qa" passwordfile="${passwordfile}> <server host="greg.sun.com"/> <server host="joe.sun.com"/> </sun-appserv-instance>
Different instance names and instance ports can also be specified using attributes of the server subelement:
<sun-appserv-instance action="create" passwordfile="${passwordfile}> <server host="greg.sun.com" instanceport="8080" instance="qa"/> <server host="joe.sun.com" instanceport="9090" instance="integration-test"/> </sun-appserv-instance>
Enables or disables the following J2EE component types that have been deployed to the Application Server.
Enterprise application (EAR file)
Web application (WAR file)
Enterprise Java Bean (EJB-JAR file)
Enterprise connector (RAR file)
Application client
You don’t need to specify the archive to enable or disable a component: only the component name is required. You can use the component archive, however, because it implies the component name.
The following table describes subelements for the sun-appserv-component task. These are objects upon which this task acts.
Table 3–11 sun-appserv-component Subelements
Element |
Description |
---|---|
An Application Server instance. |
|
A component to be deployed. |
|
A set of component files that match specified parameters. |
The following table describes attributes for the sun-appserv-component task.
Table 3–12 sun-appserv-component Attributes
Attribute |
Default |
Description |
---|---|---|
none |
The control command for the target application server. Valid values are enable and disable. |
|
name |
file name without extension |
(optional if a component or fileset subelement is present or the file attribute is specified, otherwise required) The display name for the component being enabled or disabled. |
none |
(optional) The component to enable or disable. If this attribute refers to a file, it must be a valid archive. If this attribute refers to a directory, it must contain a valid archive in which all components have been exploded. |
|
determined by extension |
(optional) Deprecated. |
|
admin |
(optional) The user name used when logging into the application server administration instance. This attribute is inherited by nested server elements. |
|
password |
none |
(optional) Deprecated, use passwordfile instead. The password used when logging into the application server administration instance. This attribute is inherited by nested server elements. |
passwordfile |
none |
(optional) File containing passwords. The password from this file is retrieved for communication with the application server administration instance. This attribute is inherited by nested server elements. If both password and passwordfile are specified, passwordfile takes precedence. |
localhost |
(optional) Target server. When enabling or disabling a remote server, use the fully qualified host name. This attribute is inherited by nested server elements. |
|
4849 |
(optional) The administration port on the target server. This attribute is inherited by nested server elements. |
|
name of default instance |
(optional) Target application server instance. This attribute is inherited by nested server elements. |
|
see description |
(optional) The installation directory for the local Application Server installation, which is used to find the administrative classes. If not specified, the command checks to see if the asinstalldir parameter has been set. Otherwise, administrative classes must be in the system classpath. |
|
see description |
(optional) Deprecated. Use asinstalldir instead. |
Here is a simple example of disabling a component:
<sun-appserv-component action="disable" name="simpleapp" passwordfile="${passwordfile}" />
Here is a simple example of enabling a component:
<sun-appserv-component action="enable" name="simpleapp" passwordfile="${passwordfile}" />
Here is an equivalent script showing all the implied attributes:
<sun-appserv-component action="enable" name="simpleapp" user="admin" passwordfile="${passwordfile}" host="localhost" port="4849" target="${default-instance-name}" asinstalldir="${asinstalldir}" />
This example demonstrates disabling multiple components using the archive files (EAR and WAR, in this case) and using the component name (for an EJB component in this example).
<sun-appserv-component action="disable" passwordfile="${passwordfile}"> <component file="${assemble}/simpleapp.ear"/> <component file="${assemble}/simpleservlet.war"/> <component name="simplebean" /> </sun-appserv-component>
Components can be enabled or disabled on multiple servers in a single task. This example shows the same three components being enabled on two different instances of the Application Server. In this example, the passwords for both instances are the same.
<sun-appserv-component action="enable" passwordfile="${passwordfile}"> <server host="greg.sun.com"/> <server host="joe.sun.com"/> <component file="${assemble}/simpleapp.ear"/> <component file="${assemble}/simpleservlet.war"/> <component name="simplebean" /> </sun-appserv-component>
Enables arbitrary administrative commands and scripts to be executed on the Application Server. This is useful for cases where a specific Ant task hasn’t been developed or a set of related commands are in a single script.
The following table describes subelements for the sun-appserv-admin task. These are objects upon which this task acts.
Table 3–13 sun-appserv-admin Subelements
Element |
Description |
---|---|
An Application Server instance. |
The following table describes attributes for the sun-appserv-admin task.
Table 3–14 sun-appserv-admin Attributes
Attribute |
Default |
Description |
---|---|---|
none |
(exactly one of these is required: command, commandfile, or explicitcommand) The command to execute. If the user, passwordfile, host, port, or target attributes are also specified, they are automatically inserted into the command before execution. If any of these options are specified in the command string, the corresponding attribute values are ignored. |
|
none |
(exactly one of these is required: command, commandfile, or explicitcommand) Deprecated. The command script to execute. If commandfile is used, the values of all other attributes are ignored. Be sure to end the script referenced by commandfile with the exit command; if you omit exit, the Ant task might appear to hang after the command script is called. |
|
none |
(exactly one of these is required: command, commandfile, or explicitcommand) The exact command to execute. No command processing is done, and all other attributes are ignored. |
|
user |
admin |
(optional) The user name used when logging into the application server administration instance. This attribute is inherited by nested server elements. |
password |
none |
(optional) Deprecated, use passwordfile instead. The password used when logging into the application server administration instance. This attribute is inherited by nested server elements. |
passwordfile |
none |
(optional) File containing passwords. The password from this file is retrieved for communication with the application server administration instance. This attribute is inherited by nested server elements. If both password and passwordfile are specified, passwordfile takes precedence. |
host |
localhost |
(optional) Target server. If it is a remote server, use the fully qualified host name. This attribute is inherited by nested server elements. |
port |
4849 |
(optional) The administration port on the target server. This attribute is inherited by nested server elements. |
see description |
(optional) The installation directory for the local Application Server installation, which is used to find the administrative classes. If not specified, the command checks to see if the asinstalldir parameter has been set. Otherwise, administrative classes must be in the system classpath. |
|
see description |
(optional) Deprecated. Use asinstalldir instead. |
Here is an example of executing the create-jms-dest command:
<sun-appserv-admin command="create-jms-dest --desttype topic">
Here is an example of using commandfile to execute the create-jms-dest command:
<sun-appserv-admin commandfile="create_jms_dest.txt" instance="development">
The create_jms_dest.txt file contains the following:
create-jms-dest --user admin --passwordfile "${passwordfile}" --host localhost --port 4849 --desttype topic --target server1 simpleJmsDest
Here is an example of using explicitcommand to execute the create-jms-dest command:
<sun-appserv-admin command="create-jms-dest --user admin --passwordfile "${passwordfile}" --host localhost --port 4849 --desttype topic --target server1 simpleJmsDest">
Precompiles JSP source code into Application Server compatible Java code for initial invocation by Application Server. Use this task to speed up access to JSP files or to check the syntax of JSP source code. You can feed the resulting Java code to the javac task to generate class files for the JSP files.
none
The following table describes attributes for the sun-appserv-jspc task.
Table 3–15 sun-appserv-jspc Attributes
Attribute |
Default |
Description |
---|---|---|
|
The destination directory for the generated Java source files. |
|
|
(exactly one of these is required: srcdir or webapp) The source directory where the JSP files are located. |
|
|
(exactly one of these is required: srcdir or webapp) The directory containing the web application. All JSP files within the directory are recursively parsed. The base directory must have a WEB-INF subdirectory beneath it. When webapp is used, sun-appserv-jspc hands off all dependency checking to the compiler. |
|
2 |
(optional) The verbosity integer to be passed to the compiler. |
|
|
(optional) The classpath for running the JSP compiler. |
|
|
(optional) A reference to the JSP compiler classpath. |
|
/ |
(optional) The URI context of relative URI references in the JSP files. If this context does not exist, it is derived from the location of the JSP file relative to the declared or derived value of uriroot. Only pages translated from an explicitly declared JSP file are affected. |
|
see description |
(optional) The root directory of the web application, against which URI files are resolved. If this directory is not specified, the first JSP file is used to derive it: each parent directory of the first JSP file is searched for a WEB-INF directory, and the directory closest to the JSP file that has one is used. If no WEB-INF directory is found, the directory sun-appserv-jspc was called from is used. Only pages translated from an explicitly declared JSP file (including tag libraries) are affected. |
|
(optional) The destination package for the generated Java classes. |
||
see description |
(optional) The installation directory for the local Application Server installation, which is used to find the administrative classes. If not specified, the command checks to see if the asinstalldir parameter has been set. Otherwise, administrative classes must be in the system classpath. |
|
see description |
(optional) Deprecated. Use asinstalldir instead. |
The following example uses the webapp attribute to generate Java source files from JSP files. The sun-appserv-jspc task is immediately followed by a javac task, which compiles the generated Java files into class files. The classpath value in the javac task must be all on one line with no spaces.
<sun-appserv-jspc destdir="${assemble.war}/generated" webapp="${assemble.war}" classpath="${assemble.war}/WEB-INF/classes" asinstalldir="${asinstalldir}" /> <javac srcdir="${assemble.war}/WEB-INF/generated" destdir="${assemble.war}/WEB-INF/generated" debug="on" classpath="${assemble.war}/WEB-INF/classes:${asinstalldir}/lib/ appserv-rt.jar:${asinstalldir}/lib/appserv-ext.jar"> <include name="**/*.java"/> </javac>
Enables deployed applications (EAR files) and modules (EJB JAR, RAR, and WAR files) to be updated and reloaded for fast iterative development. This task copies modified class files, XML files, and other contents of the archive files to the appropriate subdirectory of the domain-dir/applications directory, then touches the .reload file to cause dynamic reloading to occur.
This is a local task and must be executed on the same machine as the application server.
none
The following table describes attributes for the sun-appserv-update task.
Table 3–16 sun-appserv-update Attributes
Attribute |
Default |
Description |
---|---|---|
none |
The component to update, which must be a valid archive. |
|
domain1 |
(optional) The domain in which the application has been previously deployed. |
The following example updates the J2EE application foo.ear, which is deployed to the default domain, domain1.
<sun-appserv-update file="foo.ear"/>
Reusable subelements of the Ant tasks for the Application Server are as follows. These are objects upon which the Ant tasks act.
Specifies an Application Server instance. Allows a single task to act on multiple server instances. The server attributes override corresponding attributes in the parent task; therefore, the parent task attributes function as default values.
none
The following table describes attributes for the server element.
Table 3–17 server Attributes
Attribute |
Default |
Description |
---|---|---|
admin |
(optional) The username used when logging into the application server administration instance. |
|
password |
none |
(optional) Deprecated, use passwordfile instead. The password used when logging into the application server administration instance. |
passwordfile |
none |
(optional) File containing passwords. The password from this file is retrieved for communication with the application server administration instance. If both password and passwordfile are specified, passwordfile takes precedence. |
localhost |
(optional) Target server. When targeting a remote server, use the fully qualified hostname. |
|
4849 |
(optional) The administration port on the target server. |
|
name of default instance |
(optional) Target application server instance. |
|
(applies to sun-appserv-update only) The domain in which the application has been previously deployed. |
||
none |
(applies to sun-appserv-instance only) Deprecated. |
|
none |
(applies to sun-appserv-instance only, required if action is create, otherwise ignored) The name of the node agent on which the instance is being created. |
|
false |
(applies to sun-appserv-instance only, optional) Deprecated. If action is set to start, specifies whether the server starts in debug mode. This attribute is ignored for other values of action. If true, the instance generates additional debugging output throughout its lifetime. |
|
true |
(applies to sun-appserv-deploy only, optional) If true, the component is transferred to the server for deployment. If the component is being deployed on the local machine, set upload to false to reduce deployment time. |
|
default virtual server only |
(applies to sun-appserv-deploy only, optional) A comma-separated list of virtual servers to be deployment targets. This attribute applies only to application (.ear) or web (.war) components and is ignored for other component types. |
You can control multiple servers using a single task. In this example, two servers are started, each using a different password. Only the second server is started in debug mode.
<sun-appserv-instance action="start"> <server host="greg.sun.com" passwordfile="${password.greg}"/> <server host="joe.sun.com" passwordfile="${password.joe}" debug="true"/> </sun-appserv-instance>
You can create instances on multiple servers using a single task. This example creates a new instance named qa on two different servers. Both servers use the same password.
<sun-appserv-instance action="create" instanceport="8080" instance="qa" passwordfile="${passwordfile}> <server host="greg.sun.com"/> <server host="joe.sun.com"/> </sun-appserv-instance>
These instances can also be removed from their respective servers:
<sun-appserv-instance action="delete" instance="qa" passwordfile="${passwordfile}> <server host="greg.sun.com"/> <server host="joe.sun.com"/> </sun-appserv-instance>
You can specify different instance names and instance ports using attributes of the nested server element:
<sun-appserv-instance action="create" passwordfile="${passwordfile}> <server host="greg.sun.com" instanceport="8080" instance="qa"/> <server host="joe.sun.com" instanceport="9090" instance="integration-test"/> </sun-appserv-instance>
You can deploy multiple components to multiple servers (see the component nested element. This example deploys each component to two Application Server instances running on remote servers. Both servers use the same password.
<sun-appserv-deploy passwordfile="${passwordfile}" asinstalldir="/opt/s1as8" > <server host="greg.sun.com"/> <server host="joe.sun.com"/> <component file="${assemble}/simpleapp.ear"/> <component file="${assemble}/simpleservlet.war" contextroot="test"/> <component file="${assemble}/simplebean.jar"/> </sun-appserv-deploy>
You can also undeploy multiple components from multiple servers. This example shows the same three components being removed from two different instances. Both servers use the same password.
<sun-appserv-undeploy passwordfile="${passwordfile}"> <server host="greg.sun.com"/> <server host="joe.sun.com"/> <component file="${assemble}/simpleapp.ear"/> <component file="${assemble}/simpleservlet.war"/> <component name="simplebean" /> </sun-appserv-undeploy>
You can enable or disable components on multiple servers. This example shows the same three components being enabled on two different instances. Both servers use the same password.
<sun-appserv-component action="enable" passwordfile="${passwordfile}"> <server host="greg.sun.com"/> <server host="joe.sun.com"/> <component file="${assemble}/simpleapp.ear"/> <component file="${assemble}/simpleservlet.war"/> <component name="simplebean" /> </sun-appserv-component>
Specifies a J2EE component. Allows a single task to act on multiple components. The component attributes override corresponding attributes in the parent task; therefore, the parent task attributes function as default values.
none
The following table describes attributes for the component element.
Table 3–18 component Attributes
Attribute |
Default |
Description |
---|---|---|
none |
(optional if the parent task is sun-appserv-undeploy or sun-appserv-component) The target component. If this attribute refers to a file, it must be a valid archive. If this attribute refers to a directory, it must contain a valid archive in which all components have been exploded. If upload is set to false, this must be an absolute path on the server machine. |
|
name |
file name without extension |
(optional) The display name for the component. |
determined by extension |
(optional) Deprecated. |
|
true |
(applies to sun-appserv-deploy only, optional) If true, the component is overwritten if it already exists on the server. If false, the containing element’s operation fails if the component exists. |
|
false |
(applies to sun-appserv-deploy only, optional) If true, all JSP files found in an enterprise application (.ear) or web application (.war) are precompiled. This attribute is ignored for other component types. |
|
client stubs not saved |
(applies to sun-appserv-deploy only, optional) The directory where client stubs are saved. |
|
file name without extension |
(applies to sun-appserv-deploy only, optional) The context root for a web module (WAR file). This attribute is ignored if the component is not a WAR file. |
|
false |
(applies to sun-appserv-deploy only, optional) If true, syntax and semantics for all deployment descriptors is automatically verified for correctness. |
You can deploy multiple components using a single task. This example deploys each component to the same Application Server instance running on a remote server.
<sun-appserv-deploy passwordfile="${passwordfile}" host="greg.sun.com" asinstalldir="/opt/s1as8" > <component file="${assemble}/simpleapp.ear"/> <component file="${assemble}/simpleservlet.war" contextroot="test"/> <component file="${assemble}/simplebean.jar"/> </sun-appserv-deploy>
You can also undeploy multiple components using a single task. This example demonstrates using the archive files (EAR and WAR, in this case) and the component name (for the EJB component).
<sun-appserv-undeploy passwordfile="${passwordfile}"> <component file="${assemble}/simpleapp.ear"/ <component file="${assemble}/simpleservlet.war"/> <component name="simplebean" /> </sun-appserv-undeploy>
You can deploy multiple components to multiple servers. This example deploys each component to two instances running on remote servers. Both servers use the same password.
<sun-appserv-deploy passwordfile="${passwordfile}" asinstalldir="/opt/s1as8" > <server host="greg.sun.com"/> <server host="joe.sun.com"/> <component file="${assemble}/simpleapp.ear"/> <component file="${assemble}/simpleservlet.war" contextroot="test"/> <component file="${assemble}/simplebean.jar"/> </sun-appserv-deploy>
You can also undeploy multiple components to multiple servers. This example shows the same three components being removed from two different instances. Both servers use the same password.
<sun-appserv-undeploy passwordfile="${passwordfile}"> <server host="greg.sun.com"/> <server host="joe.sun.com"/> <component file="${assemble}/simpleapp.ear"/> <component file="${assemble}/simpleservlet.war"/> <component name="simplebean" /> </sun-appserv-undeploy>
You can enable or disable multiple components. This example demonstrates disabling multiple components using the archive files (EAR and WAR, in this case) and the component name (for the EJB component).
<sun-appserv-component action="disable" passwordfile="${passwordfile}"> <component file="${assemble}/simpleapp.ear"/> <component file="${assemble}/simpleservlet.war"/> <component name="simplebean" /> </sun-appserv-component>
You can enable or disable multiple components on multiple servers. This example shows the same three components being enabled on two different instances. Both servers use the same password.
<sun-appserv-component action="enable" passwordfile="${passwordfile}"> <server host="greg.sun.com"/> <server host="joe.sun.com"/> <component file="${assemble}/simpleapp.ear"/> <component file="${assemble}/simpleservlet.war"/> <component name="simplebean" /> </sun-appserv-component>
Selects component files that match specified parameters. When fileset is included as a subelement, the name and contextroot attributes of the containing element must use their default values for each file in the fileset. For more information, see:
http://antinstaller.sourceforge.net/manual/manual/CoreTypes/fileset.html