|Re: JNI UnsatisfiedLinkError for native function of inner class that works in non-OSGi environment [message #510980 is a reply to message #510818]
||Fri, 29 January 2010 12:18
| Philipp Kursawe
Registered: July 2009
On 1/28/2010 18:41 PM, Philipp Kursawe wrote:|
> I have this strange problem:
> The native lib exports this win32 __stdcall function:
> Java_com_test_jni_common_RecomCppFileInfo_00024JNI_RecomFile InfoCreate__Ljava_lang_String_2ZZZZZZ @36
> In a normal Java Environment this works as expected. However when
> porting the app to OSGi I get:
> com.test.jni.common.RecomCppFileInfo$JNI.RecomFileInfoCreate (Ljava/lang/String;ZZZZZZ)J
> The native lib was loaded into the process and other native functions
> can be called just fine. It seems to be some problem with the function
> Other cases where inner classes are implemented in JNI work just fine.
> Any ideas?
The reason why it not worked was classloaded related.
The native was loaded in bundle "a" and bundle "b" subclassed a class
from "a" and called a native method that was implemented in the base
class in "a". After moving the class from "b" to "a" the native method
could be called. Unfortunately there was no way that the VM would help
in debugging this issue. It could very well print out that there is a
Powered by FUDForum
. Page generated in 0.01637 seconds