Skip navigation

We will look at


  • How to Setup Apache Cassandra on Oracle Compute Cloud
  • Develop: some implementation details
  • Deploy: Run it on Oracle Application Container Cloud using CI/CD feature in Oracle Developer Cloud
  • Secure access: secure channel b/w your application and Cassandra




Hello Cassandra

Apache Cassandra is an open source,  NoSQL database. It's written in Java, (originally) developed at Facebook and it's design is based on/inspired by Amazon's Dynamo and Google’s Bigtable. Some of its salient characteristics are as follows


  • Belongs to the Row-oriented family (of NoSQL databases)
  • Distributed, decentralized & elastically scalable
  • Highly available & fault-tolerant
  • Supports Tunable consistency


You can read more about Cassandra here

About the sample application

  • The sample application exposes REST endpoints - implemented using Jersey (JAX-RS)
  • Employee - serves as the domain object. You would need to bootstrap the required table
  • DataStax Java driver is used to interact with Cassandra
    • Leverages Cassandra object mapper for CRUD operations


It is available here


Locking down access to Cassandra

The goal is to allow exclusive access to Cassandra from our application without exposing it's port (e.g. 9042) to the public internet. To enable this, Oracle Application Container Cloud ensures that when you deploy an application, a Security IP list is automatically generated which can be added to a Security rule for a virtual machine (VM) in Oracle Compute Cloud Service. This allows your application and the VM to communicate.


The setup details are discussed in an upcoming section


Setup Cassandra on Oracle Compute Cloud


Quick start using Bitnami

We will use a pre-configured Cassandra image from Bitnami via the Oracle Cloud Marketplace


  • Login to your Oracle Compute Cloud dashboard,
  • choose the Create Instance wizard, and then
  • select the required machine image from the Marketplace tab


More details here





Activate SSH access

We now need to allow SSH connections to our Cassandra virtual machine on Oracle Compute cloud


Create a Security Rule



You should see it in the list once its done



SSH into the VM



Reset password

You will need to reset Cassandra password as per this documentation Once you're done, log in using the new credentials



Oracle Developer Cloud: setup & application deployment


You would need to configure Developer Cloud for the Continuous Build as well as Deployment process. You can refer to previous blogs for the same (some of the details specific to this example will be highlighted here)




Provide Oracle Application Container Cloud (configuration) descriptor




Check application details on Oracle Application Container Cloud


Deployed Application



Environment Variables



Check Security IP List


After successful deployment, you will be able to see the application as well the Security IP List information in Oracle Application Container Cloud



Please note that you will not be able to access/test the application now since the secure communication channel b/w your application and Cassandra is not setup. The next section covers the details


Oracle Compute Cloud security configurations


Confirm Security IP List


You will see the Security IP list created when you had deployed the application on Oracle Application Container cloud (mentioned above). It ensures that the IP of the application deployed on Oracle Application Container cloud is whitelisted for accessing our Cassandra VM on Oracle Compute Cloud




Create Security Application


This represents the component you are protecting along with its access type and port number - in this case its TCP and 9042 respectively


Create Security Rule


The default Security list is created by Oracle Compute Cloud (after the Bitnami image was provisioned)


We will create a Security Rule to make use of Security IP list, Security application and Security List



You should see it in the list of rules



Test the application


Bootstrap the keyspace and table


The sample application uses the test keyspace and a table named employee - you would need to create these entities in the Cassandra instance


   'class' : 'SimpleStrategy', 
   'replication_factor' : 1 
 CREATE TABLE test.employee (emp_id uuid PRIMARY KEY, name text);


Access REST endpoints


Create a few employees


curl -X POST <ACCS_APP_URL>/employees -d abhishek // 'abhishek' is the name
curl -X POST <ACCS_APP_URL>/employees -d john // 'john' is the name


  • You will receive HTTP 201 (Created) in response
  • The Location (response) header will have the (REST) co-ordinates (URI) for the newly created employee record - use this for search (next step)


Search for the new employee


curl -X GET <ACCS_APP_URL>/employees/<emp_id>


You will receive a XML payload with employee ID and name


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>


Search for all employees


curl -X GET <ACCS_APP_URL>/employees/


You will receive a XML payload with employees info


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>


Test the CI/CD flow

Make some code changes and push them to the Developer Cloud service Git repo. This should

  • Automatically trigger the build, which once successful will
  • Automatically trigger the deployment process, and
  • Redeploy the new application version to Application Container Cloud



**The views expressed in this post are my own and do not necessarily reflect the views of Oracle.

Glassfish 5 Build 11 is now available - with support for many of the Java EE 8 specifications e.g. JAX-RS 2.1, JPA 2.2, JSON-B 1.0 etc. For more details check out the Aquarium space. This blog covers






It's a simple one


  • Has a REST endpoint (also a @Stateless bean)
  • Interacts with an embedded (Derby) DB using JPA - we use the jdbc/__TimerPool present in Glassfish to make things easier
  • Test data is bootstrapped using standard JPA features in persistence.xml (drop + create DB along with a SQL source)


JSON-B 1.0 in action


Primarily makes use of the JSON-B annotations to customize the behavior


  • @JsonbProperty to modify the name of the JSON attribute i.e. its different as compared to the POJO field/variable name
  • @JsonbPropertyOrder to specify the lexicographical reverse (Z to A) order for JSON attributes


For more, check out Yasson which is the reference implementation


JPA 2.2 in action


The sample application uses the stream result feature added to Query and TypedQuery interfaces by which it's possible to use JDK 8 Streams API to navigate the result set of a JPA (JPQL, native etc.) query. For other additions in JPA 2.2, please check this

Build the Docker image





Use an existing image from Docker Hub - docker pull abhirockzz/javaee-jsonb-jpa


Run on Oracle Container Cloud


You can use this section of one of my previous blog or the documentation (create a service, deploy) to get this up and running on Oracle Container Cloud. It's super simple


Create a service where you reference the Docker image



Post service creation



Initiate a deployment.. and that's it ! You'll see something similar to this



Test things out


Please make a note of the Host IP of your Oracle Container Cloud worker node (basically a compute VM)


Fetch all employees



You will get a JSON payload with all employees


        "salary": 100,
        "name": "abhi",
        "emp_email": ""
        "salary": 99,
        "name": "rockzz",
        "emp_email": ""



Fetch an employee




You will see a JSON payload in as a response


    "salary": 100,
    "name": "abhi",
    "emp_email": ""


Enjoy Java EE 8 and Glassfish !


**The views expressed in this post are my own and do not necessarily reflect the views of Oracle

This blog will demonstrate how to get started with a Redis based Java application


  • Run it on Oracle Application Container cloud and CI/CD using Oracle Developer cloud
  • Execute Integration tests using NoSQLUnit
  • Our Redis instance will run in a Docker container on Oracle Container cloud






Here is a summary of the application


  • Exposes REST endpoints using Jersey
  • Uses Redis as the data store
  • Jedis is used as the Java client for Redis
  • NoSQLUnit is the framework used for integration testing


Here is the application




NoSQLUnit is an open source testing framework for applications which use NoSQL databases. It works on the concept of (JUnit) Rules and a couple of annotations. These rules are meant for both database lifecycle (start/stop) as well as state (seeding/deleting test data) management. In the sample application, we use it for state management for Redis instance i.e.


  • with the help of a json file, we define test data which will be seeded to Redis before our tests start and then
  • use the annotation (@UsingDataSet) to specify the our modus operandi (in this case - its clean and insert)


Our test dataset in json format



NoSQLUnit in action






Redis on Oracle Container Cloud

  • Use the existing service or create your own (make sure you expose the default Redis port to the host IP) - documentation here
  • Start the deployment - documentation here
  • Note down the host IP of the worker node on which the Redis container is running


Configure Oracle Developer Cloud

We'll start with bootstrapping the application in Oracle Developer Cloud. Check this section for reference Project & code repository creation. Once this is done, we can now start configuring our Build which is in the form of a pipeline consisting of the build, deployment, integration test and tear down phases


Build & deploy phase

The code is built and deployed on Oracle Application Container cloud. Please note that we are skipping the unit test part in order to keep things concise


Build step





Post-build (deploy)






At the end of this phase, our application will be deployed to Application Container Cloud - its time to configure the integration tests


Integration test phase

Our integration tests will run directly against the deployed application using the Redis instance (on Oracle Container Cloud which we had setup earlier). For this

  • we define another build job and
  • make sure that it's triggered after the build + deployment phase completes


Integration build job




Define the dependency



Tear Down phase

Thanks to Oracle Developer Cloud integration with Oracle PaaS Service Manager (PSM), it's easy to add a PSMcli build step that invokes Oracle PaaS Service Manager command line interface (CLI) command to stop our ACCS application once the pipeline has been executed. More details in the documentation





We covered the following


  • Built a Java application on top of Redis
  • Orchestrated its build, deployment and integration test using Oracle Developer Cloud and Oracle Application Container Cloud
  • In the process, we also saw how its possible to treat our infrastructure as code and utilize our cloud services efficiently




**The views expressed in this post are my own and do not necessarily reflect the views of Oracle.