Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » JNI UnsatisfiedLinkError for native function of inner class that works in non-OSGi environment
JNI UnsatisfiedLinkError for native function of inner class that works in non-OSGi environment [message #510818] Thu, 28 January 2010 17:41 Go to next message
Philipp Kursawe is currently offline Philipp Kursawe
Messages: 135
Registered: July 2009
Senior Member
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:

java.lang.UnsatisfiedLinkError:
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
signature.
Other cases where inner classes are implemented in JNI work just fine.

Any ideas?
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 Go to previous message
Philipp Kursawe is currently offline Philipp Kursawe
Messages: 135
Registered: July 2009
Senior Member
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:
>
> java.lang.UnsatisfiedLinkError:
> 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
> signature.
> 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
classloader problem.
Previous Topic:custom touchpoint action troubles
Next Topic:Hook into System.loadLibrary or Bundle.findEntry
Goto Forum:
  


Current Time: Sun Oct 26 06:58:05 GMT 2014

Powered by FUDForum. Page generated in 0.01637 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software