type=page
status=published
title=create-application-ref
next=create-audit-module.html
prev=create-admin-object.html
~~~~~~

create-application-ref
======================

[[create-application-ref-1]][[GSRFM00013]][[create-application-ref]]

create-application-ref
----------------------

Creates a reference to an application

[[sthref123]]

=== Synopsis

[source]
----
asadmin [asadmin-options] create-application-ref [--help]
[--target target]
[--virtualservers virtual_servers] [--enabled=true]
[--lbenabled=true] reference_name
----

[[sthref124]]

=== Description

The `create-application-ref` subcommand creates a reference from a
cluster or an unclustered server instance to a previously deployed
application element (for example, a Java EE application, a Web module,
or an enterprise bean module). This effectively results in the
application element being deployed and made available on the targeted
instance or cluster.

The target instance or instances making up the cluster need not be
running or available for this subcommand to succeed. If one or more
instances are not available, they will receive the new application
element the next time they start.

This subcommand is supported in remote mode only.

[[sthref125]]

=== Options

asadmin-options::
  Options for the `asadmin` utility. For information about these
  options, see the link:asadmin.html#asadmin-1m[`asadmin`(1M)] help page.
`--help`::
`-?`::
  Displays the help text for the subcommand.
`--target`::
  Specifies the target for which you are creating the application
  reference. Valid values are
+
  * `server`- Specifies the default server instance as the target for
  creating the application reference. `server` is the name of the
  default server instance and is the default value for this option.
  * cluster_name- Specifies a particular cluster as the target for
  creating the application reference.
  * instance_name- Specifies a particular stand-alone server instance as
  the target for creating the application reference.
`--virtualservers`::
  Specifies a comma-separated list of virtual server IDs on which to
  deploy. This option applies only to Web modules (either standalone or
  in a Java EE application). If this option is not specified, the
  application is deployed to all virtual servers except the
  administrative server, `__asadmin`.
`--enabled`::
  Indicates whether the application should be enabled (that is, loaded).
  This value will take effect only if the application is enabled at the
  global level. The default is `true`.
`--lbenabled`::
  Controls whether the deployed application is available for load
  balancing. The default is true.

[[sthref126]]

=== Operands

reference_name::
  The name of the application or module, which can be a Java EE
  application, Web module, EJB module, connector module, application
  client module, or lifecycle module. +
  The name can include an optional version identifier, which follows the
  name and is separated from the name by a colon (`:`). The version
  identifier must begin with a letter or number. It can contain
  alphanumeric characters plus underscore (`_`), dash (`-`), and period
  (`.`) characters. If the `--enabled` option is set to false, you can
  create references to multiple disabled versions by using an asterisk
  (`*`) as a wildcard character. For more information about module and
  application versions, see
  "link:../application-deployment-guide/overview.html#GSDPG00324[
  Module and Application Versions]"
  in GlassFish Server Open Source Edition Application Deployment Guide.

[[sthref127]]

=== Examples

[[GSRFM458]][[sthref128]]

==== Example 1   Creating an Application Reference

The following example creates a reference to the Web module `MyWebApp`
on the unclustered server instance `NewServer`.

[source]
----
asadmin> create-application-ref --target NewServer MyWebApp
Command create-application-ref executed successfully.
----

[[sthref129]]

=== Exit Status

0::
  command executed successfully
1::
  error in executing the command

[[sthref130]]

=== See Also

link:asadmin.html#asadmin-1m[`asadmin`(1M)]

link:delete-application-ref.html#delete-application-ref-1[`delete-application-ref`(1)],
link:list-application-refs.html#list-application-refs-1[`list-application-refs`(1)]

link:../application-deployment-guide/toc.html#GSDPG[GlassFish Server Open Source Edition Application Deployment
Guide]


