Friday, February 23, 2018

Connect Amazon S3 from Java code. Amazon S3 with Java. Amazon S3 Java code example using the AWS SDK. Upload single or multiple object using AWS Java SDK


Login to aws.amazon.com
Create one user from IAM and give access these things:
AWSConnector
AmazonS3FullAccess

And copy "Access Key" and "Secret Access Key" and it will using in your java code to establish connection.

Create one Maven Project in any Eclipse and add this below one dependency:


    com.amazonaws
    aws-java-sdk
    1.9.2


Then use below code to create bucket, create folder and upload some text file.

package AmazonS3.amazondemo;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;

import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.Bucket;
import com.amazonaws.services.s3.model.ObjectMetadata;
import com.amazonaws.services.s3.model.PutObjectRequest;

public class App
{

static String accessKey = "**********************************";
static String secretAccessKey = "********************************************";


    public static void main( String[] args )
    {
        System.out.println( "Demo for Amazon S3 connectivity from Standalone Java code!" );
        AWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretAccessKey);
       
        AmazonS3 amazonS3Client = new AmazonS3Client(awsCredentials);
       
        System.out.println("Bucket is being created ..................");
        String bucketName = "bucktbyjavacode";
        amazonS3Client.createBucket(bucketName);
       
        for(Bucket bucket : amazonS3Client.listBuckets()){
        System.out.println("Bucket in Amazon S3 :"+bucket.getName());
        }
       
        System.out.println("Folder is being created ................");
        String newFolderName = "Folder_by_Java_Code";
        App demo = new App();
        //demo.createNewFolder(bucketName, newFolderName, amazonS3Client);
        String fileName = "demotextfile.txt";
        amazonS3Client.putObject(new PutObjectRequest(bucketName, fileName, new File("D:\\demotextfile.txt")));
       
        System.out.println("All Done ............");
       
    }
   
    private void createNewFolder(String bucketName, String newFolderName, AmazonS3 amazonClient){
    ObjectMetadata metaData = new ObjectMetadata();
    metaData.setContentLength(0);
   
    InputStream emptyContent = new ByteArrayInputStream(new byte[0]);
   
    PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, newFolderName, emptyContent, metaData);
   
    amazonClient.putObject(putObjectRequest);
    }
}

Thursday, February 15, 2018

How to Call R from Java using Rserve, R Programming through Java



We will use Rserve software to connect our Java code to R environment. Rserve is a TCP/IP server which allows other programs to use facilities of R  from various languages without the need to initialize R or link against R library. Every connection has a separate workspace and working directory. For more details please refer this page https://www.rforge.net/Rserve/

  1. Install R software in your computer somewhere. (My case it is D:\InstalledSoftware\R-3.4.3)
  2. Start your R environment
  3. Install Rserve package (use command install.packages("Rserve"))
  4. Start Rserve in your R environment (use command library(Rserve))
  5. That’s it from R side.
  6. Now setup your Java project.
  7. Open any Eclipse, create java project say "RJavaConnect"
  8. Add two Rserve related jar file in your RJavaConnect project (REngine.jar and Rserve.jar)
  9. You can get both jar from D:\InstalledSoftware\R-3.4.3\library\Rserve\java (In your case check your R installation path). Else you can add these two dependency in your pom.xml
               
    org.nuiton.thirdparty
      REngine
        1.8-5



                org.nuiton.thirdparty
                  Rserve
                    1.8-5
                         Finally, create one Java Class say Demo.java and execute below code. That’s it :)

                      package pkg;

                      import org.rosuda.REngine.REXP;
                      import org.rosuda.REngine.REXPMismatchException;
                      import org.rosuda.REngine.REngineException;
                      import org.rosuda.REngine.Rserve.RConnection;
                      import org.rosuda.REngine.Rserve.RserveException;



                      public class Demo {

                      RConnection connection = null;

                      public static void main(String[] args) {
                      Demo demo = new Demo();
                      demo.connectToR();
                      }

                      public void connectToR(){

                      try{
                      connection = new RConnection();
                      String vector = "c(1,2,3,4)";
                                  connection.eval("meanVal=mean(" + vector + ")");
                                  double mean = connection.eval("meanVal").asDouble();
                                  System.out.println("The mean of given vector is=" + mean);
                                 
                                   /*
                                   String setwd = "setwd(\"d:/InstalledSoftware/RStudio\")";
                                   connection.eval(setwd);
                                  
                                   vector = "binod<-c p="">
                                   connection.eval(vector);*/
                                 
                                  int[] input = {10,20,30,40,50};
                                  connection.assign("input", input);
                                  REXP output = connection.eval("mean(input)");
                                  System.out.println("Mean of out input data :"+output);
                                  System.out.println("Mean of out input data :"+output.asDouble());
                                 
                                  }catch (RserveException e) {
                                    e.printStackTrace();
                                 }catch (REXPMismatchException e) {
                                  e.printStackTrace();
                                } catch (REngineException e) {
                                     e.printStackTrace();
                                 }finally{
                                       if(connection != null){
                                    connection.close();
                                  }
                               } 
                           }


                      }

                      Saturday, June 18, 2016

                      java.util.Optional, Tired of Null Pointer Exceptions, get rid of Null Pointer Exceptions, Handle NullPointerException in Java


                      See this below java code to add two Integer:

                      public Integer sumOfTwoInteger(Integer a, Integer b){
                            return a + b;
                         }


                      Here, sumOfTwoInteger() method at all not taking care of any of the method arguments, this method will be executed either you pass any valid Integer value or any null value. Even, from where (caller method) you will call this sumOfTwoInteger() method, caller method will be also taking care for data is going to pass to sumOfTwoInteger() method. Finally ends up with this below error message:

                      Integer a = null;
                      Integer b = 10;

                      System.out.println(test.sumOfTwoInteger(a,b));

                      Exception in thread "main" java.lang.NullPointerException
                      at Tester.sumOfTwoInteger(GuavaTester.java:19)
                      at Tester.main(GuavaTester.java:14)

                      Now, how to handle this kind of situation where null check is to be check always and each and every place, before calling method or during method is being executed.

                      User java.util.Optional package.

                      import java.util.Optional;


                      public class Tester {
                         public static void main(String args[]) {
                            Tester guavaTester = new Tester();
                           
                            Integer invalidInput = null;
                           
                           
                            Optional a =  Optional.of(invalidInput);
                            Optional b =  Optional.of(new Integer(10));
                             
                            System.out.println(guavaTester.sumOfTwoInteger(a,b));
                         }

                         public Integer sumOfTwoInteger(Optional a, Optional b){
                           return a.get() + b.get();
                        }

                      }

                      Now, when you will run this code, it will give error at line, where you are trying to create Integer value a.

                      Exception in thread "main" java.lang.NullPointerException
                      at java.util.Objects.requireNonNull(Unknown Source)
                      at java.util.Optional.(Unknown Source)
                      at java.util.Optional.of(Unknown Source)
                      at Tester.main(Tester.java:11)



                      More details at http://www.tutorialspoint.com/guava/index.htm





                      Thursday, April 28, 2016

                      Create index in kibana using curl command, Index creation in Kibana by code, Kibana index by command, create index in Kibana in background


                      Your ElasticSearch Servar and Kibana server should be running during this poc.

                      Just assume,

                      Kibana is running at 10.20.30.40:5601


                      First requirement, you should have same index in your Elasticsearch for which you wanted to create index in Kibana.
                      If you do not have any index in Elasticsearch then first create it.

                      {
                       "_index": "twiteer_one",
                                  "_type": "tweet",
                                  "_id": "2",
                                  "_score": 1,
                                  "_source": {
                                     "nick": "Ishan@gmail.com",
                                     "date": "2015-02-10",
                                     "post": "NCFE",
                                     "other_name": "Ishan Suman"
                                  }
                               },
                               {
                                  "_index": "twiteer_one",
                                  "_type": "tweet",
                                  "_id": "17",
                                  "_score": 1,
                                  "_source": {
                                     "nick": "@binodsuman",
                                     "date": "2014-08-15",
                                     "post": "BigData, Kibana, ES, ML",
                                     "other_name": "Binod Suman"
                                  }
                      }

                      I hope your Elasticsearch must be running while using below command.

                      Now suppose you want to create index with name twiteer_one in your kibana, then use this below command in lunux flavor machine. (This command gives some error while executing in Windows Machine).

                      curl -H  "Content-Type: application/json" -XPOST -i -H "kbn-version:4.4.2" http://10.20.30.40:5601/elasticsearch/.kibana/index-pattern/twiteer_one?op_type=create -d '{"title": "twiteer_two", "timeFieldName": "date"}'

                      After successfully execute this command, come in Kibana and check.

                      Kibana -> Settings -> Indices, your twiteer_two index should be here.









                      Wednesday, April 27, 2016

                      Export and import via curl kibana’s dashboards and visualizations, Kibana Dashboard export into another Elasticsearch, command line load dashboard, How to save dashboard as json file, Location of custom Kibana dashboards in ElasticSearch


                      First in create some index and data in first ElasticSearch. As per my example:
                      {
                       "_index": "twiteer_one",
                                  "_type": "tweet",
                                  "_id": "2",
                                  "_score": 1,
                                  "_source": {
                                     "nick": "Ishan@gmail.com",
                                     "date": "2015-02-10",
                                     "post": "NCFE",
                                     "other_name": "Ishan Suman"
                                  }
                               },
                               {
                                  "_index": "twiteer_one",
                                  "_type": "tweet",
                                  "_id": "17",
                                  "_score": 1,
                                  "_source": {
                                     "nick": "@binodsuman",
                                     "date": "2014-08-15",
                                     "post": "BigData, Kibana, ES, ML",
                                     "other_name": "Binod Suman"
                                  }

                       - Connect this first ElasticSearch into your kibana dashboard.
                       - Create two visualization using above index "twiteer_one"
                         In my case, First-Visualization and Second-Visualization
                       - Create one Dashboard in kibana using these two visualization.
                         In my case my Dashboard name is "My-Dashboard".
                       
                      - Export all three item (two visualization and one dashboard) individually from Kibana.
                        HOW: In Kibana -> go to Settings -> Objects -> Visualization and
                         * tick on First Visualization and export and save in one folder with name v1.json
                         * tick on Second  Visualization and export and save in one folder with name v2.json
                       
                         - In Kibana -> go to Settings -> Objects -> Dashboard and
                         * tick on My Dashboard and export and save in one folder with name dashboard.json
                       
                       
                        - Stop this first ElasticSearch
                        - Start your second ElasticSearch, make sure you should have same index "twiteer_one" with same set of data.
                        Edit v1.json and remove first four line and your file should like this:
                       
                         {
                            "title": "First Visualization",
                            "visState": "{\"title\":\"New
                       ----
                       -----
                        "searchSourceJSON": "{\"index\":\"twiteer_one\",\"query\":{\"query_string\":{\"query\":\"*\",\"analyze_wildcard\":true}},\"filter\":[]}"
                            }
                          }
                        Edit v2.json and dashboard.json also and remove first four lines.
                       
                        Execute these three curl command:
                        D:\Kibana_Json>curl localhost:9200/.kibana/visualization/First-Visualization -d @v1.json
                        D:\Kibana_Json>curl localhost:9200/.kibana/visualization/Second-Visualization -d @v2.json
                        D:\Kibana_Json>curl localhost:9200/.kibana/dashboard/My-Dashboard -d @dashboard.json
                        Make sure after executing each command you must get "created":true message.
                        {"_index":".kibana","_type":"dashboard","_id":"My-Dashboard","_version":1,"_shards":{"total":2,"successful":1,"failed":0},"created":true}
                      D:\Kibana_Json>

                        Now you connect second ElasticSearch with Kibana and you will be getting all your visualization and Dashboard.
                        Please write if any problem or feedback.
                       
                       

                       

                       
                         
                       
                         

                      Thursday, March 24, 2016

                      SSL enable Server and Client side code, KeyStore, KeyManagerFactory, SSLContext, SSLServerSocketFactory, easy example of Java SSL code, getting start with SSL, What is SSL, Wha is the use of SSL, keytool command, SSL Client java code, How to write SSL enable client side code


                      SSL (Secure Sockets Layer) provides a secure connection between internet browsers and websites, allowing you to transmit private data online. 

                      Server used to have private and public key (key OR certificate). Server creator either can take certificate from some well known Certificate Authority (CA) or generate their own certificate using java keytool command. When client wants to connect server, server send public key to client and handshake happens between both.

                      Using server's public key, all data which go from client to server are encrypted by server's public key and at server side using private key, server can decrypted those client data. But instead always using public and private key, after handshake both client and server use one symmetric key for their encryption and decryption.

                      How to generate your own key using JDK keytool command.
                      keytool -genkey -keystore demokeystore -keyalg RSA
                      I use "password" as password while generating this keystore.


                      SSLServerDemo.java

                      import javax.net.ssl.KeyManagerFactory;
                      import javax.net.ssl.SSLContext;
                      import javax.net.ssl.SSLServerSocket;
                      import javax.net.ssl.SSLServerSocketFactory;
                      import javax.net.ssl.SSLSocket;
                      import javax.net.ssl.TrustManagerFactory;

                      import java.io.BufferedReader;
                      import java.io.FileInputStream;
                      import java.io.InputStream;
                      import java.io.InputStreamReader;
                      import java.security.KeyStore;

                      public class SSLServerDemo {
                          public static void main(String[] arstring) {
                          SSLContext sslContext;
                          System.out.println("** Servlet start with inbuild SSL **");
                              try {
                             
                               InputStream kis = new FileInputStream("demokeystore");
                               KeyStore keyStore = KeyStore.getInstance("jks");
                               keyStore.load(kis, "password".toCharArray());
                               KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
                               keyManagerFactory.init(keyStore, "password".toCharArray());
                                   
                               sslContext = SSLContext.getInstance("TLS");
                               sslContext.init(keyManagerFactory.getKeyManagers(), null, null);
                                  
                               SSLServerSocketFactory sslserversocketfactory = sslContext.getServerSocketFactory();
                               SSLServerSocket sslserversocket = (SSLServerSocket) sslserversocketfactory.createServerSocket(9000);
                               SSLSocket sslsocket = (SSLSocket) sslserversocket.accept();

                               InputStream inputstream = sslsocket.getInputStream();
                               InputStreamReader inputstreamreader = new InputStreamReader(inputstream);
                               BufferedReader bufferedreader = new BufferedReader(inputstreamreader);

                               String string = null;
                               while ((string = bufferedreader.readLine()) != null) {
                                      System.out.println("From SSL Server :"+string);
                                      System.out.flush();
                                  }
                              } catch (Exception e) {
                                  e.printStackTrace();
                              }
                          }
                      }


                      SSLClientDemo.java

                      import javax.net.ssl.KeyManagerFactory;
                      import javax.net.ssl.SSLContext;
                      import javax.net.ssl.SSLServerSocketFactory;
                      import javax.net.ssl.SSLSocket;
                      import javax.net.ssl.SSLSocketFactory;
                      import javax.net.ssl.TrustManagerFactory;

                      import java.io.*;
                      import java.security.KeyStore;

                      public class SSLClientDemo {
                          public static void main(String[] arstring) {
                          SSLContext sslContext;
                              try {
                             
                                InputStream kis = new FileInputStream("demokeystore");
                                  KeyStore trustStore = KeyStore.getInstance("jks");
                                  trustStore.load(kis, "password".toCharArray());
                                  TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
                                  trustManagerFactory.init(trustStore);
                                           
                                  sslContext = SSLContext.getInstance("TLS");
                                  sslContext.init(null, trustManagerFactory.getTrustManagers(), null);
                                  
                                   SSLSocketFactory sslsocketfactory = sslContext.getSocketFactory();
                                  SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket("localhost", 9000);

                                  InputStream inputstream = System.in;
                                  InputStreamReader inputstreamreader = new InputStreamReader(inputstream);
                                  BufferedReader bufferedreader = new BufferedReader(inputstreamreader);

                                  OutputStream outputstream = sslsocket.getOutputStream();
                                  OutputStreamWriter outputstreamwriter = new OutputStreamWriter(outputstream);
                                  BufferedWriter bufferedwriter = new BufferedWriter(outputstreamwriter);

                                  String string = null;
                                  while ((string = bufferedreader.readLine()) != null) {
                                      bufferedwriter.write(string + '\n');
                                      bufferedwriter.flush();
                                  }
                              } catch (Exception e) {
                                  e.printStackTrace();
                              }
                          }
                      }

                      Compile both java file and run both. Now if you type any message in client side, it will send to server side code.




                      Tuesday, March 22, 2016

                      How to write ElasticSearch 2.2 plugin, Getting start Elasticsearch Plugin, Develop ElasticSearch Plugin, How to debug elasticsearch plugin using eclipse, Remote debuging in Elasticsearch plugin, first plugin in Elasticsearch,


                      How to develop custom plugin for ElasticSearch 2.2

                      What is Plugin:
                      Plugins are a way to enhance the basic elasticsearch functionality in a custom manner. They range from adding custom mapping types, custom analyzers, native scripts, custom discovery and more.

                      There are three types of plugins:
                      - Java plugins
                          These plugins contain only JAR files, and must be installed on every node in the cluster. After installation, each node must be restarted before the plugin becomes visible.
                      - Site plugins
                          These plugins contain static web content like Javascript, HTML, and CSS files, that can be served directly from Elasticsearch.
                          http://yournode:9200/_plugin/[plugin name]
                      - Mixed plugins
                        Mixed plugins contain both JAR files and web content.

                      Here, I am going to develop Java Plugins.
                      1. Create one simple Maven project from Eclipse.
                      2. Add below things to your pom.xml
                        
                      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
                        <modelVersion>4.0.0</modelVersion>
                        <groupId>org.elasticsearch</groupId>
                        <artifactId>es_plugin</artifactId>
                        <version>1.1</version>
                        <packaging>jar</packaging>

                        <name>es_plugin</name>


                        <properties>
                              <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                              <maven.compiler.source>1.8</maven.compiler.source>
                              <maven.compiler.target>1.8</maven.compiler.target>
                          </properties>

                        <dependencies>
                          <dependency>
                                   <groupId>org.elasticsearch</groupId>
                                  <artifactId>elasticsearch</artifactId>
                                  <version>2.2.1</version>
                                  <scope>provided</scope>
                              </dependency>
                           </dependencies>
                         
                           <build>
                          <finalName>${project.artifactId}</finalName>
                              <plugins>
                                  <plugin>
                                      <artifactId>maven-assembly-plugin</artifactId>
                                      <version>2.5.5</version>
                                      <configuration>
                                          <appendAssemblyId>false</appendAssemblyId>
                                          <outputDirectory>${project.build.directory}/releases/</outputDirectory>
                                          <descriptors>
                                              <descriptor>${basedir}/src/main/assemblies/plugin.xml</descriptor>
                                          </descriptors>
                                      </configuration>
                                      </plugin>
                      </plugins>
                          </build>
                       
                      </project>

                         

                      3. In side src folder, you should have these three folders.
                        src -> assemblies, java and resources subfolder
                      4. Inside assemblies folder, plugin.xml
                      5. Inside resources, plugin-descriptor.properties file should be there.
                      6. Inside java folder, all java file under package, In my case
                         java\org\elasticsearch\es_plugin this folder has three java file.
                         - App.java
                         - ExampleRestModule.java
                         - HelloRestHandler.java
                       
                      ** plugin.xml **

                        <?xml version="1.0"?>
                      <assembly
                          xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
                          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
                          <id>plugin</id>
                          <formats>
                              <format>zip</format>
                          </formats>
                          <includeBaseDirectory>false</includeBaseDirectory>
                          <dependencySets>
                              <dependencySet>
                                  <outputDirectory>/</outputDirectory>
                                  <useProjectArtifact>true</useProjectArtifact>
                                  <useTransitiveFiltering>true</useTransitiveFiltering>
                              </dependencySet>
                          </dependencySets>
                      </assembly>


                      ** plugin-descriptor.properties **

                      # All plugins, be they site or Java plugins, must contain a file called plugin-descriptor.properties in the root directory.
                      # Elasticsearch plugin descriptor file
                      description=Binod Suman ES Demo Plugin
                      version=1.1
                      # 'name': the plugin name
                      name=Binod ES Plugin Demo
                      jvm=true
                      # 'classname': the name of the class to load, fully-qualified.
                      #classname=com.netiq.scm.SCMPlugin
                      classname=org.elasticsearch.es_plugin.App
                      java.version=1.8
                      elasticsearch.version=2.2.1

                      ** App.java **
                      package org.elasticsearch.es_plugin;

                      import java.util.Collection;
                      import java.util.Collections;

                      import org.elasticsearch.common.inject.Module;
                      import org.elasticsearch.plugins.Plugin;

                      @SuppressWarnings("static-method")
                      public class App extends Plugin {

                          @Override
                      public String name() {
                      return "Binod Suman ElasticSearch Demo Name";
                      }

                      @Override
                      public String description() {
                      return "** Purpose for this plugin to how to write first ElasticSearch Demo";
                      }


                      @Override
                          public Collection nodeModules() {
                              return Collections.singletonList(new ExampleRestModule());
                          }
                      }


                      ** ExampleRestModule.java **
                      package org.elasticsearch.es_plugin;

                      import org.elasticsearch.common.inject.AbstractModule;

                      public class ExampleRestModule extends AbstractModule {

                      @Override
                      protected void configure() {
                      bind(HelloRestHandler.class).asEagerSingleton();
                      }

                       }

                       ** HelloRestHandler.java **
                      package org.elasticsearch.es_plugin;

                      import org.elasticsearch.common.component.AbstractComponent;
                      import org.elasticsearch.common.inject.Inject;
                      import org.elasticsearch.common.settings.Settings;

                      public class HelloRestHandler extends AbstractComponent  {

                      @Inject
                      public HelloRestHandler(Settings settings) {
                      super(settings);
                      System.out.println("**** Hello I am here in HelloResthandler Module of ES 2 **");
                      }



                      }

                      ** Now build your code by pom.xml **
                      mvn clean install
                      It will create one jar file "es_plugin.jar" inside target folder.

                      Create one folder in side your ElasticSearch installation Plugin folder. In my case, I created one folder
                      binod-demo-plugin inside E:\Software\elasticsearch-2.2.1\plugins folder.
                      Inside E:\Software\elasticsearch-2.2.1\plugins\binod-demo-plugin folder, I kept these two files:
                       es_plugin.jar
                       plugin-descriptor.properties

                      Now try to restart ElasticSearch.
                      E:\Software\elasticsearch-2.2.1\bin>elasticsearch.bat
                      [2016-03-22 23:03:38,140][INFO ][node                     ] [Bison] version[2.2.1], pid[13000], build[d045fc2/2016-03-09T09:38:54Z]
                      [2016-03-22 23:03:38,141][INFO ][node                     ] [Bison] initializing ...
                      [2016-03-22 23:03:38,689][INFO ][plugins                  ] [Bison] modules [lang-expression, lang-groovy], plugins [Binod ES Plugin Demo, scm], sites []
                      [2016-03-22 23:03:38,712][INFO ][env                      ] [Bison] using [1] data paths, mounts [[New Volume (E:)]], net usable_space [66.1gb], net total_space [157.8gb], spins? [unknown], types [NTFS]
                      [2016-03-22 23:03:38,712][INFO ][env                      ] [Bison] heap size [910.5mb], compressed ordinary object pointers [true]
                      [2016-03-22 23:03:38,931][INFO ][http                     ] [Bison] Using [org.elasticsearch.http.netty.NettyHttpServerTransport] as http transport, overridden by [SCM]
                      **** Hello I am here in HelloResthandler Module of ES 2 **
                      [2016-03-22 23:03:39,779][INFO ][com.netiq.scm.Util       ] [Bison] java.home = D:\InstalledFolder\Java\jdk1.8.0_45\jre
                      [2016-03-22 23:03:39,780][ERROR][com.netiq.scm.Util       ] [Bison] E:\Software\elasticsearch-2.2.1\config\db.properties (The system cannot find the file specified)
                      [2016-03-22 23:03:40,878][ERROR][com.netiq.scm.Util       ] [Bison] Cannot sync configuration from SCM Core. java.net.MalformedURLException: no protocol: nullconfig/[get]
                      [2016-03-22 23:03:40,997][INFO ][node                     ] [Bison] initialized
                      [2016-03-22 23:03:40,997][INFO ][node                     ] [Bison] starting ...
                      -03-22 23:03:47,695][INFO ][node                     ] [Bison] started

                      Here you can see the output carefully, some message comes from your own plugin.
                       
                      **** How to set Debug breakpoint  *****
                      1. put break point of HelloRestHandler constructor
                      2. Add some extra parameter in elasticsearch.bat file.
                         For More details: http://binodsuman.blogspot.in/2016/03/how-to-call-elasticsearch-in-debug-mode.html
                      3. Set one remote debug for this project in Eclipse.
                      4. Now start ElasticSearch.bat with extra debug parameter and start project in Eclipse.