This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
NullPointerExceptions are most of the time easy to track down and fix. Look at the stack trace that you get from the exception. It tells you exactly in which source file, and which line of code, the exception happens. Go to that spot in your source code and find out what could be null there that is not supposed to be null.
The most common causes of a NullPointerException are trying to call a method on a variable that is null or trying to access a member variable while the variable that refers to the object is null.
The outline of your code that you posted doesn't give enough information to help you with this problem.