Sun Java System Application Server Enterprise Edition 8.2 Developer's Guide

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

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 more information about stand-alone Application Server installation, see the Sun Java System Application Server Enterprise Edition 8.2 Installation Guide.

The following components are included in the full installation.

The NetBeans IDE bundles the Platform Edition of the Application Server, so information about this IDE is provided as well.

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

High Availability Features

High availability features such as load balancing and session failover are discussed in detail in the Sun Java System Application Server Enterprise Edition 8.2 High Availability Administration Guide. This Developer's Guide describes the following features in the following sections:

Tools

The following general tools are provided with the Application Server:

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

The following third-party tools might also be useful:

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 Enterprise Edition 8.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 Enterprise Edition 8.2 Administration Guide.

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

NetBeans IDE

The NetBeansTM IDE (integrated development environment) allows you to create, assemble, and debug code from a single, easy-to-use interface. The Platform Edition of the Application Server is bundled with the NetBeans 5 IDE. For more information about using the NetBeans IDE, see http://www.netbeans.org.

The asant Utility

Apache Ant 1.6.5 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 compliance 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 converts and reassembles Java EE applications and modules developed on other application servers. This tool also generates a report listing how many files are successfully and unsuccessfully migrated, with reasons for migration failure. 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 Enterprise 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:

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