The Oracle Cloud is an enterprise cloud for business. The Oracle Cloud offers self-service business applications delivered on an integrated development and deployment platform with tools to rapidly extend and create new services. For more information about Oracle Cloud, see the Oracle Cloud homepage.
This document shows you how to register the Oracle Cloud with NetBeans IDE and some of the Oracle Cloud features that are supported in the IDE. This document discusses some of the advantages and disadvantages of working completely on the Cloud versus working with a local server and then deploying to the Cloud. At the end you create a simple web application, following the instructions in Introduction to Web Applications, and run it on Oracle Cloud.
You might also want to look at the Oracle Cloud Development with NetBeans and Eclipse (OEPE) series of tutorials on the Java Training Beat blog.
To follow this tutorial, you need the following software and resources.
|Software or Resource||Version Required|
|NetBeans IDE||7.2.1, 7.3, Java EE Version|
|Oracle Cloud plugin||available from NetBeans Update Center via NetBeans Plugins manager|
|Java Development Kit (JDK)||version 6 or version 7|
|Oracle Java Cloud Service||Sign up at the Oracle Cloud Public Availability homepage|
|Oracle Java Cloud Service SDK||Download from Oracle Cloud homepage.|
Oracle WebLogic server
Version indicated in chapter 4 of the Oracle Java Cloud Service Users Guide
This document is available from the Resources > Documentation tab within your activated Java Cloud service.
|OracleXE database server
(for developing and testing applications locally)
You need a local copy of the Oracle Java Cloud Service SDK to develop web applications on the Oracle Cloud. You can download the Oracle Java Cloud Service SDK from the Oracle Cloud homepage.
To download the Oracle Java Cloud Service SDK:
To enable support for the Oracle Java Cloud Service in the IDE you need to install the Oracle Cloud plugin from the NetBeans Update Center. You can use the NetBeans Plugins manager to install the Oracle Cloud plugin.
Perform the following steps to install the Oracle Cloud plugin.
When you click Install the IDE opens the NetBeans IDE Installer. You need to complete the steps in the installer wizard to install the plugin.
After you install the Oracle Cloud plugin the Add Cloud Provider wizard will display Oracle Cloud in the list of supported cloud providers.
You need to register the Oracle Cloud in the IDE's Services window before you can use it. Note that you need a separate installation of the Oracle Java Cloud Service SDK.
Note. To work with Oracle Cloud in NetBeans IDE you need to have an account on the Oracle Cloud.
To register Oracle Cloud in the IDE perform the following steps.
When you click Next the IDE tests the connection to the cloud. A list of Cloud services appears if the connection is successful. Only the Oracle Cloud Remote server (Oracle WebLogic) is currently available.
Note: After you register an Oracle Cloud provider, you can change the Cloud details in its Properties. Open Properties by right-clicking the Oracle Cloud node and selecting Properties.
Oracle Cloud is now listed under the Cloud node in the Services window. You can right-click the Oracle Cloud node to open a context menu that provides commands for refreshing the list of services, opening a list of jobs and logs, removing the cloud instance or viewing the cloud's properties.
When you register Oracle Cloud in the IDE an instance of the Oracle Cloud Remote server node also appears under the Servers node. (If it does not appear, right-click the Oracle Cloud node and select Refresh.)
You can expand the Oracle Cloud Remote node to view a list of the applications that are deployed to the remote server.
Every request that NetBeans IDE sends to the Oracle Cloud results in a job. Every job has a status (submitted, running, failed, complete) and may have one or more log files (whitelist check log, antivirus scan log, deployment log). You can view recent jobs and their logs with the View Jobs and Logs action.
Right-click the Oracle Cloud node and select View Jobs and Logs. In the editor window, a list appears of the last 50 jobs and logs. It takes a moment to load. The jobs list does not refresh automatically. Click Refresh to refresh the list.
Oracle Cloud Remote server is an instance of Oracle WebLogic running on Oracle Cloud. Expand the Oracle Cloud Remote node and see a list of applications running on that server. You can right-click an application to open a popup menu that contains commands for starting, stopping and undeploying the application. You can click View in the menu to open the application home page in a browser.
To update the list of deployed applications, right-click the Oracle Cloud Remote node and select Refresh.
We recommend developing the application on a local machine and deploying it to the Cloud periodically. While it is possible to develop a web application entirely on the Oracle Cloud, local development is preferrable for the following reasons:
Risks also exist in developing locally and deploying to the Oracle Cloud, however. The application you develop locally may not run on the Oracle Cloud Remote server. For safety, develop locally on an Oracle WebLogic server 11g, which is the same server as Oracle Cloud Remote.
You must manually change the web application's server between your local server and the Oracle Cloud server. There is no automatic way to develop locally and deploy to the Cloud periodically.
To change a web application's server between local and Oracle Cloud:
Go to Introduction to Developing Web Applications and complete that tutorial. Develop the web application on a local Oracle WebLogic server. After the application is complete, change the server to Oracle Cloud Remote and run the application.
Note. You need to install Oracle WebLogic Server locally and register the server with the IDE. See Video of Deploying a Web Application to Oracle WebLogic Server for more information.
Before you deploy the application to the Oracle Cloud Remote server, open the Output window (Window > Output > Output or Ctrl-4). Note the Oracle Cloud Remote Deployment tab in the output window. This tab shows you the progress of the deployment.
NetBeans IDE and Oracle Cloud can be used in use cases where you have an Oracle database backend that is managed through a web application hosted by Oracle WebLogic server. NetBeans IDE enables you to create entity classes for an existing Oracle database and create JavaServer Faces (JSF) pages for the resulting entity classes. This scenario requires on-premise installations of OracleXE database server and Oracle WebLogic application server.
Important: The Oracle Cloud Remote WebLogic server does not support JPA 2.0. If your on-premises WebLogic server is JPA 2.0-enabled, either disable JPA 2.0 or use a JPA 1.0 persistence provider for CRUD applications.
Note: This document gives only brief directions for creating entity classes and JSF pages. For a more detailed treatment, see Generating a JavaServer Faces 2.0 CRUD Application from a Database.
To create a CRUD Application with JSF:
Use the HR username and password when you register the HR schema with NetBeans IDE.
You now have a local version of a Java web application using CRUD and JSF. You can test and tweak the application locally. When the application is in a final state, deploy it to Oracle Cloud.
Deploying the CRUD/JSF Application to Oracle Cloud
persistence.xml. The file opens in the XML Editor's Design view.
Note: If your on-premises WebLogic server is not JPA 2.0-enabled, EclipseLink falls back to JPA 1.0. In this case you do not need to change persistence providers.
Caution: Oracle Cloud does not yet support the uploading of database tables. Therefore no data is available for your application when it is on Oracle Cloud.
Oracle Cloud does not support some standard Java API methods, such as System.exit(). The Oracle Cloud whitelist defines all methods that are allowed. During deployment of an application to Oracle Cloud, the Cloud server tests whitelist compliance. If the whitelist is violated, the Cloud server refuses to deploy the application.
NetBeans IDE helps prevent whitelist-related errors by notifying you of whitelist violations while you code. Code completion is limited by whitelisting, and whitelist violations are highlighted in the code. Run the Verify action on a web application deployed to Oracle Cloud Remote server, and the Output window shows you any whitelisting violations.
To test whitelisting:
Tip: Turn on Group Action Items by Category (bottom button on left) to see whitelist violations more easily.
In the Projects window, right-click the application's node and select Properties. The application's Project Properties open. Select the Whitelists category. A list of active whitelists appears. In this dialog you can disable the whitelist.
When a web application's server is set to Oracle Cloud Remote, the Oracle Cloud whitelist applies both to that project and any of that project's subprojects. For example, an Enterprise application set to run on Oracle Cloud Remote has the Oracle Cloud whitelist apply to the Enterprise application itself and any EJB modules or web applications that are part of the Enterprise application. Both the project and its subprojects have a Whitelist category in their Project Properties. You can use the Project Properties dialog to set whitelists separately for the project and its individual subprojects.
For information about Oracle Cloud services, see the following resources:
For related information about developing web applications in NetBeans IDE, see the following resources: