The problem is not in this code.
A NullPointerException is being thrown from a static initializer method in one of the classes.
Static initializer code is either an assignment to a static variable at the point of declaration. For example:
Or, a block like this:
private static Object someObject = someMethod();
Any exception in code like this prevents the class from initializing, and results in an Error being thrown (and the class becoming unusable).
// some code
A class is initialized the first time you create an instance of it, call one if it's static methods, or access one of it's static variables.