26 Oct

Tomcat load balancing with Apache using mod proxy

Configuring Tomcat Load Balancing with Apache webserver (http server) using Mod Proxy is very simple. I have listed here the following steps on how to configure Apache with Tomcat to configure Load Balancer using Mod Proxy.

Having load-balanced is always recommended in production environment for better availability. Read More

10 Oct

Solving Josephus problem using Java

The Josephus problem (or Josephus permutation) is a theoretical problem related to a certain counting-out game.

People are standing in a circle waiting to be executed. Counting begins at a specified point in the circle and proceeds around the circle in a specified direction. After a specified number of people are skipped, the next person is executed. The procedure is repeated with the remaining people, starting with the next person, going in the same direction and skipping the same number of people, until only one person remains, and is freed.

For more information you can read https://en.wikipedia.org/wiki/Josephus_problem

Read More

07 Oct

Tic-tac-toe game using Java

Tic-tac-toe (also known as noughts and crosses or Xs and Os) is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row wins the game.

For more information on tic-tac-toe please read https://en.wikipedia.org/wiki/Tic-tac-toe

Read More

23 Sep

Creating and Building Jobs in Jenkins

Here I will show you how to create and build jobs in Jenkins. As a prerequisite please read Configuring JDK, GIT and Maven


Already have Jenkins setup in Windows

Already have Jenkins configured with JDK, GIT and Maven

Already have sample java project in your Git repository (either in local or remote repository)

Read More

18 Sep

Manage Jenkins – Configuring JDK, GIT and Maven

Here I will show you how to configure Jenkins with JDK, GIT and Maven installations. If you need to know setup of Jenkins then please read http://www.jeejava.com/jenkins-setup-in-windows/

Read More

08 Sep

Jenkins Setup in Windows

Jenkins is the leading open source automation server, Jenkins provides hundreds of plugins to support building, deploying and automating any project.

  • Jenkins is a self-contained Java-based program, ready to run out-of-the-box, with packages for Windows, Mac OS X and other Unix-like operating systems.
  • Jenkins can be easily set up and configured via its web interface, which includes on-the-fly error checks and built-in help.
  • As an extensible automation server, Jenkins can be used as a simple CI server or turned into the continuous delivery hub for any project.
  • With hundreds of plugins in the Update Center, Jenkins integrates with practically every tool in the continuous integration and continuous delivery toolchain.
  • Jenkins can be extended via its plugin architecture, providing nearly infinite possibilities for what Jenkins can do.
  • Jenkins can easily distribute work across multiple machines, helping drive builds, tests and deployments across multiple platforms faster.

Read More

30 Aug

Spring Data JPA Entity Graphs

One of the important features in JPA 2.1 is the ability to specify fetch plans using Entity Graphs. This is useful since it allows you to customize the data that is retrieved with a query or find operation. It is expected to display data from the same entity in different and several ways when working with mid to large size applications. In other cases, you just need to select a smallest set of information to optimize the performance of your application.

Typically you do not have many mechanisms to control what is loaded or what is not loaded in a JPA Entity. You could use EAGER/LAZY fetching, but these definitions are pretty much static. You are unable to change their behaviour at runtime when retrieving data, meaning that you are stuck with what was defined in the entity. Changing these amid development is a nightmare, since it can cause queries to behave unexpectedly. Another way to control loading is to write specific JPQL queries. Read More

13 Aug

TDD – Test Driven Development

Test-driven development is related to the test-first programming concepts of extreme programming(https://en.wikipedia.org/wiki/Extreme_programming).

Life cycle of test-driven development

1. Write a test
2. Run the written test
3. Write code that corrects the failing test
4. Clean up your code
5. Go to step 1. Read More

02 Aug

Junit Testing Spring REST Services

In this tutorial we will see how to write Junit test cases on Spring REST services. Before continue to reading this tutorial please read first Spring RESTful Webservice CRUD Example

We have total four operations on this REST example. If you want you may add more operation such as find all products and apply Junit on it.

Read More