![]() |
Internationalization (i18N) Sample Application |
Internationalization (i18N) Sample Application
This document describes how to utilize the Internationalization (i18N) sample application in conjunction with Sun ONE Application Server version 7.This sample application document contains the following sections:
Overview
Compiling and Assembling the Sample Application
Deploying the Sample Application
Overview
The Internationalization (i18N) sample application is a collection of simple applications that demonstrate the i18N features and covers specific features of Java Servlet and Java Server Pages specifications that are implemented in the Sun ONE Application Server.Assembling this application and deploying it to the Sun ONE Application Server introduces you to the Sun ONE Application Server Administration Tool.
Compiling and Assembling the Sample Application
This section contains instructions to build and assemble the Internationalization (i18N) sample application using a Command Line Interface (CLI).To rebuild the entire application from scratch, follow these steps:
Compile and Assemble the EAR file. For example:
You are now ready to use this ear file for deployment.
Deploy the application.
- Execute asant core under <install_root>/samples/i18n/simple/src
Clean the web application project area. For example:
- Once you have re-created the sample application from scratch proceed to Deploying the Sample Application.
- Execute asant clean
- This will remove the sample application assemble and build directories.
Deploying the Sample Application
In this section, you will learn how to deploy the Internationalization (i18N) sample application.To deploy the application, the administrative server needs to be running. To start the admin server, if not already started, perform one of the following procedures, depending on your operating system:
UNIX:
Select one of the following approaches to deploying the application:
Windows:
- Execute <install_root>/domains/domain1/admin-server/bin/startserv
- Start --> Programs --> Sun ONE Application Server 7 --> Start Application Server
Command Line-based Deployment describes how to manually register the application in Sun ONE Application Server using a Command Line Interface (CLI). This is the fastest means of deploying the sample application.
GUI-based Deployment describes how to use the Sun ONE Application Server Deployment Tool to import and deploy the sample application.
Command Line-based Deployment
Since a complete EAR file is supplied, the fastest means of setting up the application is to use the command line utilities as described in this section.The pre-built i18n-simple.ear file is an Enterprise Archive file that contains the XML deployment descriptor files, application class files, JSPs, and other content required by the application.
Deploying the pre-built i18n-simple.ear file is simple. Deploy either by Using the asant script or by Using the asadmin command.
Go to the src directory of the sample. For example:
Run asant using deploy task. For example:
- <install_root>/samples/i18n/simple/src
- %asant deploy
Go to the root of the sample directory. For example:
The deployment process involves the following operations:
Execute asadmin to deploy application to the local application server instance. For example:
- <install_root>/samples/i18n/simple
- <install_root>/bin/asadmin deploy -u <username> -w <password> -H <host> -p <port> --instance <server instance name> i18n-simple.ear
Authenticates against the local application server's administrative server
If you would like to verify the registration of the application, you may proceed to Verifying Deployment. Otherwise, proceed to Running the Sample Application.The EAR file is transferred to the administrative server
The administrative server begins the registration process:
GUI-based Deployment
Since a pre-built Enterprise Archive (EAR) file for the sample application is included with the application server, you can use the Sun ONE Application Server Administration Tool to quickly read in the .ear file and deploy it to the application server.To deploy the EAR file, follow these steps:
Open the pre-existing sample EAR file.
Start the admin server if not already started. For example, in UNIX, execute the following: <s1as_install_dir>/domains/domain1/admin-server/startserv
Navigate to the browser based admin server page [http://<server-host>:<admin-port>/index.html].
Enter your <username> and <password> to access the admin server.
Click on App Server Instances>server1>Applications>Enterprise Apps
In the right hand pane, click on Deploy to deploy an application.
You will be asked for the application name. Enter i18n-simple and Click OK.
- Choose the file (from disk) to be deployed (i18n-simple.ear) and Click OK.
- If the deployment goes through fine, you will see the original pane with WebFormauth application as deployed. In the startup dialog, select Browse for more applications to find the i18n-simple.ear file.
Note Before redeploying, you must first execute the command asant clean in order to clean up existing files resulting the initial deployment.
Verifying Deployment
As an optional step, you can use the Sun ONE Application Server Administration Tool to verify that the application has been registered. Otherwise, proceed directly to Running the Sample Application.To verify the registration of the application, follow these steps:
Execute the command asadmin list-components to look at applications deployed with a server instance. For example:
Alternately, you may navigate the Admin tool GUI to the following:
- asadmin list-components -u <username> -w <password> -H <host> -p <admin-port> <server instance name>
- You will see i18n-simple listed.
On the left frame, Click on Enterprise Apps to display list of applications deployed on server.
- App Server Instances --> server1 --> Applications --> Enterprise Apps.
- You will see i18n-simple listed.
Running the Sample Application
You can run the application through the following URL: http://<hostname>:<port>/i18n-simpleTraverse individual links to execute the i18n sample application.
If you encounter problems when running the application, review the log files at <install-root>/domains/domain1/<server-instance>/logs/server.log to learn what exactly went wrong.
Although the war, ear context-root and servlet alias names in this sample are all "i18n-simple", it is not necessary that it be so. The application will work as expected if the names of each of these attributes is unique. Rebuild the app after changing the context-root (in application.xml), the servlet alias (in web.xml) and the war and ear names (in the asant build.xml), redeploy and test the sample to confirm this.
Copyright © 2002 Sun Microsystems, Inc. All rights reserved.
Last Updated August 22, 2002