This chapter gives guidelines for setting up an application development environment in the Sun JavaTM System Communications Server. Setting up an environment for creating, assembling, deploying, and debugging your code involves installing the mainstream version of the Communications 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 Communications Server installation, see the Sun GlassFish Communications Server 2.0 Installation Guide.
The following components are included in the full installation.
JDK
Communications Server core
Java 2 Platform, Standard Edition (Java SE) 6
Java EE 6 compliant application server
Admin Console
asadmin utility
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 NetBeansTM Integrated Development Environment (IDE) bundles the GlassFish edition of the Communications Server, so information about this IDE is provided as well.
After you have installed Communications 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 22, Java Virtual Machine and Advanced Settings, in Sun GlassFish Communications Server 2.0 Administration Guide.
Communications Server 2.0 is developed through the Sailfin project open-source community at https://sailfin.dev.java.net/. The Sailfin project provides a structured process for developing the Communications 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 Communications Server source code and to contribute to the development of the Communications Server. The Sailfin project is designed to encourage communication between Sun engineers and the community.
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.
For more information about usage profiles, see Usage Profiles in Sun GlassFish Communications Server 2.0 Administration Guide.
High availability features such as load balancing and session failover are discussed in detail in the Sun GlassFish Communications Server 2.0 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.
The following general tools are provided with the Communications Server:
The following development tools are provided with the Communications 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 Communications Server 2.0 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 Communications Server online help.
To access the Admin Console, type http://host:4848 (developer profile) or https://host:4848 (cluster profile) in your browser. The host is the name of the machine on which the Communications Server is running. By default, the host is localhost. For example:
http://localhost:4848 |
Apache Ant 1.6.5 is provided with the Communications Server and can be launched from the bin directory using the command asant. The Communications 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 Communications 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 Communications Server 2.0 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 Communications 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 Communications Server.
You can also use the Communications 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 Communications Server. For more information, see Chapter 4, Debugging Applications.
You can use several profilers with the Communications 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 Communications Server and use Sun-specific deployment descriptors.
Sample applications that you can examine and deploy to the Communications Server are available. If you installed the Communications 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 Communications Server without them initially.
Most Communications 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/.