Home | Download | PDF | API | FAQ | Search | Feedback | History

> ## Sun Java System Application Server Platform Edition 9

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

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

> ### 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.

> 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.
> `package-appclient` | A command-line tool to package the application client container libraries and JAR files.
> Java DB database | A copy of the Java DB database server.
> `verifier` | A command-line tool to validate Java EE deployment descriptors.
> xjc | A command-line tool to transform, or bind, a source XML schema to a set of JAXB content classes in the Java programming language.
> schemagen | A command-line tool to create a schema file for each namespace referenced in your Java classes.
> wsimport | A command-line tool to generate JAX-WS portable artifacts for a given WSDL file. After generation, these artifacts can be packaged in a WAR file with the WSDL and schema documents along with the endpoint implementation and then deployed.
> wsgen | A command-line tool to read a web service endpoint class and generate all the required JAX-WS portable artifacts for web service deployment and invocation.

> ### 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 the following:

>     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:

> - The Application Server's port number. The default is 8080.
> - The administration server's port number. The default is 4848.
> - An administration user name and password.

> You specify these values when you install the Application Server. The examples in this tutorial assume that you chose 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 `<``JAVAEE_HOME``>/domains/domain1/logs/server.log`).

> Or, on Windows, you can choose

> Programs Sun Microsystems Application Server PE Start 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

> Programs Sun Microsystems Application Server PE Stop 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 Java EE applications, 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

> Programs Sun Microsystems Application Server PE Admin Console

> ### Starting and Stopping the Java DB Database Server

> The Application Server includes the Java DB database.

> To start the Java DB database server, open a terminal window or command prompt and execute

>     asadmin start-database

> On Windows, from the Start menu, choose

> Programs Sun Microsystem Application Server PE Start Java DB

> To stop the Java DB server, open a terminal window or command prompt and execute

>     asadmin stop-database

> On Windows, from the Start menu, choose

> Programs Sun Microsystems Application Server PE Stop Java DB

> For information about the Java DB database included with the Application Server see the Apache Derby Project web site at `http://db.apache.org/derby/`.

> ### Debugging Java EE 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 `<``JAVAEE_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.5.0/docs/guide/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:

> `-Xdebug -Xrunjdwp:transport=dt_socket,server=y,
> suspend=n,address=9009`

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

> 3. Check the Enabled box of the Debug field.
> 4. 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.