Sample REST Web Service (JAX-RS)

In this tutorial I will show how to create a sample JERSEY REST Web Service. We will create Web Service using Maven and will run it on the Tomcat. This tutorial is using: 1) Tomcat 7.0 2) Java 1.6 3) Jax-RS Web Service 4) Maven 5) Eclipse   First we need to create a maven […]

Word count example in Apache Spark

No BigData example is complete without WordCount example Here in this example we will learn how to setup spark in standalone mode using Java API with word count example. 1) Create a new maven project in Eclipse.   2) Add Spark dependency in the pom.xml file.

3) Get the SparkConf object in the java class. […]

How to do authentication for MongoDB in Java

Here in this article we will see how to perform MongoDB authentication in Java. The MongDB Java Driver version used is 3.0.0. 1) First create the ServerAddress instance ServerAddress serverAddress = new ServerAddress(“localhost”, 27017); 2) Create MongoCredential instance by providing the username and password for your database MongoCredential mongoCredential = MongoCredential.createCredential(“user1”, “demodb”, “pwd1”.toCharArray()); where user1 […]

Access Modifiers

Class Access Modifiers What does it mean by class access modifiers? This is the way by which one class is accessbile by another class.  For e.g. there are two classes say Class A and Class B.  Now, how Class A can access Class B will be depending upon the access modifiers defined for Class B. […]

Functional Java

Functional Java is an open source library. It is based on Java 1.5 and it does not require extra supporting libraries for using this. It has been built on top of Java 1.5 to ease out functional programming concepts in the Java language. How to use Functional Java ? Class : Either <A, B> Package […]