Welcome to the Sun JavaTM System Application Server Quick Start Guide. This guide describes basic steps for starting the Sun Java System Application Server (henceforth referred to as Application Server) software, and packaging and deploying applications. It also provides information about the Admin Console and command-line tools.
The intended audience for this guide is the system administrator, network administrator, Application Server administrator, and developer interested in learning the basics about Application Server software.
This document contains information about the following topics:
For information about conventions used in this document, see Documentation Conventions.
This section provides information for administrators who want to start and verify the Application Server software:
For administration tasks, the Application Server software provides these tools, which enable administrators to manage server instances:
The asadmin utility, a command-line tool
The Admin Console, a browser-based graphical user interface (GUI)
You start the server by starting the domain. A domain provides authentication and administration for the server instance that belongs to it. Starting the domain starts the server instance in the domain. A default domain called domain1 is created when you install Application Server.
A default domain does not get created in certain distributions (such as the Application Server bundled with Solaris 10 distributions). If a default domain has not been created, use the create-domain command to create an administrative domain. See create-domain(1).
To start the server, follow the steps below. Solaris and Linux steps are in the first column and Windows steps are in the second column:
When the server has completed startup, this message appears: Domain domain1 is ready to receive client requests. Additional services are being started in the background.
To verify that the server is running on your system, access this URL: http://localhost:8080.
The URL has two parts:
The name localhost refers to the system on which the browser is currently running. If the Application Server is running on another system, substitute the name of that system in the URL.
The default port number is 8080. If you changed the port number during installation, use that number in your browser’s address field instead.
You should see the server Welcome page, shown below.
This might take a few seconds to display as the server completes initialization.
When you see this page, you know that the server is running. If the server is not running, but your system is operating normally, you get a server not found error. (In some browsers, that error automatically launches a search engine.) For other problems, you might need to check your server and browser settings, as described in the Sun Java System Application Server Platform Edition 8.2 Troubleshooting Guide.
Later on, to stop the server, follow the steps below. Solaris and Linux steps are in the first column, and Windows steps are in the second column:
Solaris and Linux |
Windows |
---|---|
From the install-dir/bin directory, type this command: asadmin stop-domain |
From the Start menu, choose Programs ⇒ Sun Microsystems ⇒ Application Server PE ⇒ Stop Default Server. |
The server installation includes a pre-packaged application that says “Hello,” taken from The J2EE 1.4 Tutorial. The Hello web application is contained in a Web ARchive (WAR) file in the samples directory. Packaged applications can also be in the form of a Java ARchive (JAR) or Enterprise ARchive (EAR) file.
Dragging or copying to a domain’s autodeploy directory lets you put a pre-packaged application into use immediately, with minimal effort.
Find install-dir/samples/quickstart/hello.war.
Copy it to install-dir/domains/domain1/autodeploy/.
On Windows, you can create a shortcut to the autodeploy directory on your desktop, then drag and drop the hello.war file onto the shortcut.
When the server has finished deploying the application, it creates a file named hello.war_deployed in the autodeploy directory. Depending on the speed of your system, the process can take a few seconds. Until that file appears, a 404-File Not Found error occurs when you try to visit the application page.
Access this URL to visit the application page: http://localhost:8080/hello.
You should now see the application’s first page, which prompts you to fill in your name:
Type your name and click Submit.
You should now see the customized response, giving you a personal Hello.
You can also use the asadmin command-line utility to deploy from the command line or in a shell script. The command is asadmin deploy. For more information, see the deploy command documentation in the Sun Java System Application Server Platform Edition 8.2 Reference Manual.
Other deployment methods are discussed later in the Guide in To Deploy From the Admin Console, and To Deploy From a Development Directory. It is also possible to dynamically reload changes to your application. For more information, see To configure dynamic reloading in Sun Java System Application Server Platform Edition 8.2 Administration Guide.
The Admin Console is a web-based interface that simplifies a variety of administration and configuration tasks. It is commonly used to accomplish the following:
Deploy and undeploy applications
Enable and disable applications
Identify which applications are currently running
Configure Java DataBase Connectivity (JDBCTM) resources and other server settings
Select and view recent entries in the log file
For further information about using the Admin Console, consult the online help or the Sun Java System Application Server Platform Edition 8.2 Administration Guide.
Access http://localhost:4848.
The localhost variable is the name of the system that the browser is currently running on. If Application Server software is running on another system, substitute the name of that system for localhost.
4848 is the Admin Console’s default port number. If you changed the port number during the installation, use that number instead.
Windows users can also use the Start menu option: Programs ⇒ Sun Microsystems ⇒ Application Server PE ⇒Admin Console.
When the Login window appears, enter the admin user name and password.
Click Log In.
When the Admin Console appears, it looks like this:
Use the options at the top of the information panel to configure a variety of operational settings for Application Server software.
To see the server’s log file, click “Search Log Files” under the Common Tasks heading in the right pane. When the Log Viewer window appears, you can see status messages from the server and output from your J2EE application.
You have successfully completed the first section of the Quick Start Guide. You started the Application Server, deployed the Hello application, and viewed the Admin Console. To continue with the Quick Start tasks, go on to Packaging and Deploying Applications.
Before applications can be deployed, they must be packaged into Java ARchive (JAR), Web ARchive (WAR), or Enterprise ARchive (EAR) files. The packaged application includes deployment descriptors, which give the Application Server software the information it needs to load the application, map a URL to it, and connect it to the resources it uses. This section describes the following techniques for packaging and deploying applications:
For more information, see “Getting Started With Web Applications” in The J2EE 1.4 Tutorial.
NetBeansTM IDE is an Integrated Development Environment you can use to create, package, and deploy complex Java 2 Platform, Enterprise Edition (J2EE platform) applications. The NetBeans IDE is available for download from http://www.netbeans.org. NetBeans IDE integrates the development environment with the deployment environment, and automates many steps for producing J2EE applications. Once you register the Application Server with the NetBeans IDE, you can easily deploy applications, make changes, and redeploy them.
For more information on NetBeans IDE, see the documentation at: http://www.netbeans.org.
If applications are not packaged with a tool such as NetBeans IDE, you can use the asant utility shipped with the product. The asant utility is used to automate repetitive deployment tasks. It is a shell script that initializes the Application Server environment and launches the Jakarta Ant tool. For more information on the asant utility, see the Sun Java System Application Server Platform Edition 8.2 Reference Manual.
The Hello application deployed earlier was already packaged into a WAR file. This section covers packaging the application's components into another WAR file. The build.xml file included with the Hello application contains the build targets.
If you have not already added install-dir/bin to your PATH environment variable, do so now.
Go to the install-dir/samples/quickstart/ directory.
Type asant war.
This command assembles the WAR file for the application in install-dir/samples/quickstart/build/assemble/war.
Now that you have packaged the Hello application, you can deploy it. The following section discusses deploying the Hello application using the Admin Console. You can also deploy using asant. For more information, see Sun Java System Application Server Platform Edition 8.2 Developer’s Guide.
Access http://localhost:4848/.
localhost is used if the both the browser and the Application Server are running on the same system. If the Application Server is running on another system, substitute the name of that system in the URL.
4848 is the Admin Console’s default port number. If you changed the port number during the installation, use that number instead.
Enter the admin user name and password.
In the left pane, click the Applications node to expand it.
Click Web Applications.
If you already have a Hello application deployed, undeploy it now by selecting the checkbox next to it and clicking Undeploy.
To deploy the newly assembled Hello application, on the Web Applications page, click Deploy.
Select the Specify a package file to upload to the Application Server radio option and click Browse.
Navigate to the install-dir/samples/quickstart/build/assemble/war directory and select hello.war.
Click Next.
On the Deploy Web Module page, click OK.
The application appears in the Web Applications list.
To verify that it was deployed properly, click Launch.
The application's first page appears.
You can deploy an application directly from a development directory, if the appropriate directory hierarchy and deployment descriptors have been created. Because the process is complex for non-trivial applications, it is a procedure that is recommended only for advanced users, or simple applications. But when it is feasible to do so, deploying directly from a directory can speed up the development cycle.
The process can be performed interactively by using the Admin Console, or by using asadmin deploydir from the command line or in a script. The steps for the command line are presented here, because most developers want to automate the procedure in command scripts.
Before using asadmin on Windows, see To Configure the Windows Environment to Use the Command-Line Tools.
In the install-dir/samples/quickstart/ directory, create a new directory called hello2/.
Unzip the contents of the hello.war file into the hello2/ directory.
Preserve the directory structure of the hello.war file when you unzip it. It is a template for the kind of file structure you need to deploy directly from a directory.
If you already have a Hello application deployed, undeploy it now using the command asadmin undeploy hello at the command line.
Issue the following command to deploy the application:
asadmin deploydir install-dir/samples/quickstart/hello2
Specify the full path to the hello2/ directory.
If you installed the Application Server with the “Prompt for Administration User Name” option, also specify the option --user username, where username is the admin user name. You are prompted for the password.
The following message appears: Command deploydir executed successfully.
Verify that the application is running by going to this URL: http://localhost:8080/hello.
You have completed the second section of the Quick Start Guide. See Using Command-Line Tools for more information on the command-line tools available in Application Server. See Where to Go Next for information on other resources for learning about Application Server.
The Application Server software offers a variety of command-line tools for performing administrative functions, in addition to the Admin Console. This section explains what command-line tools are available.
To launch a tool, type the name of the tool in a command window. This table lists tools in the first column and describes them in the second column.
Name of Tool |
Description |
---|---|
appclient |
Launches the Application Client Container and invokes the client application packaged in the application Java archive (JAR) file. |
asadmin |
Application Server administration tool for configuring the Application Server software. |
asant |
Launches the Jakarta Ant tool, so that you can automate repetitive development and deployment tasks. |
asupgrade |
Application Server administration tool for upgrading the Application Server software. |
capture-schema |
Extracts schema information from a database and produces a schema file that the server can use for Container Managed Persistence (CMP). |
deploytool |
Creates deployment descriptors for J2EE applications, packages them into JAR, Web archive (WAR), and enterprise archive (EAR) files, and deploys them on the server. This tool also provides a graphical user interface. |
jspc |
Compiles JSP pages. |
package-appclient |
Packages the application client container libraries and JAR files. |
verifier |
Validates the J2EE deployment descriptors with the DTDs. This tool also provides a graphical user interface. To see the GUI, specify the -u option. Some Windows systems launch a driver verifier utility with the same name. To launch the Application Server verifier, you must be in the install-dir/bin directory. |
wscompile |
Takes the service definition interface and generates the client stubs or server-side skeletons for JAX-RPC, or generates a Web Services Description Language (WSDL) description for the provided interface. |
wsdeploy |
Generates an implementation-specific, ready-to-deploy WAR file for web services applications that use JAX-RPC. |
From the Explorer window or desktop, right-click My Computer.
Choose Properties to display the System Properties dialog.
Click the Advanced tab.
Click Environment Variables.
In the User variables section, add or update the PATH variable.
In the User variables section, add the environment variable AS_ADMIN_USER and set it to the Administrative User Name that you assigned during installation.
Click OK to commit the change and close the remaining open windows.
Other resources for learning about and using Application Server are available, including the following:
The server’s Installation Complete page at install-dir/docs/about.html
See this document for the latest information on what is new, and pointers to tutorials and other educational services.
Sun Java System Application Server Platform Edition 8.2 Release Notes
See this document for late-breaking changes and other information regarding this release.
Sun Java System Application Server Platform Edition 8.2 Administration Guide
See this guide for a reference for performing administrative functions using the Admin Console.
Sun Java System Application Server Platform Edition 8.2 Reference Manual (man pages)
See this document for reference information on Application Server’s command-line utilities, such as asadmin.
The J2EE 1.4 Tutorial (http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html)
See this document for a tutorial that covers the process for building and deploying Java 2 Platform, Enterprise Edition (J2EETM platform) applications.
Java BluePrints guidelines for the Enterprise
See this site for a comprehensive set of examples that demonstrate operations of the Application Server software and that can be used as application templates.
See this site to download the NetBeans IDE and view the documentation, including installation instructions and Quick Start Guides.
This section describes the types of conventions used throughout this guide.
The following general conventions are used in this guide:
File and directory paths are given in UNIX® format (with forward slashes separating directory names). For Windows versions, the directory paths are the same, except that backslashes are used to separate directories.
URLs are given in the following format:
http:/server.domain/path/file.html
In these URLs, server is the server name where applications are run; domain is your Internet domain name; path is the server’s directory structure; and file is an individual filename. Emphasis items in URLs are placeholders.
Font conventions include the following:
The monospace font is used for sample code and code listings, API and language elements (such as function names and class names), file names, path names, directory names, and HTML tags.
Emphasis type is used for code variables.
Emphasis type is also used for book titles, emphasis, variables and placeholders, and words used in the literal sense.
Bold type is used as either a paragraph lead-in or to indicate words used in the literal sense.
Installation root directories for most platforms are indicated by install-dir in this document.
By default, the location of install-dir on most platforms is:
Solaris and Linux file-based installations, non-root user:
user’s home directory/SUNWappserver
Solaris and Linux file-based installations, root user:
/opt/SUNWappserver
Windows, all installations:
system drive:\\Sun\\AppServer
Domain root directories are indicated by domain-dir in this document, which by default is an abbreviation for the following:
install-dir/domains/
However, for package-based installations, the directory containing all the domains can be changed from install-dir/domains/ to another directory during installation. In configuration files, you may see domain-dir represented as follows:
${com.sun.aas.instanceRoot}