First step is to find out what line of code is throwing the exception. The stack trace will tell you that -- and I see that your code is printing the stack trace for you.
(This isn't a Scala question, so I'm moving it to a better forum.)
30 seconds to difuse a loaf of bread ... here, use this tiny ad: