Your next step after having defined the JDBC[tm] connection pool and resource entries required by the application is to deploy the application. Although a prebuilt copy of the sample application's EAR file is included as part of the sample, you will use the Ant facility and the sample's build.xml file to quickly compile the application source code and reassemble the EAR file from scratch. You will then deploy this newly built EAR file to the application server and exercise the application.
1. Compile and Reassemble the ApplicationIf you are either sharing your application server installation with other users or your system user ID does not have write permissions to the area in which the application server is installed, you should make a copy of the sample applications in your own directory before proceeding with this section. If you are using the application server that was installed as part of a Solaris 9 installation, it is recommended that you make your own copy of the the samples. If you are not sharing the application server installation with other users, proceed to Compiling and Reassembling the Application. Making Your Own Copy of the Samples Copy the following directory to a location in which your user ID has write permissions:
To use the Ant build facility with the sample in this guide, you must ensure that the com.sun.aas.installRoot property in the following file is set to the installation path of the application server:
The com.sun.aas.installRoot property is set automatically when the application server is installed except in the case when the application server is installed as part of a Solaris 9 installation. In the case of copying the samples from /usr/appserver/samples in a Solaris 9 environment, you need to edit the common.properties file to reflect the following:
Although customization of this property is sufficient to use Ant to the extent that is demonstrated in this guide, to work with the full capabilities of Ant and the sample applications, you will need to customize additional properties in the common.properties file. After you complete the Getting Started Guide, refer to the Creating Your Own Sample Environment section of the sample application documentation for details on customizing the other properties found in the common.properties file. As you proceed with this guide, replace <install_dir>/samples/ with the location of your own copy of the sample applications. Compiling and Reassembling the Application 1. Ensure that your environment is configured to include the application server's bin/ directory. This step was addressed in the section Setting Up Your Environment. 2. Using the command line, navigate to the source directory of the jdbc-simple sample application:
3. From the command line, execute the Ant wrapper script named asant(.bat) without any arguments to compile the Java source files and assemble the J2EE[tm] WAR, EJB JAR and EAR files:
4. Verify that the EAR file has been created by looking for a file named jdbc-simple.ear located in the following directory:
You should see a file named jdbc-simple.ear
in this directory. Now that you have successfully compiled and assembled the application from scratch, you can use the administrative console to deploy the application. 2. Deploy the Application1. In the administrative console, select and expand the Applications node under the application server instance "server1". 2. Select the folder Enterprise Apps. 3. Click the Deploy... button. 4. Click the Browse... button to bring up the file browser. 5. Navigate to the following directory and select the jdbc-simple.ear file that you just assembled.
6. Click Open to select file. 7. Click OK to proceed to the next step. 8. Before clicking OK to deploy the application, note the Run Verifier and Precompile JSPs check boxes. These options enable you to run a J2EE[tm] application verifier as part of the deployment process. (The verifier can also be access through execution of "asant verify" in the sample applications). The Precompile JPS option enables you to have the JSPs files compiled during the deployment process. Although the deployment process will be longer due to the JSP compilation step, the first access to your JSPs will be much faster. Click OK to deploy the application. 9. Once the deployment process completes, the following page is displayed:
10. Make the application server instance aware of the newly deployed application by applying the changes. 10a. Select the "server1" node. 10b. Click the Apply Changes button. Note that a server instance restart is not required in this case.
Now that the application is
deployed, you are ready to ensure that you are monitoring the application
server log file prior to running the application. 3. Prepare to Monitor the ApplicationBefore running the sample, you should prepare to view the output generated by both the sample as well as by the application server runtime. Since by default application output to stdout and stderr is redirected to the application server's event log, the application server provides you with a single place to monitor both the execution of both your server side application and application server infrastructure.
Viewing Application Output and Logs on UNIX Developers typically use the "tail -f" command to monitor log files on UNIX.
Proceed to Using the Administrative Console to View Event Logs. Viewing Application Output and Logs on Windows While you are testing applications on an application server instance, you will likely find it useful to monitor server event log information on the Windows desktop. Such information can include your application's output to stdout and stderr, exceptions and server event messages. As you observed in the previous section, display of application server instance event log information on the desktop is enabled by default. If you would like to disable display of event log data on the desktop, you can use the administrative console to make this change. The Create Console setting under the Logging->General area of an application server instance enables you to control whether or not the application server log content for that instance is displayed in a command window on the desktop. Using the Administrative Console to View Logs You can also use the administrative console to view server instance log files.
You can refresh the log view by clicking on the OK button. If you would like to see more than 25 log entries, simply enter a larger number in the "Number of errors to view?" area and click OK to refresh the log display. Try a value of 200 or so to see more log entries.
Now that you are ready to monitor the server log file, the next step
is to start the database prior to running the application. 4. Run the ApplicationTo run the sample application, perform the following steps: 1. First ensure that you are monitoring the server event log file for application output. 2. From a browser, access the following URL, enter your name, and click on Process.
As you click the Process button, note the application output written to the server event log file. Also note that there is a discernible delay while the application server compiles the initial JSP source file for the first time.
3. Once the greeting is displayed, click the link provided to view a log of all greetings generated to date. Again, there will be a delay as the second JSP source file is compiled. 4. Run the sample again to see how quickly it responds the second time through. Since the JSP files are already compiled, the second invocation is much faster than the initial run. Troubleshooting The most common problems when attempting to run this sample application are:
When troubleshooting problems, it is very important that you monitor the application server log file. You may also find it useful to review the HTTP access log file to verify that HTTP requests are arriving at the application server as expected. Proceed to Modifying the Sample Application to learn how the application server supports dynamic redeployment and reloading. |
|||||||||||||||||||||||||||||||||||||||||||||||