This application demonstrates how to use the Bluemix Cloudant NoSQL Database service. It helps users organize their favorite files. The UI talks to a RESTful JAX-RS CRUD backend API.
- Open the Bluemix dashboard, create/select your Cloudant service -> Service Credentials -> View Credentials
-
Copy the credentials to src/main/java/example/nosql/CloudantClientMgr.java
user = "REPLACE_WITH_CLOUDANT_USERNAME"; password = "REPLACE_WITH_CLOUDANT_PASSWORD";
-
Execute full Maven build to create the
target/JavaCloudantApp.warfile:$ mvn clean install
-
Download and start a local Liberty server with the application:
$ mvn liberty:run-server
Once the server is running, the application will be available under http://localhost:9080/JavaCloudantApp.
-
Update the application details in the
manifest.ymlfile. Change thenamefield to your Bluemix Application Name and change theservicesfield to your Cloudant service instance name. Connect and Login to Bluemix using the following commands:$ cf api https://api.ng.bluemix.net $ cf login -u username -o org_name -s space_name
(You can find the
org_name,space_nameon the Bluemix dashboard and replaceusernamewith themail-idassociated with the account)Use the following command to push the application to Bluemix:
$ cf push
IBM® Eclipse Tools for Bluemix® provides plug-ins that can be installed into an existing Eclipse environment to assist in integrating the developer's integrated development environment (IDE) with Bluemix.
-
Download and install IBM Eclipse Tools for Bluemix.
-
Import this sample into Eclipse using
File->Import->Maven->Existing Maven Projectsoption. -
Create a Liberty server definition:
- In the
Serversview right-click ->New->Server - Select
IBM->WebSphere Application Server Liberty - Choose
Install from an archive or a repository - Enter a destination path (/Users/username/liberty)
- Choose
WAS Liberty with Java EE 7 Web Profile - Continue the wizard with default options to Finish
- Open the Bluemix dashbaord create/select your Cloudant service -> Service Credentials -> View Credentials
-
Copy the credentials to src/example/nosql/CloudantClientMgr.java
user = "REPLACE_WITH_CLOUDANT_USERNAME"; password = "REPLACE_WITH_CLOUDANT_PASSWORD";
- Run your application locally on Liberty:
- Right click on the
JavaCloudantAppsample and selectRun As->Run on Serveroption - Find and select the localhost Liberty server and press
Finish - In a few seconds, your application should be running at http://localhost:9080/JavaHelloWorldApp/
- Create a Bluemix server definition:
- In the
Serversview, right-click ->New->Server - Select
IBM->IBM Bluemixand follow the steps in the wizard. - Enter your credentials and click
Next - Select your
organdspaceand clickFinish
- Run your application on Bluemix:
- Right click on the
JavaCloudantAppsample and selectRun As->Run on Serveroption - Find and select the
IBM Bluemixand pressFinish - A wizard will guide you with the deployment options.
- Select your Cloudant service on the Services step
- In a few minutes, your application should be running at the URL you chose.
Now you have your code running locally and on the cloud!
