Sun Java System Application Server Platform Edition 9 Developer's Guide


This Developer's Guide describes how to create and run JavaTM Platform, Enterprise Edition (Java EE platform) applications that follow the open Java standards model for Java EE components and Application Programming Interfaces (APIs) in the Sun Java System Application Server (Application Server) environment. Topics include developer tools, security, debugging, and creating lifecycle modules.

Who Should Use This Book

This book is intended for use by software developers who create, assemble, and deploy Java EE applications using Sun Java System servers and software. Application Server software developers should already understand the following technologies:

How This Book Is Organized

The Developer's Guide has three parts.

The following table summarizes the chapters in this book.

Table P–1 How This Book Is Organized



Chapter 1, Setting Up a Development Environment

Describes setting up an application development environment in the Application Server. 

Chapter 2, Class Loaders

Describes Application Server class loaders. 

Chapter 3, The asant Utility

Describes how to use the asant utility, which provides Ant tasks specific to the Application Server.

Chapter 4, Debugging Applications

Provides guidelines for debugging applications in the Application Server. 

Chapter 5, Securing Applications

Explains how to write secure Java EE applications, which contain components that perform user authentication and access authorization. 

Chapter 6, Developing Web Services

Describes Application Server support for web services. 

Chapter 7, Using the Java Persistence API

Describes Application Server support for Java persistence. 

Chapter 8, Developing Web Applications

Describes how web applications are supported in the Application Server. 

Chapter 9, Using Enterprise JavaBeans Technology

Describes how Enterprise JavaBeansTM (EJBTM) technology is supported in the Application Server.

Chapter 10, Using Container-Managed Persistence

Provides information on how container-managed persistence (CMP) works in the Application Server. 

Chapter 11, Developing Java Clients

Describes how to develop and assemble Java EE application clients. 

Chapter 12, Developing Connectors

Describes Application Server support for the J2EE 1.5 Connector architecture. 

Chapter 13, Developing Lifecycle Listeners

Describes how to create and use a lifecycle listener module. 

Chapter 14, Developing Custom MBeans

Describes Application Server support for custom MBeans. 

Chapter 15, Using the JDBC API for Database Access

Explains how to use the JDBC API for database access with the Application Server. 

Chapter 16, Using the Transaction Service

Describes Java EE transactions and transaction support in the Application Server. 

Chapter 17, Using the Java Naming and Directory Interface

Explains how to use the Java Naming and Directory InterfaceTM (JNDI) API for naming and references.

Chapter 18, Using the Java Message Service

Explains how to use the Java Message Service (JMS) API, and describes the Application Server’s fully integrated JMS provider: the Sun Java System Message Queue software. 

Chapter 19, Using the JavaMail API

Explains how to use the JavaMailTM API.

Chapter 20, Using the Application Server Management Extensions

Explains how to use the Java Management Extensions (JMXTM) API.

Application Server Documentation Set

The Application Server documentation set describes deployment planning and system installation. The Uniform Resource Locator (URL) for stand-alone Application Server documentation is For an introduction to Application Server, refer to the books in the order in which they are listed in the following table.

Table P–2 Books in the Application Server Documentation Set

Book Title 


Documentation Center

Application Server documentation topics organized by task and subject. 

Release Notes

Late-breaking information about the software and the documentation. Includes a comprehensive, table-based summary of the supported hardware, operating system, Java Development Kit (JDKTM), and database drivers.

Quick Start Guide

How to get started with the Application Server product. 

Installation Guide

Installing the software and its components. 

Application Deployment Guide

Deployment of applications and application components to the Application Server. Includes information about deployment descriptors. 

Developer’s Guide

Creating and implementing Java Platform, Enterprise Edition (Java EE platform) applications intended to run on the Application Server that follow the open Java standards model for Java EE components and APIs. Includes information about developer tools, security, debugging, and creating lifecycle modules. 

Java EE 5 Tutorial

Using Java EE 5 platform technologies and APIs to develop Java EE applications. 

Administration Guide

Configuring, managing, and deploying Application Server subsystems and components from the Admin Console. 

Administration Reference

Editing the Application Server configuration file, domain.xml.

Upgrade and Migration Guide

Migrating your applications to the new Application Server programming model, specifically from Application Server 6.x, and 7.x, and 8.x. This guide also describes differences between adjacent product releases and configuration options that can result in incompatibility with the product specifications. 

Troubleshooting Guide

Solving Application Server problems. 

Error Message Reference

Solving Application Server error messages. 

Reference Manual

Utility commands available with the Application Server; written in man page style. Includes the asadmin command line interface.

Related Books

For documentation about other stand-alone Sun Java System server products, go to the following:

You can find a directory of the official Java EE 5 specifications at Additionally, the following resources might be useful.

General Java EE Online Information:

The Java EE 5 Tutorial

The Java EE Blueprints

General Java EE Books:

Core J2EE Patterns: Best Practices and Design Strategies by Deepak Alur, John Crupi, & Dan Malks, Prentice Hall Publishing

Java Security, by Scott Oaks, O’Reilly Publishing

Books on Programming With servlets and JavaServer PagesTM (JSPTM) Files:

Java Servlet Programming, by Jason Hunter, O’Reilly Publishing

Java Threads, 2nd Edition, by Scott Oaks & Henry Wong, O’Reilly Publishing

Books on Programming With EJB Components:

Enterprise JavaBeans, by Richard Monson-Haefel, O’Reilly Publishing

Books on Programming With JDBC:

Database Programming with JDBC and Java, by George Reese, O’Reilly Publishing

JDBC Database Access With Java: A Tutorial and Annotated Reference (Java Series), by Graham Hamilton, Rick Cattell, & Maydene Fisher

The JavadocTM Tool:

A Javadoc tool reference for packages provided with the Application Server is located at

Default Paths and File Names

The following table describes the default paths and file names that are used in this book.

Table P–3 Default Paths and File Names



Default Value 


Represents the base installation directory for Application Server. 

SolarisTM and Linux operating system installations, non-root user:


Solaris and Linux installations, root user: 


Windows, all installations: 



Represents the directory containing all domains. 



Represents the directory for a domain. 

In configuration files, you might see domain-dir represented as follows:



Typographic Conventions

The following table describes the typographic changes that are used in this book.

Table P–4 Typographic Conventions





The names of commands, files, and directories, and onscreen computer output 

Edit your .login file.

Use ls -a to list all files.

machine_name% you have mail.


What you type, contrasted with onscreen computer output 

machine_name% su



A placeholder to be replaced with a real name or value 

The command to remove a file is rm filename.


Book titles, new terms, and terms to be emphasized (note that some emphasized items appear bold online) 

Read Chapter 6 in the User's Guide.

A cache is a copy that is stored locally.

Do not save the file.

Symbol Conventions

The following table explains symbols that might be used in this book.

Table P–5 Symbol Conventions





[ ]

Contains optional arguments and command options. 

ls [-l]

The -l option is not required.

{ | }

Contains a set of choices for a required command option. 

-d {y|n}

The -d option requires that you use either the y argument or the n argument.

${ }

Indicates a variable reference. 


References the value of the com.sun.javaRoot variable.

Joins simultaneous multiple keystrokes. 


Press the Control key while you press the A key. 

Joins consecutive multiple keystrokes. 


Press the Control key, release it, and then press the subsequent keys. 


Indicates menu item selection in a graphical user interface. 

File -> New -> Templates 

From the File menu, choose New. From the New submenu, choose Templates. 

Accessing Sun Resources Online

The docs.sun.comSM web site enables you to access Sun technical documentation online. You can browse the archive or search for a specific book title or subject. Books are available as online files in PDF and HTML formats. Both formats are readable by assistive technologies for users with disabilities.

To access the following Sun resources, go to

Third-Party Web Site References

Third-party URLs are referenced in this document and provide additional, related information.

Note –

Sun is not responsible for the availability of third-party web sites mentioned in this document. Sun does not endorse and is not responsible or liable for any content, advertising, products, or other materials that are available on or through such sites or resources. Sun will not be responsible or liable for any actual or alleged damage or loss caused or alleged to be caused by or in connection with use of or reliance on any such content, goods, or services that are available on or through such sites or resources.

Sun Welcomes Your Comments

Sun is interested in improving its documentation and welcomes your comments and suggestions. To share your comments, go to and click Send Comments. In the online form, provide the full document title and part number. The part number is a 7-digit or 9-digit number that can be found on the book's title page or in the document's URL. For example, the part number of this book is 819-3659.