Tuesday, January 31, 2017

Software Firms in Bangladesh that mostly work with Java technologies?

Here is a list that may help you:

1. Therap - 140+
2. Tiger IT - 170+
3. Vantage
4. Kona Software
5. Reve Systems
6. Innoweb Ltd
7. Erient
8. Bording Vista - 32+
9. Newgen Technology BD Ltd
10. Nordic Soft
11. Cefalo
12. Southtech
13. Leads Corporation
14. Metatude Asia
15. Escenic Asia -34+
16. DSi
17. IBCS Primax Ltd
18. BRAC IT Services Ltd - 52+
19. bKash Ltd
20. IPVision
21. Nilavo Technologies
22. Progoti Systems Ltd (SureCash)
23. Orbund
24. ENTERPRISE SOLUTIONS - EUSIA TECHNOLOGY COMMUNITY
25. Sekai Lab
26. BitMascot Pvt Ltd.
27. GenWeb2 Ltd.
28. Widespace
29. Vizrt -50+
30. Grameen Intel Social Business Ltd
31. Together Initiatives Ltd - 19+

32. BJIT - 200+

Resource Links: https://www.quora.com/Which-are-the-software-industries-in-Bangladesh-that-mostly-work-with-Java-technologies

How to Install Memcached on CentOS 7

Memcached is a distributed, high-performance, in-memory caching system that is primarily used to speed up sites that make heavy use of databases. It can however be used to store objects of any kind. Nearly every popular CMS has a plugin or module to take advantage of memcached, and many programming languages have a memcached library, including PHP, Perl, Ruby, and Python. Memcached runs in memory and is thus quite speedy, since it does not need to write data to disk.
Pre-Flight Check
  • These instructions are intended specifically for installing Memcached on a single CentOS 7 node.
  • I’ll be working from a Liquid Web Core Managed CentOS 7 server, and I’ll be logged in as root.

Step #1 Install Memcached
First, clean-up yum:
yum clean all
As a matter of best practice we’ll update our packages:
yum -y update
Installing Memcached and related packages is now as simple as running just one command:
yum -y install memcached
Step #2: Configuration of the Memcached Installation
Use the following command to view information on the memcached command:
memcached -h
The default configuration file can be found at:
/etc/sysconfig/memcached
When started, Memcached will start on port 11211 by default per the default configuration file:
PORT=”11211″
USER=”memcached”
MAXCONN=”1024″
CACHESIZE=”64″
OPTIONS=””

To change the port (PORT), the user Memcached runs as (USER), the maximum number of allowed connections to Memcached (MAXCONN), or the cache size in megabytes (CACHESIZE), simply edit the configuration file.
For a refresher on editing files with vim see: New User Tutorial: Overview of the Vim Text Editor
EXAMPLE: If I wanted to run Memcached on port 1337, with 4GB of memory, and allow a maximum of 2,000 connections, I would change the config file as follows.
Let’s edit the configuration file:
vim /etc/sysconfig/memcached
To the following:
PORT=”1337″
USER=”memcached”
MAXCONN=”2000″
CACHESIZE=”4096″
OPTIONS=””

Exit and save the configuration file, and then restart Memcached
systemctl restart memcached
Step 3: Configure Memcached to Start on Boot
And then start Memcached:
systemctl start memcached
Be sure that Memcached starts at boot:
systemctl enable memcached
To check the status of Memcached:
systemctl status memcached
To stop Memcached:



systemctl stop memcached

Resource Link: https://www.liquidweb.com/kb/how-to-install-memcached-on-centos-7/

Monday, January 30, 2017

Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError.

Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError.


Solution:


So you have to exclude conflict dependencies. Try this:

 <exclusion>
   <groupid>org.slf4j</groupid>
   <artifactid>slf4j-log4j12</artifactid>
  </exclusion>
  <exclusion>
   <groupid>log4j</groupid>
   <artifactid>log4j</artifactid>
  </exclusion>
 </exclusions>


This solved same problem with slf4j and Dozer.

log4j-over-slf4j.jar and slf4j-log4j12.jar cannot be present simultaneously


The presence of slf4j-log4j12.jar, that is the log4j binding for SLF4J, will force all SLF4J calls to be delegated to log4j. The presence of log4j-over-slf4j.jar will in turn delegate all log4j API calls to their SLF4J equivalents. If both are present simultaneously, slf4j calls will be delegated to log4j, and log4j calls redirected to SLF4j, resulting in an endless loop.

Resource Link: https://www.slf4j.org/legacy.html#log4jRecursion


My pom.xml
----------
<pre class="brush: py">
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.kaka.web.relayfile.conf</groupId>
<artifactId>KakaRelayConf</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>OttaRelayConf</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
<relativePath />
<!-- lookup parent from repository -->
</parent>
<properties>
<java.version>1.7</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.spy</groupId>
<artifactId>spymemcached</artifactId>
<version>2.9.1</version>
<scope>compile</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>javax.servlet</groupId> -->
<!-- <artifactId>servlet-api</artifactId> -->
<!-- <version>2.5</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>javax.servlet</groupId> -->
<!-- <artifactId>javax.servlet-api</artifactId> -->
<!-- <version>3.1.0</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>javax</groupId> -->
<!-- <artifactId>javaee-web-api</artifactId> -->
<!-- <version>7.0</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<!-- https://mvnrepository.com/artifact/aopalliance/aopalliance -->
<dependency>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.32</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.3.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slim3</groupId>
<artifactId>slim3</artifactId>
<version>1.0.16</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.7.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.30</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.appengine/appengine-api-labs -->
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-labs</artifactId>
<version>1.7.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-el -->
<!-- <dependency> -->
<!-- <groupId>org.apache.tomcat.embed</groupId> -->
<!-- <artifactId>tomcat-embed-el</artifactId> -->
<!-- <version>8.0.33</version> -->
<!-- </dependency> -->
<dependency>
<groupId>com.github.isrsal</groupId>
<artifactId>spring-mvc-logger</artifactId>
<version>0.2</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- <plugin> -->
<!-- <groupId>org.springframework.boot</groupId> -->
<!-- <artifactId>spring-boot-maven-plugin</artifactId> -->
<!-- <configuration> -->
<!-- <mainClass>me.kaka.web.relayfile.conf.controller.Application</mainClass> -->
<!-- </configuration> -->
<!-- </plugin> -->
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<packagingIncludes>WEB-INF/lib/*.jar</packagingIncludes>
</configuration>
</plugin>
</plugins>
<finalName>ROOT</finalName>
</build>
</project>
</pre>

<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>me.kaka.web.relayfile.conf</groupId>
<artifactId>KakaRelayConf</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>OttaRelayConf</name>
<url>http://maven.apache.org</url>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<java.version>1.7</java.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.spy</groupId>
<artifactId>spymemcached</artifactId>
<version>2.9.1</version>
<scope>compile</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>javax.servlet</groupId> -->
<!-- <artifactId>servlet-api</artifactId> -->
<!-- <version>2.5</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->

<!-- <dependency> -->
<!-- <groupId>javax.servlet</groupId> -->
<!-- <artifactId>javax.servlet-api</artifactId> -->
<!-- <version>3.1.0</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->

<!-- <dependency> -->
<!-- <groupId>javax</groupId> -->
<!-- <artifactId>javaee-web-api</artifactId> -->
<!-- <version>7.0</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->

<!-- https://mvnrepository.com/artifact/aopalliance/aopalliance -->
<dependency>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
<version>1.0</version>
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.32</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.3.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slim3</groupId>
<artifactId>slim3</artifactId>
<version>1.0.16</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.7.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.30</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.appengine/appengine-api-labs -->
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-labs</artifactId>
<version>1.7.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-el -->
<!-- <dependency> -->
<!-- <groupId>org.apache.tomcat.embed</groupId> -->
<!-- <artifactId>tomcat-embed-el</artifactId> -->
<!-- <version>8.0.33</version> -->
<!-- </dependency> -->

<dependency>
<groupId>com.github.isrsal</groupId>
<artifactId>spring-mvc-logger</artifactId>
<version>0.2</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- <plugin> -->
<!-- <groupId>org.springframework.boot</groupId> -->
<!-- <artifactId>spring-boot-maven-plugin</artifactId> -->
<!-- <configuration> -->
<!-- <mainClass>me.kaka.web.relayfile.conf.controller.Application</mainClass> -->
<!-- </configuration> -->
<!-- </plugin> -->
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<packagingIncludes>WEB-INF/lib/*.jar</packagingIncludes>
</configuration>
</plugin>
</plugins>

<finalName>ROOT</finalName>
</build>
</project>

Resource Link: http://stackoverflow.com/questions/20117720/detected-both-log4j-over-slf4j-jar-and-slf4j-log4j12-jar-on-the-class-path-pree

CATALINA_HOME vs. CATALINA_BASE

Why are these two variables separated?
catalina.home points to the location of the common information.
catalina.base points to the directory where all the instance specific information are held.
So you have 1 home and can have more than 1 base.
When should they be separated? When should these two variables be the same?
If you have 1 tomcat you can set them to the same value but good practice would suggest you plan ahead and keep them separate: you never know if you need more than one tomcat. Ubuntu started following this way of thinking due to it being more logical: it makes it easier to run 2+ tomcats but does not disable running 1 tomcat where setting them both to the same value would require everyone to edit the base value. Makes more sense to keep them different.
What does this allow the administrator to do?
Allow for more than 1 tomcat to run at the same time where each tomcat instance can have their own apps.
What do you then place into each directory?
Home contains the binairy.
Base contains conf, logs, webapps, work and temp. 1 for every tomcat instance.

Where is catalina_base and catalina_home located for tomcat6?

Both are stored and can be set in /etc/default/tomcat6. By default, CATALINA_HOME is /usr/share/tomcat6, and CATALINA_BASE is /var/lib/tomcat6

Resource Link: http://askubuntu.com/a/46759

Monday, January 23, 2017

Git Gerrit Tutorial

Difference between “checkout” & “cherry-pick”

Clone:

  1. clone is for fetching repositories you don't have

Checkout:
  1. Switching to a specific branch or a specific commit.
  2. checkout is for switching between branches in a repository you already have.

Cherry-Pick:
  1. Taking / picking only the changes of a specific commit on to the working tree. The changes will be merged with the code on working tree.

Pull:
  1. Fetches the changes AND merges them into the local branch of the same name.


Difference between “checkout” & “cherry-pick”
• “checkout” fetch the code and head is moved to that commit. It does not merge with the
existing headed code.

• “cherry-pick” takes only the change of that commit and merge with currently headed code.

Learning about Slim3 framework Java and say “Hello Word”

Friday, January 20, 2017

How to put objects in memcache?

How to put objects in memcache

This example shows how to put objects in the memcached server.

Use the set(...) method of net.spy.memcached.MemcachedClient object, passing it the unique name by which to identify the object, expiry time period of the object in seconds and the object itself. In the example below, the expiry time used is 3600 seconds.

  1. package com.techfundaes.memcacheBag;  
  2.   
  3. import java.net.InetSocketAddress;  
  4. import java.util.Date;  
  5.   
  6. import net.spy.memcached.MemcachedClient;  
  7.   
  8. public class StoreObjectsInCache  
  9. {  
  10.     public static void main(String[] args) throws Exception  
  11.     {  
  12.         MemcachedClient memcacheClient = new MemcachedClient(new InetSocketAddress("localhost"11211));  
  13.           
  14.         Object objectToCache = new Object();  
  15.         memcacheClient.set("keyObject"3600, objectToCache);  
  16.           
  17.         Date startDate = new Date();  
  18.         memcacheClient.set("keyDate"3600, startDate);  
  19.     }  
  20. }  
  21.    

Resource Link:

Gradle to maven conversion and vice versa

How to convert maven to gradle
The first thing is, you have to install gradle. Its easy. I know you can do it.  Go to the installing guide: http://www.gradle.org/docs/current/userguide/installation.html
Now the second step is to run ‘gradle init‘ in the directory containing the POM file. This will  convert the maven build to a gradle build generating a setting.gradle file and one or  ore more build.gradle files.
Thats all.
How to convert gradle to maven
You just need to add  a maven plugin in your build.gradle.
Your build gradle should be like this-










apply plugin: 'java'
apply plugin: 'maven'
group = 'com.bazlur.app'
// artifactId is taken by default, from folder name
version = '0.1-SNAPSHOT'
dependencies {
compile 'commons-lang:commons-lang:2.3'
}
Now run ‘gradle install‘ in the build.gradle folder.
Now you will find in the build/poms subfolder, a file called pom-default.xml which will contain the dependencies.

Now its all yours, copy it, customise it add up new stuff.

Resource Link:

  1. https://codexplo.wordpress.com/2014/07/20/gradle-to-maven-conversion-and-vice-versa/
  2. Gradle build.gradle to Maven pom.xml

Friday, January 13, 2017

Memcached installation and sample code run

Memcached installation and run and check:
----------------------------------------
Installation:
-------------
$sudo apt-get update
$sudo apt-get install memcached

Check for status:
----------------
$ps aux | grep memcached
Memcached is running on the default port 11211. So in your code, use 11211 as port number.

Use with another port:
---------------------
For using Memcached server on a different port, run the command given below −

$memcached -p 11111 -U 11111 -u user -d

It should start the server and listen on TCP port 11111 and UDP port 11111 as a daemon process.

This command is explained below −

    -p is for TCP port number
    -U is for UDP port number
    -u is for user name
    -d runs memcached as daemon process

You can run multiple instances of Memcached server through a single installation.

Required Jar:
------------
<!-- https://mvnrepository.com/artifact/net.spy/spymemcached -->
<dependency>
    <groupId>net.spy</groupId>
    <artifactId>spymemcached</artifactId>
    <version>2.12.1</version>
</dependency>

You can also download and use it in your build path of eclipse.


Run command:
-----------
$telnet HOST PORT

Here, HOST and PORT are machine IP and port number respectively, on which the Memcached server is running.
$telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.


Sample Code:
-----------
package com.rizvi.ProjectApps;

import java.util.HashMap;
import com.whalin.MemCached.MemCachedClient;
import com.whalin.MemCached.SockIOPool;

public class MemcachedJavaClient {

    /**
     * MemcachedJavaClient program to show the usage of different functions that
     * can be performed on Memcached server with Java Client
     *
     * @param args
     */
    public static void main(String[] args) {
        // initialize the SockIOPool that maintains the Memcached Server
        // Connection Pool
        String[] servers = { "localhost:11211" };
        SockIOPool pool = SockIOPool.getInstance("Test1");
        pool.setServers(servers);
        pool.setFailover(true);
        pool.setInitConn(10);
        pool.setMinConn(5);
        pool.setMaxConn(250);
        pool.setMaintSleep(30);
        pool.setNagle(false);
        pool.setSocketTO(3000);
        pool.setAliveCheck(true);
        pool.initialize();
        // Get the Memcached Client from SockIOPool named Test1
        MemCachedClient mcc = new MemCachedClient("Test1");
        // add some value in cache
        System.out.println("add status:" + mcc.add("1", "Original"));
        System.out.println("mcc is: " + mcc.getCounter("Test1"));
        // Get value from cache
        System.out.println("Get from Cache:" + mcc.get("1"));

        System.out.println("add status:" + mcc.add("1", "Modified"));
        System.out.println("Get from Cache:" + mcc.get("1"));

        // use set function to add/update value, use replace to update and not
        // add
        System.out.println("set status:" + mcc.set("1", "Modified"));
        System.out.println("Get from Cache after set:" + mcc.get("1"));

        // use delete function to delete key from cache
        System.out.println("remove status:" + mcc.delete("1"));
        System.out.println("Get from Cache after delete:" + mcc.get("1"));

        // Use getMulti function to retrieve multiple keys values in one
        // function
        // Its helpful in reducing network calls to 1
        mcc.set("2", "2");
        mcc.set("3", "3");
        mcc.set("4", "4");
        mcc.set("5", "5");
        String[] keys = { "1", "2", "3", "INVALID", "5" };
        HashMap<String, Object> hm = (HashMap<String, Object>) mcc.getMulti(keys);

        for (String key : hm.keySet()) {
            System.out.println("KEY:" + key + " VALUE:" + hm.get(key));
        }
    }
}

Resource Link:

https://www.tutorialspoint.com/memcached/memcached_environment.htm

Tuesday, January 10, 2017

What Spring Boot gives us ?

  1.  Opinionated
  2. Convention over configuration
  3. Stand alone
  4. Production ready.

Monday, January 9, 2017

Log4j Configuration in Spring Boot project

For log4j configuration, 3 things are done.

1st Step:


In src/main/resources Folder, I have created a file named application.properties.

application.properties

logging.file=project-server.log



2nd Step:

I have also created another file named  logback-spring.xml
logback-spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="org/springframework/boot/logging/logback/defaults.xml" />
    <property name="LOG_FILE"
        value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}spring.log}" />
    <include resource="org/springframework/boot/logging/logback/file-appender.xml" />
    <root level="INFO">
        <appender-ref ref="FILE" />
    </root>
</configuration>




3rd Step:


In ServiceImpl.java class, I have added the following lines

ServiceImpl.java
 
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


 @Service
public class ServiceImpl implements MyService {

private static final Logger logger = LoggerFactory.getLogger(ServiceImpl.class);


It gives me log file properly.
 

Date - Null Pointer Exception

When I was testing my project, I got a null pointer exception.

Ans:

Because it was not set/sent through params in jmeter. So it is getting null. But when I want to convert it to long. It gives null pointer exception.


What I have done?

In DTO file, I just set it as 0. It solves my issue.

    /* locationTimestampDetected */
    private Long ltd = 0l;

jmeter: bash: ./jmeter.sh: Permission denied - Solution procedure

1. chmod a+x /home/rizvi/Jmeter/apache-jmeter-3.0/bin/jmeter.sh
2. ./jmeter.sh

Thursday, January 5, 2017

Java EE projects

https://github.com/eugenp/tutorials

        Enumeration<String> headerNames = request.getHeaderNames();
        while (headerNames.hasMoreElements()) {
            String headerName = headerNames.nextElement();
            String headerValue = request.getHeader(headerName);
            System.out.println("HeaderName: " + headerName + ". Header Value: " + headerValue);
        }