That's not enough code to judge your problem. If you want help with code, provide an SSCCE that demonstrates the problem.

Also, a quick google of your exception should give you some hints.