Version 2

    You cannot hotdeploy JNI (unless your OS that has support for loading a dll into a process twice).

     

    The native library is attachded to the classloader which is thrown away by hot deployment, but not removed until garbage collection.

     

    When you deploy the "new" native library in the new classloader it will fail because the symbols are still present from the old classloader (which hasn't been garbage collected).

     

    What you need to do is statically deploy the JNI part, then reference it from your EAR. i.e. make it so the class that contains native methods is not redeployed with the EAR and is thus not a part of its classloader.