Sun Java System Application Server Platform Edition 8.1 2005Q2 Update 2 Developer's Guide

- Previous: Preface
- Next: Chapter 2 Securing Applications

# Chapter 1 Setting Up a Development Environment

This chapter gives guidelines for setting up an application development environment in the Sun JavaTM System Application Server. Setting up an environment for creating, assembling, deploying, and debugging your code involves installing the mainstream version of the Application Server and making use of development tools. In addition, sample applications are available. These topics are covered in the following sections:

- Installing and Preparing the Server for Development

- Tools

- Sample Applications

# Installing and Preparing the Server for Development

For the Sun Java Enterprise System, Application Server installation is part of the system installation process. For more information, see `http://www.sun.com/software/javaenterprisesystem/index.html`.

For all other installations, the following components are included in the full installation. For more information, see the Sun Java System Application Server Platform Edition 8.1 2005Q2 Update 2 Installation Guide.

- Application Server core, including:

  - J2EE 1.4 compliant application server

  - Administration Console

  - `asadmin` utility

  - deploytool

  - Other development and deployment tools

  - Sun Java System Message Queue software

  - J2SE 1.4.2

  - PointBase (intended for evaluation use only, not for production or deployment use)

- JDK

- Sample Applications

After you have installed Application Server, you can further optimize the server for development in these ways:

- Locate utility classes and libraries so they can be accessed by the proper classloaders. For more information, see Using the System Classloader or Using the Common Classloader.

- Set up debugging. For more information, see Chapter 4, Debugging Applications.

- Configure the Java Virtual Machine (JVMTM) software. For more information, see the Sun Java System Application Server Platform Edition 8.1 2005Q2 Update 2 Administration Guide.

# Tools

The following general tools are provided with the Application Server:

- The asadmin Command

- The Administration Console

The following development tools are provided with the Application Server or downloadable from Sun:

- The asant Utility

- deploytool

- Verifier

- Migration Tool

The following third-party tools might also be useful:

- Debugging Tools

- Profiling Tools

## The asadmin Command

The `asadmin` command allows you to configure a local or remote server and perform both administrative and development tasks at the command line. For general information about `asadmin`, see the Sun Java System Application Server Platform Edition 8.1 2005Q2 Update 2 Reference Manual.

The `asadmin` command is located in the install-dir`/bin` directory. Type `asadmin help` for a list of subcommands.

## The Administration Console

The Administration Console lets you configure the server and perform both administrative and development tasks using a web browser. For general information about the Administration Console, see the Sun Java System Application Server Platform Edition 8.1 2005Q2 Update 2 Administration Guide.

To access the Administration Console, type `http://`host`:4848` in your browser. The host is the name of the machine on which the Application Server is running.

## The asant Utility

Apache Ant 1.6.2 is provided with the Application Server and can be launched from the `bin` directory using the command `asant`. The Application Server also provides server-specific tasks for deployment; see asant Assembly and Deployment Tool. The sample applications provided with the Application Server use Ant `build.xml` files; see Sample Applications.

For more information about Ant, see the Apache Software Foundation web site at `http://ant.apache.org/`.

## deploytool

You can use the deploytool, provided with Application Server, to assemble J2EE applications and modules, configure deployment parameters, perform simple static checks, and deploy the final result. For more information about using the deploytool, see the J2EE 1.4 Tutorial at `http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html`.

## Verifier

The verifier tool checks a J2EE application file (EAR, JAR, WAR, RAR), including Java classes and deployment descriptors, for compliance with J2EE specifications. Use it to check whether an application has obvious bugs and to make applications portable across application servers. The verifier can be launched from the deploytool or from the command line. For more information, see The Deployment Descriptor Verifier.

## Migration Tool

The Migration Tool reassembles J2EE applications and modules developed on other application servers. For more information and to download the Migration Tool, see `http://java.sun.com/j2ee/tools/migration/index.html`.

For additional information on migration, see the Sun Java System Application Server Platform Edition 8.2 Upgrade and Migration Guide.

## Debugging Tools

You can use several debuggers with the Application Server. For more information, see Chapter 4, Debugging Applications.

## Profiling Tools

You can use several profilers with the Application Server. For more information, see Profiling.

# Sample Applications

Sample applications that you can examine and deploy are included with the full installation of the Application Server. You can also download these samples separately if you installed the Application Server without them initially.

If installed with the Application Server, the samples are in the install-dir`/samples` directory. The samples are organized in categories such as `ejb`, `jdbc`, `connectors`, `i18n`, and so on. Each sample category is further divided into subcategories. For example, under the `ejb` category are `stateless`, `stateful`, `security`, `mdb`, `bmp`, and `cmp` subcategories.

Most Application Server samples have the following directory structure:

- The `docs` directory contains instructions for how to use the sample.

- The `build.xml` file defines `asant` targets for the sample (see asant Assembly and Deployment Tool.

- The `build` and `javadocs` directories are generated as a result of targets specified in the `build.xml` file.

- The `src/java` directory under each component contains source code for the sample.

- The `src/conf` directory under each component contains the deployment descriptors.

With a few exceptions, sample applications follow the standard directory structure described here: `http://java.sun.com/blueprints/code/projectconventions.html`.

The install-dir`/samples/``common-ant.xml` file defines properties common to all sample applications and implements targets needed to compile, assemble, deploy and undeploy sample applications. In most sample applications, the `build.xml` file includes `common-ant.xml`.

For a detailed description of the `helloworld` sample and how to deploy and run it, see the associated documentation at:

    install-dir/samples/ejb/stateless/apps/simple/docs/index.html

After you deploy the `helloworld` sample in Application Server, you can invoke it using the following URL:

    http://server:port/helloworld

- Previous: Preface
- Next: Chapter 2 Securing Applications

- © 2010, Oracle Corporation and/or its affiliates