Oracle by Example brandingDeploying an Application to an Oracle Java Cloud Service Instance by Using the Eclipse IDE

section 0Before You Begin

This tutorial covers how to use the Eclipse Integrated Development Environment (IDE) to deploy a Java EE application to Oracle Java Cloud Service. You would need about 30 minutes to complete this tutorial.

Last Updated

May 2017

Note that Oracle develops cloud services in an agile manner and makes rapid changes to meet our users' needs. This tutorial may not reflect all of the changes since the last update to this service. For the latest information, see:

Background

Eclipse is an open-source IDE that provides a source code editor, build automation tools, debugger, compiler, and interpreter, as well as other features. Developers creating applications using Eclipse on their local machine may want to deploy their applications to the cloud. This tutorial describes a straightforward way to deploy a Java EE application to an Oracle Java Cloud Service instance.

What Do You Need?

A web browser is required for working with Oracle Cloud services. These are the minimum requirements:

  • Microsoft Internet Explorer 9 or 10 with Browser Mode and Document Mode set to IE9 or IE10
  • Google Chrome 29 and later
  • Mozilla Firefox 24 and later
  • Apple Safari 6 and later

Before starting this tutorial:

  • Create an Oracle Java Cloud Service instance that includes a load balancer. For more information, see the Creating a Custom Oracle Java Cloud Service Instance tutorial.
  • Have a Java Web application, archived as an Application ARchive (WAR) file. For the purposes of this tutorial, you can download the sample benefits.war application. Right-click benefits.war, select Save Link As (or whatever your browser prompts for saving the target of a link), and save it on your local computer.
  • If you have not done so already, install the Oracle Enterprise Pack for Eclipse (OEPE), which you can dowload from http://www.oracle.com/technetwork/developer-tools/eclipse/downloads/index.html.

section 1Connect Eclipse to the Remote WebLogic Server

To deploy an application, you must first establish a connection between Eclipse and the Oracle WebLogic Server.

  1. Start Oracle Enterprise Pack for Eclipse (OEPE).

    You can either click the desktop icon or search for eclipse on the Windows Start menu.

  2. Click Workbench.

    The Workbench is displayed.

  3. Select Window > Show View > Other...
    Select Others from the Windows menu
    Description of this image
  4. Type server in the search box, select the Servers entry, and click OK.
    Search for Servers in the Show View dialog
    Description of this image

    The Servers view panel is displayed in the bottom half of the Workbench.

  5. Click No servers are available. Click this link to create a new server...
  6. Servers tab
    Description of this image
  7. Click Oracle, and then select the Oracle WebLogic Server version you are using.
    Select the server type
    Description of this image

    You chose the version number when you created your Oracle Java Cloud Service instance, for example, Oracle WebLogic Server 12c (12.1.3) and click Next.

  8. On the New Server dialog, click the browse icon next to WebLogic home and select the WebLogic Server home directory on your local machine.
  9. Do the same for Java home and click Next.
    Specify WebLogic home and Java home directories.
    Description of this image
  10. Select Remote.
    • Set the Remote Host to the address of your cloud server.
    • Set Port to 7001.
    • Set SSL Port to 7002
    • Select the Use SSL port checkbox.
    • Set User as the WebLogic administrator username you specified when you created the Oracle Java Cloud Service instance.
    • Type the WebLogic administration password you specified when you created the Oracle Java Cloud Service instance.
      Defining a WebLogic server
      Description of this image
  11. Click Test Connection.

    A Success dialog opens, informing you that the test connection succeeded.

    Test success dialog
    Description of image
  12. In the Success dialog, click OK, then click Finish.

    On the Eclipse Workbench, a new connection is added to the Servers view panel. A Validating server... status message is displayed.

    After the connection is established, the status changes to Started.

    Server has started
    Description of this image

section 2Deploy the Application to a Cluster

You can deploy an application to a cluster by setting properties to add the cluster as a target.

  1. If the Project Explorer view is not visible, select Window > Show View > Project Explorer.
    Open Project Explorer
    Description of this image
  2. Under Project Explorer, right-click Import > WAR file.
    Import WAR file
    Description of this image
  3. On the WAR Import dialog, click Browse. Navigate to the directory where your application resides, select it, and click Open.
    Browse for WAR file
    Description of this image

    In this tutorial, the benefits.war file is used.

  4. On the WAR Import dialog, click Finish.
  5. If an Open Associated Perspective dialog appears, click Yes to associate the perspective of this project to Java Enterprise Edition (Java EE).
    Open Associated Perspective dialog
    Description of this image
  6. On the Eclipse console, select the Servers tab.
    Servers tab
    Description of this image

    By default, Eclipse deploys your application to the Oracle Java Cloud Service Administration Server. We do not want to deploy the application to the Administration Server. We want to deploy the application to the cluster.

  7. Right click the server connection we established previously to the administration server.
    Select the connection to admin server
    Description of this image
  8. Select Properties.

    The Properties dialog is displayed.

    Properties dialog
    Description of this image
  9. Select WebLogic > Publishing > Advanced.
    Under WebLogic, select Advanced
    Description of this image
  10. To delete the administration server as a target, select the target name and click the red cross next to the administration server name.
    Admin server name selected
    Description of this image
  11. To add the cluster as the target, click the green plus sign.
    Add the cluster as a target
    Description of image

    A new line is added under Targets.

  12. Click Browse and select the cluster where you want to deploy the application.
    Cluster listed in the Target Name dialog
    Description of this image

    The administration server and the cluster are listed in the Target Name dialog.

  13. Click the cluster, and then click OK.
  14. Click Apply, and then click OK.
    Click Apply
    Description of this image
  15. Click the Servers tab.
  16. Right click the server connection, and then select Add and Remove....
    The benefits application is available
    Description of this image

    The name of your application (in this tutorial, benefits) appears as an available application in the Add and Remove dialog.

  17. Select benefits and click the Add button.
    Adding benefits application
    Description of this image
  18. Click Finish.

    In the bottom-right corner of the Eclipse console, the status of the publish request is displayed.

  19. Click the icon next to the public request status message to see the details of the request.
    Request details
    Description of this image

    The status of the request will become Active.

    On the Servers tab, you will see how the new application is deployed.

    Request details
    Description of this image

section 3Verify the Application Deployment

After the application is deployed, you can verify that the deployment was successful. Because you deployed the application on the cluster, you will verify it using the IP address of the load balancer configured for your Oracle Java Cloud Service instance.

  1. On the Oracle Java Cloud Service Console, click the name of your Oracle Java Cloud Service instance.
    Oracle Java Cloud Service instance
    Description of this image

    The Oracle Java Cloud Service Instance Overview page is displayed.

    Load balancer IP address
    Description of this image
  2. Copy the Public IP address of the load balancer.
  3. Open a browser and enter the following address:
    https://IP_of_load_balancer:443/benefits

    Port 443 is the default HTTPS access port for applications when a load balancer is present.

  4. Verify that you see the benefits application.
    The benefits application
    Description of this image

You have successfully deployed the benefits application by using Eclipse.


section 4Undeploy an Application

If you no longer need to use the application you deployed, you can undeploy it by using Eclipse.

  1. If you have not already done so, start Oracle Enterprise Pack for Eclipse (OEPE).

    You can click the icon on your desktop or search for eclipse on the Windows Start menu.

  2. Select the Servers tab of the Eclipse console.
    Servers tab
    Description of this image
  3. Expand the server connection for the cluster on which the application is deployed.
    Expanded cluster
    Description of this image
  4. Locate the application under Published Modules.
    Locating benefits application
    Description of this image
  5. Right click the application and select Remove.
    Select Remove
    Description of this image

    The application is removed from the public modules list.

    Benefits application removed
    Description of this image

The application is now undeployed.


more informationWant to Learn More?