I've been bit by that error too and still haven't figured out what the problem is. In my case it happens with an application using JNI and a third party API, so I suspect it has something to do with native calls.
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher