Monday, August 24, 2015

How to add MySQL component in the Tivoli Directory Intregator (TDI).

To support MySQL database in the TDI, You first need to add mysql driver into the TDI

Here are the steps :
  • Download and copy mysql (mysql-connector-java-5.1.23-bin.jar ) jar to the location "${IBM}\TDI\V7.1\jars\3rdparty\others" where IBM is your installation directory
  • Restart TDI if it's running.
  • Click on Add component under AssemblyLines and choose JDBC connector
  • In JDBC URL,  add “jdbc:mysql://<IP>:<PORT>/<DATABASE_NAME>”.
  • in JDBC Driver, add com.mysql.jdbc.Driver
  • Provider correct Username and Password of your database.
  • Select table Name from select button.
  • Click Finish to connect to the MySQL Database.

Friday, June 26, 2015

org.hibernate.HibernateException: No Session found for current thread

I am working one Spring MVC project in which I have integrated Spring with hibernate and most of the time, I use to get this error message while performing database operation ..

org.hibernate.HibernateException: No Session found for current thread

Reason : This is happening because I have missed declaring the transaction in my Spring Application. sessionFacory needs transaction to work.

Solution :

Define transaction manager in your Spring configuration file. Here is my spring-config.xml file :

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${db.driverClassName}" />
<property name="jdbcUrl"
value="jdbc:mysql://${}:${db.port}/${}" />
<property name="user" value="${db.username}" />
<property name="password" value="${db.password}" />

<bean id="sessionFactory"
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="PACKAGE_NAME" />
<property name="hibernateProperties">
<prop key="hibernate.dialect">${db.dialect}</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="">update</prop>

<bean id="dao" class="DAO_IMPL_CLASS.DaoImpl">
<property name="sessionFactory" ref="sessionFactory" />

<tx:annotation-driven transaction-manager="transactionManager" />

<bean id="transactionManager"
<property name="sessionFactory" ref="sessionFactory" />

and Add @Transactional annotation on your service function

public String saveConfiguration(...) {
return "issue_resolved";

I guess, It can be useful to many prople.. Happy Coding..!!!

Friday, May 29, 2015

How to install SVN Client on CENT OS 6

It is quite easy to install SVN Client using YUM command line manage utility on CENT OS 6.

Install :

# yum clean all
# yum install subversion

Verify Subversion

# svn --version


Friday, February 20, 2015

How to generate JavaDoc jar using Maven

The maven-javadoc plugin can be used to generate a javadoc jar file, It uses JDK's javadoc.exe tools to generate javadocs, pack in jar file and deploy along with your project.
To add support of javadoc in your Maven, Just add 'maven-javadoc' plugin into your pom.xml file and specify goal as 'jar'.
Example :
<!-- Generates JAVADOC -->
Run it as mvn:install or mvn:package, It will generate javadoc and package it as a jar file.



Thursday, February 19, 2015

Introduction to Lambda Expression with Examples

Java 8 comes up with one great features called Lambda Expressions. It's first step to the functional programming. With Lambda expression we can treat functionality as method arguments i.e. you can pass a method as argument to another method.
Previously we use to write anonymous class if we wanted to pass some method as argument to another method but with lambda expression, we can pass a plain method as argument. Lambda expressions is a anonymous function i.e. It has arguments, a body and return type.

Syntax of Lambda Expression :
(Argument(s)) → {Body}
Eg :
(int x, int y, int z) - > {return x+y+z};
(String msg) - > {System.out.println(msg);}
() - > { return 100;}

Structure of Lambda Expression :

  • It can have zero, one or more number of parameters.
  • For empty set of parameters, Empty parentheses are used. e.g () -> 100
  • Type of the passed parameter can be explicitly declared or can be taken from context. e.g. (int x) is same as (x).
  • One important difference between anonymous inner class and lambda expression is, if we use ‘this’ it resolves to anonymous class but in the case of lambda expression, it resolves to the enclosing class where lambda is written.
Functional Interfaces :
A functional interface is an interface having one abstract method declared in it. It is similar to Marker interface just Marker interface has no methods or field declaration in it. java.lang.Runnable is one example of functional interface as It has only one method void run().

@FunctionalInterface :
It’s a new annotation which  indicate that an interface type declaration is intended to be a functional interface as defined by the Java Language Specification. As functional Interfaces  can have only one abstract method, If you declare more than one then it will throws compile time error.

Eg :  
Valid Functional interaface

public interface IFunctional1 {
public void display();
Invalid Functional interaface

public interface IFunctional {
public void display();
public void printResult();

It will throw compile time error as @functionalInterface contains two abstract methods.

Examples of Lambda Expression :

package in.techblog.waheed.lambda;

import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;

* This class demostrate few examples of lambda expression
* @author abdul
public class LambdaExample {

* @param args
public static void main(String[] args) {

// ****************Example1********************************//

// Old way of calling..
new Thread(new Runnable() {
public void run() {
System.out.println("Old way of calling..Anonymous.");

// New way of calling....
new Thread(
() -> System.out
.println("New way of calling..Lambda Expression"))

// ****************************Example2******************//

List<Integer> list = Arrays.asList(101, 102, 103, 104, 105, 106, 107);

list.forEach(n -> System.out.print(" " + n));

// Double colon operator, Will cover in next tutorial..

// *****************************Example3*****************//

// Print Even number
System.out.println("\n\nEven numbers:");
evaluate(list, (n) -> n % 2 == 0);

* Evaluate the list on the basis of Predicate function. Check
* .com/javase/8/docs/api/java/util/function/Predicate.html
* @param list
*            list of integer array that need to be evaluated
* @param predicate
*            boolean-valued function
public static void evaluate(List<Integer> list, Predicate<Integer> predicate) {
for (Integer l : list) {
if (predicate.test(l)) {
System.out.println(l + " ");

Please feel free to comment, Suggestion/Feedback are most welcome :)


How TOPT Works: Generating OTPs Without Internet Connection

Introduction Have you ever wondered how authentication apps like RSA Authenticator generate One-Time Passwords (OTPs) without requiring an i...