Before 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-clickbenefits.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
.
Connect
Eclipse to the Remote WebLogic Server
To deploy an application, you must first establish a connection between Eclipse and the Oracle WebLogic Server.
- Start Oracle Enterprise Pack for Eclipse (OEPE).
You can either click the desktop icon or search for eclipse on the Windows Start menu.
- Click Workbench.
The Workbench is displayed.
- Select Window > Show View > Other...
Description of this image - Type
server
in the search box, select the Servers entry, and click OK.Description of this image The Servers view panel is displayed in the bottom half of the Workbench.
- Click No servers are available. Click this link to create a new server...
- Click Oracle, and then select the Oracle
WebLogic Server version you are using.
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.
- On the New Server dialog, click the browse icon next to WebLogic home and select the WebLogic Server home directory on your local machine.
- Do the same for Java home and click Next.
Description of this image - 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.
Description of this image - Click Test Connection.
A Success dialog opens, informing you that the test connection succeeded.
Description of image - 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.
Description of this image
![Servers tab](img/connect04a.jpg)
Deploy
the Application to a Cluster
You can deploy an application to a cluster by setting properties to add the cluster as a target.
- If the Project Explorer view is not visible, select Window
> Show View > Project Explorer.
Description of this image - Under Project Explorer, right-click Import >
WAR file.
Description of this image - On the WAR Import dialog, click Browse.
Navigate to the directory where your application resides,
select it, and click Open.
Description of this image In this tutorial, the
benefits.war
file is used. - On the WAR Import dialog, click Finish.
- If an Open Associated Perspective dialog appears, click Yes
to associate the perspective of this project to Java
Enterprise Edition (Java EE).
Description of this image - On the Eclipse console, select the 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.
- Right click the server connection we established previously
to the administration server.
- Select Properties.
The Properties dialog is displayed.
Description of this image - Select WebLogic > Publishing > Advanced.
Description of this image - To delete the administration server as a target, select the
target name and click the red cross next to the administration
server name.
Description of this image - To add the cluster as the target, click the green plus
sign.
Description of image A new line is added under Targets.
- Click Browse and select the cluster where
you want to deploy the application.
Description of this image The administration server and the cluster are listed in the Target Name dialog.
- Click the cluster, and then click OK.
- Click Apply, and then click OK.
Description of this image - Click the Servers tab.
- Right click the server connection, and then select Add
and Remove....
Description of this image The name of your application (in this tutorial,
benefits
) appears as an available application in the Add and Remove dialog. - Select benefits and click the Add
button.
Description of this image - Click Finish.
In the bottom-right corner of the Eclipse console, the status of the publish request is displayed.
- Click the icon next to the public request status message to
see the details of the request.
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.
Description of this image
Verify
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.
- On the Oracle Java Cloud Service Console, click the name of
your Oracle Java Cloud Service instance.
Description of this image The Oracle Java Cloud Service Instance Overview page is displayed.
Description of this image - Copy the Public IP address of the load balancer.
- 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. - Verify that you see the
benefits
application.Description of this image
You have successfully deployed the benefits
application by using Eclipse.
Undeploy
an Application
If you no longer need to use the application you deployed, you can undeploy it by using Eclipse.
- 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.
- Select the Servers tab of the Eclipse
console.
Description of this image - Expand the server connection for the cluster on which the
application is deployed.
Description of this image - Locate the application under Published Modules.
Description of this image - Right click the application and select Remove.
Description of this image The application is removed from the public modules list.
Description of this image
The application is now undeployed.