Look closely at the stack trace of the exception. It will tell you exactly in which line of source code the exception happened. Go to your source code and find out what could go wrong there.
The error message means that you were doing something that you can only do while the current thread has a lock on the object you're using - which usually means you must be in a synchronized block. You are probably trying to call a method like wait() or notify() outside a synchronized block.