Oracle GlassFish Server 3.0.1 Application Deployment Guide

Naming Standards

Names of applications and individually-deployed modules must be unique within a GlassFish Server domain. Modules within an application must have unique names.


Note –

Ensure that your package and file names do not contain spaces or characters that are illegal for your operating system.


You should use a Java package-like naming scheme for module file names, module names as found in the module-name portion of the ejb-jar.xml files, and EJB names as found in the ejb-name portion of the ejb-jar.xml files. This package-like naming scheme ensures that name collisions do not occur. The benefits of this naming practice apply not only to GlassFish Server, but to other Java EE application servers as well.

The following topics are addressed here:

Portable Naming

The Java EE 6 specification defines the portable application-name, which allows you to specify an application name in the application.xml file. For example:


<application-name>xyz</application-name>

This name is used before the archive name to derive the default application registration name. The application will be deployed under xyz if the application.xml file defines application-name as xyz. However, a user-specified name takes precedence over the portable application name. If application-name is not specified in the application.xml file, the application is deployed using the archive name (minus suffix) as the application registration name.

The Java EE 6 specification also defines the portable module-name element in the module standard deployment descriptors. For standalone modules, the defined module-name will be used as the application name when a name is not explicitly specified.

JNDI Naming

Java Naming and Directory InterfaceTM (JNDI) lookup names for EJB components must also be unique. Establishing a consistent naming convention can help. For example, appending the application name and the module name to the EJB name is a way to guarantee unique names, such as, jms/qConnPool.

Directory Structure

Application and module directory structures must follow the structure outlined in the Java EE specification. During deployment, the application or module is expanded from the archive file to an open directory structure. The directories are named with _jar and _war suffixes.

If you deploy a directory, your directory structure must follow this same convention. For instructions on performing directory deployment, see To Deploy an Application or Module in a Directory Format.

JSR 88 Naming

There are two JSR 88 APIs that can be used to deploy applications in GlassFish Server.

If you are using the following JSR 88 API, there is no file name:

javax.enterprise.deploy.spi.DeploymentManager.distribute(Target[], InputStream, InputStream)

Because there is no file name, the name of the application is taken from the display-name entry in the Java EE standard deployment descriptor. If the display-name entry is not present, GlassFish Server creates a temporary file name and uses that name to deploy the application. Neither the Administration Console nor the asadmin utility uses this API.

If you are using the following preferred JSR 88 API, the name is derived from the first portion of the file name (without the .war or .jar extension):

javax.enterprise.deploy.spi.DeploymentManager.distribute(Target[], File, File)

For more information about JSR 88, see http://jcp.org/en/jsr/detail?id=88.