"bhandsaker" wrote : I was on the right track in what I wrote above. I finally
found the
| following reference in the JNI spec
| (
http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/design.html):
|
| anonymous wrote : "The programmer may use a single library to store all the
native methods
| | needed by any number of classes, as long as these classes are to be
| | loaded with the same class loader. The VM internally maintains a list
| | of loaded native libraries for each class loader. Vendors should choose
| | native library names that minimize the chance of name clashes."
|
| The key point here is "same class loader". Not a parent, not a child:
| Same class loader.
|
| We have resolved this problem by loading the native libraries from an MBean
| and then invoking code during the initialization of the MBean that loads the
| library *and* touches each class that uses native methods, forcing the classes
| to be loaded by the MBean class loader. Once we do this, everything works
| correctly.
|
| Note that if you do not force a class with native methods to be loaded by the
| MBean, it will be successfully loaded later by a different class loader,
| (for example, an EJB class loader), but the native methods will not be visible.
|
| One side effect of this solution is that we cannot hot deploy the classes
| with the native methods and our code that calls them. We could perhaps
| achieve some level of hot deployment if we carefully separated our code,
| but we didn't try.
|
|
How do you force the class loading?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3980320#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...