That is waaay too much code for us to wade through. Please shorten it to an SSCCE that demonstrates the problem in as few lines as possible.

Did you google the exception? A NPE is thrown when you...