Sun Java System Application Server Platform Edition 8

The Sun Java System Application Server Platform Edition 8 is a fully compliant implementation of the J2EE 1.4 platform. In addition to supporting all the APIs described in the previous sections, the Application Server includes a number of J2EE technologies and tools that are not part of the J2EE 1.4 platform but are provided as a convenience to the developer.

This section briefly summarizes the technologies and tools that make up the Application Server, and instructions for starting and stopping the Application Server, starting the Admin Console, starting deploytool, and starting and stopping the Derby database server. Other chapters explain how to use the remaining tools.

Technologies

The Application Server includes two user interface technologies--JavaServer Pages Standard Tag Library and JavaServerTrademarked Faces--that are built on and used in conjunction with the J2EE 1.4 platform technologies Java servlet and JavaServer Pages.

JavaServer Pages Standard Tag Library

The JavaServer Pages Standard Tag Library (JSTL) encapsulates core functionality common to many JSP applications. Instead of mixing tags from numerous vendors in your JSP applications, you employ a single, standard set of tags. This standardization allows you to deploy your applications on any JSP container that supports JSTL and makes it more likely that the implementation of the tags is optimized.

JSTL has iterator and conditional tags for handling flow control, tags for manipulating XML documents, internationalization tags, tags for accessing databases using SQL, and commonly used functions.

JavaServer Faces

JavaServer Faces technology is a user interface framework for building web applications. The main components of JavaServer Faces technology are as follows:

The following features support the GUI components:

All this functionality is available via standard Java APIs and XML-based configuration files.

Tools

The Application Server contains the tools listed in Table 1-1. Basic usage information for many of the tools appears throughout the tutorial. For detailed information, see the online help in the GUI tools and the man pages at http://docs.sun.com/db/doc/817-6092 for the command-line tools.

Table 1-1 Application Server Tools
Component
Description
Admin Console
A web-based GUI Application Server administration utility. Used to stop the Application Server and manage users, resources, and applications.
asadmin
A command-line Application Server administration utility. Used to start and stop the Application Server and manage users, resources, and applications.
asant
A portable command-line build tool that is an extension of the Ant tool developed by the Apache Software Foundation (see http://ant.apache.org/). asant contains additional tasks that interact with the Application Server administration utility.
appclient
A command-line tool that launches the application client container and invokes the client application packaged in the application client JAR file.
capture-schema
A command-line tool to extract schema information from a database, producing a schema file that the Application Server can use for container-managed persistence.
deploytool
A GUI tool to package applications, generate deployment descriptors, and deploy applications on the Application Server.
package-appclient
A command-line tool to package the application client container libraries and JAR files.
Derby database
A copy of the open source Derby database server.
verifier
A command-line tool to validate J2EE deployment descriptors.
wscompile
A command-line tool to generate stubs, ties, serializers, and WSDL files used in JAX-RPC clients and services.
wsdeploy
A command-line tool to generate implementation-specific, ready-to-deploy WAR files for web service applications that use JAX-RPC.

Starting and Stopping the Application Server

To start and stop the Application Server, you use the asadmin utility. To start the Application Server, open a terminal window or command prompt and execute

asadmin start-domain --verbose domain1 

A domain is a set of one or more Application Server instances managed by one administration server. Associated with a domain are the following:

You specify these values when you install the Application Server. The examples in this tutorial assume that you choose the default ports.

With no arguments, the start-domain command initiates the default domain, which is domain1. The --verbose flag causes all logging and debugging output to appear on the terminal window or command prompt (it will also go into the server log, which is located in <J2EE_HOME>/domains/domain1/logs/server.log).

Or, on Windows, you can choose

      ProgramsRight ArrowSun MicrosystemsRight ArrowJ2EE 1.4 SDKRight ArrowStart Default Server

After the server has completed its startup sequence, you will see the following output:

Domain domain1 started. 

To stop the Application Server, open a terminal window or command prompt and execute

asadmin stop-domain domain1 

Or, on Windows, choose

      ProgramsRight ArrowSun MicrosystemsRight ArrowJ2EE 1.4 SDKRight ArrowStop Default Server

When the server has stopped you will see the following output:

Domain domain1 stopped. 

Starting the Admin Console

To administer the Application Server and manage users, resources, and J2EE applications, you use the Admin Console tool. The Application Server must be running before you invoke the Admin Console. To start the Admin Console, open a browser at the following URL:

http://localhost:4848/asadmin/ 

On Windows, from the Start menu, choose

      ProgramsRight ArrowSun MicrosystemsRight ArrowJ2EE 1.4 SDKRight ArrowAdmin Console

Starting the deploytool Utility

To package J2EE applications, specify deployment descriptor elements, and deploy applications on the Application Server, you use the deploytool utility. To start deploytool, open a terminal window or command prompt and execute

deploytool 

On Windows, from the Start menu, choose

      ProgramsRight ArrowSun MicrosystemsRight ArrowJ2EE 1.4 SDKRight ArrowDeploytool

Starting and Stopping the Derby Database Server


Note: Application Server 8.2 includes a copy of the open source Derby database server. Application Server 8.0/ 8.1 includes the PointBase database server. If you are using Application Server 8.0/8.1, either follow the instructions in the J2EE Tutorial at http://java.sun.com/j2ee/1.4/docs/tutorial-update6/doc/index.html that works with Application Server 8.0/8.1 or upgrade to Application Server 8.2 (see http://java.sun.com/j2ee/1.4/download.html#appserv to download).


To start the Derby database server, open a terminal window or command prompt and execute

asadmin start-database 

After the database server completes its startup sequence, you will see the following output:

Starting database in the background. Log redirected to 
<j2ee.home>\derby\db.log. 
Command start-database executed successfully. 

To stop the Derby database server, open a terminal window or command prompt and execute

asadmin stop-database 

When the database server has stopped you will see the following output:

Shutdown successful.
Command stop-database executed sucessfully. 

For information about the Derby database included with Application Server 8.2, see the Derby web site at http://db.apache.org/derby.

Debugging J2EE Applications

This section describes how to determine what is causing an error in your application deployment or execution.

Using the Server Log

One way to debug applications is to look at the server log in <J2EE_HOME>/domains/domain1/logs/server.log. The log contains output from the Application Server and your applications. You can log messages from any Java class in your application with System.out.println and the Java Logging APIs (documented at http://java.sun.com/j2se/1.4.2/docs/guide/util/logging/index.html) and from web components with the ServletContext.log method.

If you start the Application Server with the --verbose flag, all logging and debugging output will appear on the terminal window or command prompt and the server log. If you start the Application Server in the background, debugging information is only available in the log. You can view the server log with a text editor or with the Admin Console log viewer. To use the log viewer:

  1. Select the Application Server node.
  2. Select the Logging tab.
  3. Click the Open Log Viewer button. The log viewer will open and display the last 40 entries.

If you wish to display other entries:

  1. Click the Modify Search button.
  2. Specify any constraints on the entries you want to see.
  3. Click the Search button at the bottom of the log viewer.

Using a Debugger

The Application Server supports the Java Platform Debugger Architecture (JPDA). With JPDA, you can configure the Application Server to communicate debugging information via a socket. In order to debug an application using a debugger:

  1. Enable debugging in the Application Server using the Admin Console as follows:
    1. Select the Application Server node.
    2. Select the JVM Settings tab. The default debug options are set to:
    3. -Xdebug -Xrunjdwp:transport=dt_socket,server=y,
        suspend=n,address=1044

      As you can see, the default debugger socket port is 1044. You can change it to a port not in use by the Application Server or another service.

    4. Check the Enabled box of the Debug field.
    5. Click the Save button.
  2. Stop the Application Server and then restart it.
  3. Compile your Java source with the -g flag.
  4. Package and deploy your application.
  5. Start a debugger and connect to the debugger socket at the port you set when you enabled debugging.