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 more information about stand-alone Application Server installation, see the Sun Java System Application Server Platform Edition 9 Installation Guide.
The following components are included in the full installation.
Application Server core
Java EE 5 compliant application server
Admin Console
asadmin utility
Other development and deployment tools
Sun Java System Message Queue software
Java 2 Platform, Standard Edition (J2SETM) 5
Java DB database, based on the Derby database from Apache
JDK
The NetBeansTM Integrated Development Environment (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 class loaders. For more information, see Using the System Class Loader or Using the Common Class Loader.
Set up debugging. For more information, see Chapter 4, Debugging Applications.
Configure the Java Virtual Machine (JVMTM) software. For more information, see Chapter 19, Java Virtual Machine and Advanced Settings, in Sun Java System Application Server Platform Edition 9 Administration Guide.
Application Server Platform Edition 9 is developed through the GlassFishSM project open-source community at https://glassfish.dev.java.net/. The GlassFish project provides a structured process for developing the Application Server platform that makes the new features of Java EE 5 available faster, while maintaining the most important feature of Java EE: compatibility. It enables Java developers to access the Application Server source code and to contribute to the development of the Application Server. The GlassFish project is designed to encourage communication between Sun engineers and the community.
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 Platform Edition 9 Reference Manual.
The asadmin command is located in the install-dir/bin directory. Type asadmin help for a list of subcommands.
The Admin Console lets you configure the server and perform both administrative and development tasks using a web browser. For general information about the Admin Console, click the Help button in the Admin Console. This displays the Application Server online help.
To access the Admin Console, type http://host:4848 in your browser. The host is the name of the machine on which the Application Server is running. By default, the host is localhost. For example:
http://localhost:4848 |
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 administration and deployment; see Chapter 3, The asant Utility. The sample applications that can be used 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/.
The verifier tool checks a Java EE application file, including Java classes and deployment descriptors, for compliance with Java EE specifications. Java EE application files are Java archive (JAR), web archive (WAR), resource adapter archive (RAR), or enterprise archive (EAR) files. Use the verifier tool to check whether an application complies with the Java EE specification and to make applications portable across application servers. The verifier tool can be launched from the command line. For more information, see The verifier Utility in Sun Java System Application Server Platform Edition 9 Application Deployment Guide.
The NetBeans IDE 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.5 IDE. To download the NetBeans IDE, see http://www.netbeans.org. This site also provides documentation on how to use the NetBeans IDE with the bundled Application Server.
You can also use the Application Server with the Sun Java Studio 8 software, which is built on the NetBeans IDE. For more information, see http://developers.sun.com/prodtech/javatools/jsenterprise/.
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 Platform Edition 9 Upgrade and Migration Guide.
You can use several debugging tools 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 Tools.
A plug-in for the Eclipse IDE is available at http://glassfishplugins.dev.java.net/. This site also provides documentation on how to register the Application Server and use Sun-specific deployment descriptors.
Sample applications that you can examine and deploy to the Application Server are available. If you installed the Application Server as part of installing the Java EE 5 SDK bundle from Java EE 5 Downloads, the samples may already be installed. You can download these samples separately from the Code Samples page if you installed the Application Server without them initially.
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 Chapter 3, The asant Utility.
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 samples-install-dir/bp-project/main.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 imports main.xml.
In addition to the Java EE 5 sample applications, samples are also available on the GlassFish web site at https://glassfish-samples.dev.java.net/.