Sun Java System Application Server Enterprise Edition 8.1 2005Q1 Developer's Guide |
Chapter 1
Setting Up a Development EnvironmentThis chapter gives guidelines for setting up an application development environment in the Sun Java System Application Server. Setting up an environment for creating, assembling, deploying, and debugging your code involves installing the mainstream version of the Sun Java System 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 DevelopmentFor the Sun Java Enterprise System, Application Server installation is part of the system installation process. For more information, see http://docs.sun.com/app/docs/prod/entsys.05q1#hic.
For all other installations, the following components are included in the full installation. For more information, see the Sun Java System Application Server Installation Guide.
- Sun Java System 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
- J2SE 1.4.2
- PointBase (intended for evaluation use only, not for production or deployment use)
- The High-Availability Database (HADB)
- Load balancer plugins for web servers
- JDK
- Sample Applications
After you have installed Sun Java System 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” on page 77 or “Using the Common Classloader” on page 77.
- Set up debugging. For more information, see Chapter 4, “Debugging Applications.”
- Configure the Java Virtual Machine (JVM) software. For more information, see the Sun Java System Application Server Administration Guide.
High Availability FeaturesHigh availability features such as load balancing and session failover are discussed in detail in the Sun Java System Application Server 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” on page 150.
- For information about checkpointing of the stateful session bean state, see “Stateful Session Bean Failover” on page 165.
- 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” on page 278.
ToolsThe following general tools are provided with Sun Java System Application Server:
The following development tools are provided with Sun Java System 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 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 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 asant Utility
Apache Ant 1.5.4 is provided with Sun Java System Application Server and can be launched from the bin directory using the command asant. Sun Java System Application Server also provides server-specific tasks for deployment; see “asant Assembly and Deployment Tool” on page 94. The sample applications provided with Sun Java System Application Server use Ant build.xml files; see Sample Applications.
For more information about Ant, see the Apache Software Foundation website:
deploytool
You can use the deploytool, provided with Sun Java System 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:
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” on page 80.
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 Upgrade and Migration Guide.
Debugging Tools
You can use several debuggers with the Sun Java System Application Server. For more information, see Chapter 4, “Debugging Applications.”
Profiling Tools
You can use several profilers with the Sun Java System Application Server. For more information, see “Profiling” on page 125.
Sample ApplicationsSample applications that you can examine and deploy are included with the full installation of the Sun Java System Application Server. You can also download these samples separately if you installed the Sun Java System Application Server without them initially.
If installed with the Sun Java System 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 Sun Java System 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” on page 94)
- 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 Sun Java System Application Server, you can invoke it using the following URL:
http://server:port/helloworld