Oracle WebLogic Server 12c: Deploying and Undeploying Applications
This tutorial shows you how to use the Oracle WebLogic Server 12c administration console to deploy a Java Platform, Enterprise Edition (Java EE) web application.
Time to Complete
Approximately 20 minutes
A Java web application, like any Java EE application, can be deployed to an application server as an archive file. Web application archives use the .war file extension.
This tutorial covers using the Oracle WebLogic Server 12c (12.1.3) administration console to deploy a simple Java EE web application. You learn how to start and run the application, redeploy an updated version of the application, and undeploy the application.
Hardware and Software Requirements
- Oracle Linux 5.6+
- Oracle WebLogic Server 12c (12.1.3)
Before starting this tutorial, you should have completed the Oracle by Example tutorials titled:
- Oracle WebLogic Server 12c: Installing WebLogic Server and Creating a Domain
- Oracle WebLogic Server 12c: Configuring Managed Servers.
Deploying and Starting an Application
To deploy a Java web application and start it by using the administration console, perform the following steps:
1. Download the benefits.war file to the machine where your domain's administration server is located. This is a sample Java web application archive to deploy.
2. If the administration server of the domain is not already running, start it.
- Open a Terminal window and navigate to the domain directory. In this tutorial, the domain directory is/scratch/domains/mydomain.
- In the domain directory, enter the following command:
- At the prompt, enter the administrator username and password that you entered when you created the domain.
- In this tutorial, the username isweblogicand the password isWelcome1.
- Note:The password is not displayed.
3. If the server1 managed server is not already running, start it.
- Open a Terminal window and navigate to thebindirectory under your domain directory. In this tutorial, the domain directory is/scratch/domains/mydomain.
- In thebindirectory, enter the following command:startManagedWebLogic.sh. This command takes two arguments:
- The name of the managed server you want to start
- The URL of the administration server
- In this tutorial, those arguments are:
- $>cd /scratch/domains/mydomain/bin
- $>./startManagedWebLogic server3 http://<ip_address> :7001
- Note:Replace<ip_address>with the host name or IP address of your administration server.
4. At the prompt, enter the administrator username and password.
Note:The password is not displayed.
5. After both servers are up and running, access the WebLogic Server administration console.
- Open a web browser and enter the URL:http://hostname:port/console.
- In this tutorial, that ishttp://<ip_address>:7001/console.
- Note:Use your administration server machine's host name or IP address for<ip_address>. Also, if you used a different port number for the administration server, use that port instead.
- On the Welcome screen, log in by using the username and password that you entered to start the administration server.
6. Deploying an application is a change to the domain's configuration, so you must first lock it. In the Change Center, clickLock & Edit.
7. Under Domain Structure, clickDeployments.
8. On the right, above the Deployments table, clickInstall.
9. Locate the downloaded archive file.
- To the right of Current Location, click the links to browse to the location where you placed the downloaded benefits.war file. In this tutorial, the file is in the /scratch/apps directory.
- Select thebenefits.waroption that is displayed after you click the link and locate thebenefits.warfile. The console fills in the Path field for you. Alternatively, you can manually enter the path and the file name in the Path field.
10. On the next screen, ensure thatInstall this deployment as an applicationis selected, and then clickNext.
11. On the targets screen, selectserver1, and then clickNext.
12. On the next screen, keep all the default values and clickNext.
13. On the review screen, selectNo, I will review the configuration later, and then clickFinish.
Messages indicate that the deployment was installed, but changes must be activated. Thebenefitsapplication is listed in the Deployments table.
14. To activate the changes, clickActivate Changesin the Change Center.
15. In the Deployments table, select the check box to the left of the benefits application, and then select "Servicing all requests" in the Start list.
16. ClickYesto continue.
A message indicates that a start request was sent. Momentarily, the state of the benefits application becomes "Active." This means that the application is available to those who have access to the server.
Testing the Application
To test the newly deployed web application, perform the following steps:
1. In another web browser window or tab, enter the host and port for the server1 managed server, followed by/benefits.
In this tutorial, the URL ishttp://<ip_address>:7003/benefits.
Note:Replace<ip_address>with the host name or IP address of the server1 machine.
2. Select one or more of the benefit check boxes, and then clickGet Information.
3. Click theBack To Home Pagelink.
Updating the Application
To update the deployed web application with a new version, perform the following steps:
1. Download an updated version of the web application, the benefits2.war file.
2. Delete the current benefits.war file, change the name of benefits2.war to benefits.war, and then move the new version of benefits.war to the same directory where you just deleted the old version.
3. Updating an application is a change to the domain's configuration, so you must first lock it. In the Change Center, clickLock & Edit.
4. On the Deployments page in the administration console, select the check box to the left of thebenefitsapplication in the Deployments table, and then clickUpdate.
5. On the next screen, clickFinish.
6. In the Change Center, clickActivate Changes.
Note:After the changes are activated, the State of the benefits application is "Active." You do not have to manually start an updated application.
7. In another web browser window or tab, enter the host and port for the server1 managed server, followed by/benefits.
The application was updated. The title now includes the word "NEW." Also, if you select some of the check boxes and click theGet Informationbutton, you might notice that some of the benefit providers also change. If you do not see "NEW" on the benefits home page, perhaps the web browser cached pages. In that case, click the web browser'sRefreshbutton.
Undeploying the Application
Undeploying an application means stopping it and then removing it from the configuration of the server or servers on which it was deployed. You do not have to remove the application archive file.
To undeploy the web application, perform the following steps:
1. On the Deployments page of the administration console, select the check box to the left of thebenefitsapplication in the Deployments table, and then selectForce Stop Nowin theStoplist.
2. ClickYesto continue.
The benefits application is stopped and is no longer available. When you enter its URL in a web browser, the server returns a404error.
Note:The web browser may have cached pages. If the benefits application does appear, click the web browser'sRefreshbutton.
3. Return to the administration console and clickLock & Editin the Change Center.
4. On the Deployments page, select the check box to the left of thebenefitsapplication in the Deployments table, and then clickDelete.
5. ClickYesto continue.
6. Messages indicate that the deployment was deleted, but the changes must be activated. In the Change Center, clickActivate Changes.
Thebenefitsapplication is no longer listed in the Deployments table.
In this tutorial, you learned how to perform the following actions in the WebLogic Server administration console:
- Deploy a Java EE web application to an instance of WebLogic Server
- Start and run a web application
- Update a web application to a new version
- Undeploy a web application
- For documentation on Oracle WebLogic Server 12c (12.1.3), visit the Oracle WebLogic Server Documentation Library.
- For more information on deployment, see the Deploying Applications to Oracle WebLogic Server document.
- To learn more about Oracle WebLogic Server, refer to additional OBEs in the Oracle Learning Library.
- Lead Curriculum Developer: Bill Bell
- Original Oracle by Example tutorial for version 11g created by: TJ Palazzolo
- Editor: Susan Moxley
Permalink: | E
• OBE นี้ไม่ยาก.