This chapter gives guidelines for setting up an application development environment in the Sun JavaTM System Enterprise Server. Setting up an environment for creating, assembling, deploying, and debugging your code involves installing the mainstream version of the Enterprise 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, Enterprise 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 Enterprise Server installation, see the Sun GlassFish Enterprise Server v2.1.1 Installation Guide.
The following components are included in the full installation.
Enterprise Server core
Java 2 Platform, Standard Edition (Java SE) 6
Java EE 6 compliant application server
Other development and deployment tools
Sun Java System Message Queue software
The Java Business Integration runtime (JBI runtime)
Java DB database, based on the Derby database from Apache
Load balancer plug-ins for web servers
The High-Availability Database (HADB)
The NetBeansTM Integrated Development Environment (IDE) bundles the GlassFish edition of the Enterprise Server, so information about this IDE is provided as well.
Set up debugging. For more information, see Chapter 4, Debugging Applications.
Configure the Java Virtual Machine (JVMTM) software. For more information, see Chapter 20, Java Virtual Machine and Advanced Settings, in Sun GlassFish Enterprise Server v2.1.1 Administration Guide.
Enterprise Server v2.1.1 is developed through the GlassFishTM project open-source community at https://glassfish.dev.java.net/. The GlassFish project provides a structured process for developing the Enterprise 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 Enterprise Server source code and to contribute to the development of the Enterprise Server. The GlassFish project is designed to encourage communication between Sun engineers and the community.
The Java ES edition of the Enterprise Server is based on the GlassFish source code, but provides additional value-added features such as access to a high-availability database (HADB) for session persistence and failover.
When you install a domain, the usage profile you select determines the features that are available by default. Here is a summary of the usage profiles:
developer profile - Provides a lightweight feature set optimized for developers, with one server instance and no clustering features.
cluster profile - Provides the complete GlassFish feature set, including clustering features.
enterprise profile - Provides access to features available by default only in the Java ES edition. In the GlassFish edition, this profile is only functional if you download the Java ES features separately and make global configuration changes. The Java ES features are HADB, Network Security Services (NSS), and optionally the Sun GlassFish database drivers.
For more information about usage profiles, see Usage Profiles in Sun GlassFish Enterprise Server v2.1.1 Administration Guide.
High availability features such as load balancing and session failover are discussed in detail in the Sun GlassFish Enterprise Server v2.1.1 High Availability Administration Guide. This book 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 11, Developing Java Clients.
For information about load balancing for message-driven beans, see Load-Balanced Message Inflow.
For information about JMS availability, see JMS Service High Availability.
The following general tools are provided with the Enterprise Server:
The following development tools are provided with the Enterprise 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 GlassFish Enterprise Server v2.1.1 Reference Manual.
The asadmin command is located in the as-install/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 Enterprise Server online help.
To access the Admin Console, type http://host:4848 (developer profile) or https://host:4848 (cluster and enterprise profiles) in your browser. The host is the name of the machine on which the Enterprise Server is running. By default, the host is localhost. For example:
Apache Ant 1.6.5 is provided with the Enterprise Server and can be launched from the bin directory using the command asant. The Enterprise 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 Enterprise 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 GlassFish Enterprise Server v2.1.1 Application Deployment Guide.
The NetBeans IDE allows you to create, assemble, and debug code from a single, easy-to-use interface. The GlassFish edition of the Enterprise 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 Enterprise Server.
You can also use the Enterprise 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.
You can use several debugging tools with the Enterprise Server. For more information, see Chapter 4, Debugging Applications.
You can use several profilers with the Enterprise 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 Enterprise Server and use Sun-specific deployment descriptors.
Sample applications that you can examine and deploy to the Enterprise Server are available. If you installed the Enterprise 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 Enterprise Server without them initially.
Most Enterprise 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/.