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:
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.
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
Java DB database, based on the Derby database from Apache
The High-Availability Database (HADB)
Load balancer plug-ins for web servers
JDK
Sample Applications
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:
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 Enterprise Edition 8.2 Administration Guide.
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:
For information about HTTP session persistence, see Distributed Sessions and Persistence.
For information about checkpointing of the stateful session bean state, see Stateful Session Bean Failover.
For information about failover and load balancing for Java clients, see Chapter 8, Developing Java Clients.
For information about load balancing for message-driven beans, see Load-Balanced Message Inflow.
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 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 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.
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.
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/.
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.
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.
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.
You can use several debuggers with the Application Server. For more information, see Chapter 4, Debugging Applications.
You can use several profilers with the Application Server. For more information, see Profiling.
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