J Steven Perry | Published July 12, 2018
This unit is part of the “Intro to Java programming” learning path. Although the concepts discussed in the individual units are standalone in nature, the hands-on component builds as you progress through the units, and I recommend that you review the prerequisites, setup, and unit details before proceeding.
Browser-based business applications are now common — and it’s becoming increasingly convenient to deploy such apps in the cloud. No doubt you’re curious where Java programming fits into the cloud computing picture. This tutorial aims to satisfy that curiosity by showing how to deploy a web version of the HR app in the cloud using IBM Cloud and WebSphere Liberty — all without needing to leave the comfort of Eclipse. In this tutorial, you:
So far, you’ve only run the human resources (HR) application code on your own computer, from within Eclipse. But browser-based business applications are now common — and it’s becoming increasingly convenient to deploy such apps in the cloud. No doubt you’re curious where Java programming fits into the cloud computing picture. This unit aims to satisfy that curiosity by showing how to deploy a web version of the HR app in the cloud using IBM Cloud and WebSphere Liberty — all without needing to leave the comfort of Eclipse.
Java web programming rightly deserves its own specialized treatment, and you’ll get only a small taste here. To make it easy for you to follow along hands-on, I’ve made the source code for a web version of HR app available on GitHub. (You can find find Person, Employee, Manager in the project’s src/com/makotojava/intro/ folder.)
The steps that you perform follow a typical development cycle: Develop and test an app locally, push it to the cloud, modify and retest the app locally as needed, and redeploy it to the cloud.
If you don’t already have an IBM Cloud account, register now.
Next, pull the code from my GitHub project and import it into your Eclipse workspace. Then follow along with this video demo:
Good work! You’ve deployed your application to the cloud.
Of course, as software developers, we know that deployed applications must be maintained through bug fixes and enhancements. You’ll simulate that process now by making a small change to the HR app and then testing the change locally in your Liberty server before redeploying to the cloud.
In your Eclipse project, uncomment the following lines of code in the createEmployees() method in HumanResourcesApplication.java:
e = new Employee("Christine Johnson", 33, 160, 60, "BROWN", Gender.FEMALE, "424-45-9999", "0005", BigDecimal.valueOf(190000.0));
Now, test the change locally: Start your local Liberty server, bring up your browser, and verify that a new row that includes Christine Johnson is displayed in the app:
Now that you’ve tested the change locally, it’s time to push the modified app to the cloud, just as you would for a real-world application.
Stop your local Liberty server. Then follow the same deployment steps as before — except this time, all you need to do is specify the IBM Cloud server to deploy to (select the one you set up earlier, if it isn’t automatically selected). Then click OK.
You might notice quite a bit more output this time as IBM Cloud updates your application. After the app is deployed, you’ll see a message similar to this one (it might differ slightly):
[AUDIT ] CWWKF0011I: The server defaultServer is ready to run a smarter planet.
[INFO ] CWWKF0008I: Feature update completed in 23.875 seconds.
[Application Running Check] - Application appears to be running - javalearningpath.
Now, go to your browser and access the application at the Deployed URL and verify that your change is in the cloud version.
IBM Cloud is a powerful platform, and I’ve only scratched the surface of its capabilities in this tutorial. I encourage you to check out the resources under For further exploration to learn more about IBM Cloud.
Kudos! You’ve completed the “Intro to Java programming” learning path.
Get the Code »
May 28, 2019
May 10, 2019
Back to top