Before You Begin
In this tutorial, you'll learn how to create a Java web application in Oracle Developer Cloud Service using a template, populate the repository, then deploy the application to Oracle Application Container Cloud Service.
Time to Complete
Approximately 25 minutes
Oracle Application Container Cloud Service provides a lightweight infrastructure so that you can run Java SE 7, Java SE 8, and Node.js applications in Oracle Cloud, and it can be integrated with other Oracle Services, such as Oracle Developer Cloud Service, to complement the development process.
Oracle Developer Cloud Service is a cloud-based software development Platform as a Service (PaaS) and a hosted environment for your application development infrastructure. It provides an open source standards-based solution to develop, collaborate, build, and deploy applications within Oracle Cloud.
You will create a project from an Oracle Developer Cloud Service template. The project contains the code for a deployable web application. To learn how to create the application used in this tutorial, see the OBE tutorial Creating a Web App with Bootstrap and Tomcat Embedded for Oracle Application Container Cloud Service. The application is a simple Java web application of employees that implements the CRUD (Create, Read, Update, and Delete) operations. The application uses Bootstrap to add User Interface styles, Tomcat as the embedded server, and Maven to compile and package the dependencies needed to run a standalone web application.
The project code contains two Maven scripts to compile and package the application:
pom.xmlfile, located in the project root directory. It contains all the dependencies to compile and run the application.
The Maven Assembly Plugin (
maven-assembly-plugin) allows users to aggregate the project output along with its dependencies, modules, site documentation, and other files into a single distributable archive,
pom.xmlfile is configured to execute an assembly descriptor,
distribution.xmlfile, located in the
src\assemblydirectory. It creates a zip file (
employees-app-1.0-SNAPSHOT-dist.zip) that contains the the
manifest.jsonfile. You deploy this ZIP file to Oracle Application Container Cloud Service. The
manifest.jsonfile contains additional environment configurations for Oracle Application Container Cloud Service.
You'll deploy the ZIP file, then clone the project locally, make a change to the code, commit the change to the Oracle Developer Cloud Service Git repository, and finally rebuild and redeploy the project.
What Do You Need?
Creating a Project and a Git Repository in Oracle Developer Cloud Service
Launch your Oracle Developer Cloud Service, following the instructions in "Accessing Oracle Developer Cloud Service Using the Web Interface" in Using Oracle Developer Cloud Service.
Provide your identity domain, user name, and password, and click Sign In. Then, from the Dashboard, click Developer, then click Open Service Console.
On the Welcome page, click New Project.
On the first page of the New Project dialog, enter a name for the project, such as
My Web Application. In the Description field, enter a description, such as
Web application. Select Private as the Security setting, then click Next.
On the Template page, select ACCS Java SE Sample with Deployment, and then click Next. (Your instance may have different templates.)
From the Wiki Markup drop-down menu, select MARKDOWN (the default), then click Finish.
Wait for provisioning to complete.
After provisioning completes, the project is fully provisioned. You are on the project's Home page, which displays the URLs of the Git and Maven repositories. The activity feed reports the creation of the project, the repository, and a README page, along with the creation of the repository from the template you selected.
Examining the Oracle Developer Cloud Service Project
From the project Home page, click the Code tab to view the newly created repository. The template has populated the repository with a web application named
employees-appand an explanatory README file. If you wish, click employees-app and open the application's subdirectories to view the application structure.
Click the Wiki tab, then click the link to the wiki page that provides more information.
The wiki page contains sections titled "Introduction," "Build and Package," "Deploy," and "Additional Resources."
Click the Build tab, then click employees-app-build to view the project's build job.
The build job is displayed. No builds have taken place yet. Click Configure to view the build configuration.
The Main tab displays the build job name, description, and JDK.
Click Source Control to view the Git repository settings for the build.
Click Build Steps to view the Maven goals and POM file for the project.
Click Post Build. The build artifacts will be archived. Finally, click the Cancel button.
The next tasks are to build the project and deploy it to Application Container Cloud Service.
Building your Application on Oracle Developer Cloud Service
In this section, you build the application, using the build job provided in the template, to generate the artifacts needed to deploy the application to Oracle Application Container Cloud Service.
In your Oracle Developer Cloud Service console, click the Build tab, and then click employees-app-build.
On the job page, click Build Now.
The build is queued.
Then the job is building.
Soon, the build is completed.
The artifacts are displayed: a zip file, a JAR file, and a WAR file. Expand the
targetnodes to see them.
Deploying the Application to Oracle Application Container Cloud Service
Click the Deploy tab, and then click New Configuration.
In the New Deployment Configuration page, enter values in the following fields, and then click Save and Deploy.
- Configuration Name:
- Application Name:
- Deployment Target: Select the identity domain of your Oracle Application Container Cloud Service (and accept the default ACCS properties). If an ACCS target is not in the list, click New, select Application Container Cloud, enter the values for your instance in the Deploy to Application Container Cloud dialog box, and click Test Connection. When the connection succeeds, click Use Connection.
- Type: On Demand
employees-app/target/employees-app-1.0-SNAPSHOT-dist.zip(the ZIP file, not the WAR file)
The deployment configuration appears on the Deployments page, with an indication that the creation succeeded. The deployment is running.
After some time, the deployment succeeds.
- Configuration Name:
The application name is now a link. Click the application name (employees-app) to execute the application. The application opens in a separate tab or window.
Now you can see your application running in Oracle Application Container Cloud Service.
Cloning the Project
Before you can make changes to the project code, you'll need to clone the project to create a local copy of the project code to work with.
Expand the Administration tab, then click the Repositories tab.
The Git repository URL is displayed in the Hosted Repositories area under the repository name. Select and copy the URL.
- On your local system, open a command window that provides access to Git commands, such as Git Bash. Change to the location where you want to clone the project.
git clonecommand, pasting the URL you copied as the argument. Your command line will have its own service URL and organization name. You'll be asked for your password.
$ git clone https://user-name@service-url/org-name/s/org-name_my-web-application_nnnnn/scm/employee-app.git Cloning into 'employee-app'... Password for 'https://user-name@service-url': remote: Counting objects: 51, done remote: Finding sources: 100% (51/51) remote: Getting sizes: 100% (48/48) remote: Total 51 (delta 2), reused 51 (delta 2) Unpacking objects: 100% (51/51), done. Checking connectivity... done. Checking out files: 100% (33/33), done.
Updating your Application
In this section, you make a change in your application, commit, push, build, and watch your updated code deployed to Oracle Application Container Cloud Service.
On your local system, open the file
employees-app\src\main\webapp\jsp\list-employees.jspin a text editor.
Change the title
<h2>My Employees Application</h2>and save the file.
In the Git Bash or terminal window, go to the
employee-appdirectory add the updated file into the Git repository index.
$ git add employees-app/src/main/webapp/jsp/list-employees.jsp
Commit the changes.
$ git commit -m "Title updated" [master 8db98d6] Title updated 1 file changed, 1 insertion(+), 1 deletion(-)
Push the changes to the Oracle Developer Cloud Service Git repository. You'll be asked for your password.
$ git push origin master Password for 'https://user-name@service-url': Counting objects: 15, done. Delta compression using up to 4 threads. Compressing objects: 100% (8/8), done. Writing objects: 100% (8/8), 694 bytes | 0 bytes/s, done. Total 8 (delta 3), reused 0 (delta 0) remote: Resolving deltas: 100% (3/3) remote: Updating references: 100% (1/1) To https://user-name@service-url/org-name/s/org-name_my-web-application/scm/employee-app.git 0bf504b..8db98d6 master -> master
In the Oracle Developer Cloud Service console, click the Code tab and verify that the change was pushed.
Click Build and select the employees-app-build job.
Click Build Now, and then wait for the build to complete.
Two builds now appear in the Build History table.
Click the Deploy tab, then click the icon, and then click Redeploy.
In the Redeploy employees-app dialog box, select 2 (Success) from the Build drop-down list, then click Deploy.
The notation "Deployment update in progress" is displayed in the deployment configuration while the deployment takes place. Eventually, you'll see an entry for the new deployment in the deployment history.
Click the employees-app link again to open the application.
Now you can see the new title.
Right-click the gear icon and select Stop to stop the application.
When you've finished, delete the deployment configuration, then delete the project.
Want to Learn More?
- Creating a Web App with Bootstrap and Tomcat Embedded for Oracle Application Container Cloud Service OBE
- Oracle Developer Cloud Service in the Oracle Help Center
- Using Oracle Developer Cloud Service in the Oracle Help Center
- Oracle Application Container Cloud Service in the Oracle Help Center
- Using Oracle Application Container Cloud Service in the Oracle Help Center