Your original post said it was hanging and timing out. Your latest post says that you are getting a null pointer exception. Can you please tell us what is actually happening instead of changing the issue each time.
For the null pointer exception, have you tried debugging it to see which obect is null?