July 7, 2016 | Written by: Bobby Woolf
Categorized: Compute Services | How-tos
Share this post:
WebSphere Liberty is the next generation application server. Liberty and Eclipse make a great local development environment for developing and deploying Java EE applications to Bluemix, especially to the Liberty for Java instant runtime. Now that we have connected Eclipse to Bluemix, we can use Eclipse to push a packaged server to Bluemix.
In this excerpt from “Java EE, the next inception: Install a local Java EE development environment for Bluemix,” we’ll explore how to push a packaged Liberty server to Bluemix using Eclipse, which enables us to deploy a Liberty application and its server configuration. And with that, we will have reached the end of this series.
To start at the beginning of this series, see WebSphere Liberty: Developing Java EE applications for the cloud.
Pushing a packaged server to Bluemix
When you push an application to Bluemix, you only upload the archive file for an application. For a Java application, this is a WAR or EAR file. When you push a server to Bluemix, you not only upload the Java application’s archive file, you also upload the server configuration. This way, settings you configured in your local Liberty server will also be set in the Liberty for Java server in Bluemix.
Before packaging a server, remove any unneeded features from the feature manager’s list of enabled features to make it as compact as possible.
A server can be pushed using the command line or by using the Eclipse Tools for Bluemix. Either way, you need to specify where to deploy the application and the options for deploying the application.
Eclipse tools: Bluemix
One of the tasks listed earlier that can be performed with the Bluemix tools is pushing a packaged server to Bluemix
To push a server using the Eclipse Tools for Bluemix, you don’t even need to package the server first. Packaging the server and pushing it to Bluemix is all one task. To do this:
- Go to the Servers view by selecting Window > Show View > Servers.
- Select the server you want to package and deploy.
- Expand the server’s tree view to see the Eclipse projects associated with the server. These are the applications that will be packaged with the server, so remove any you don’t want to include. (Typically, you want to include just one application.)
- With the server selected, select Utilities > Package Server to IBM Bluemix.
- In the Bluemix Server dialog, specify the Bluemix server to which you want to deploy the application (Figure 1) and press OK.
Figure 1. Deploy packaged server
If you do not already have a Bluemix server defined in Eclipse, you need to link Eclipse to one of your spaces in your Bluemix organization.
When Eclipse deploys the application to Bluemix, it begins by opening the Application Deployment Options wizard, which enables you to specify the application deployment options for deploying this application. Figure 2 shows the first page of the wizard.
Figure 2. Application details
If the application has a manifest file, the wizard uses those values as its defaults. Select Save to manifest file to save your settings for future deployments.
Once you complete the wizard and press Finish, the Console view in Eclipse shows the log as the application is pushed to Bluemix, a runtime is created, and the runtime is bound to its services. If any failures occur during the push process, they’ll be logged and shown in the console. Once the push completes successfully, you can navigate in the Bluemix dashboard to the target organization and space, and you’ll see your application listed.
You have now used the Bluemix Tools in Eclipse to deploy an application by pushing it to Bluemix.