Create web Services using java which uses JNI
===

I want to build an image processing server which takes base64 String as an input and gives resultant output. I implemented my program in c++, and using JAVA web services for server, and when I make the JNI bridge and call c++ function the Glassfish and apache tomcat server crash.
But if I run that program in JAVA without web services that programs runs correctly.