views:

453

answers:

1

I want to separate some DLLs from the associated native JNI classes.

Plugins:

  • In plugin A the dlls are placed and loaded when the plugin is loaded.
  • In plugin B (depend on A) the JNI classes are placed which include the native method calls for the DLLs in A.

At runtime i get a UnsatisfiedLinkError because the JNI class can't be found. I try to update the classloader logic by updating the MANIFEST files:

Plugin A:

Eclipse-BuddyPolicy: registered

Plugin B:

Eclipse-RegisterBuddy: A

But this is also not working. Do you know a solution?

EDIT:

MANIFEST A:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: xxx ;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: xxx.Plugin
Bundle-Vendor: xxx
Bundle-Localization: plugin
Bundle-NativeCode: native/dll/x1.dll;
 native/dll/x2.dll;
 native/dll/x3.dll;
 native/dll/x4.dll;
 native/dll/x5.dll;
 native/dll/x76.dll;
 native/dll/x.dll;
 native/dll/x7.dll;osname = win32; processor = x86
Require-Bundle: org.eclipse.core.runtime,
 org.eclipse.ui,
 org.apache.commons.logging
Bundle-ClassPath: .
Eclipse-AutoStart: true
Eclipse-LazyStart: true
Bundle-ActivationPolicy: lazy
Eclipse-BuddyPolicy: registered
Export-Package: xxx

MANIFEST B:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: xxx;singleton:=true
Bundle-Version: 2.1.16
Bundle-Vendor: xxx
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
 org.eclipse.ui,
 org.apache.commons.lang,
 org.apache.commons.logging,
 A
Export-Package: xxx
Bundle-ClassPath: .
Bundle-Activator: xxx
Eclipse-RegisterBuddy: A
Eclipse-AutoStart: true
Eclipse-LazyStart: true
Bundle-ActivationPolicy: lazy
+1  A: 

My immediate suggestion is to turn plugin B into a fragment for plugin A rather than a separate plugin, which would eliminate the issues.

That said, I think you have your manifests switched; plugin B which is attempting to perform the JNI calls should have Eclipse-BuddyPolicy:registered, and plugin A should be depending on and registering with plugin B.

That said, after reading the buddyloading docs, I'm not certain that the buddyloading policy works for non-Java class files.

Chamelaeon
I will try to put the dlls in a fragment and try it again. Thanks.
Markus Lausberg
The fragment is working. The consequence is that i have to re-structure my project features, but this should be the smalest issue.
Markus Lausberg
You're welcome. I'm glad it works!
Chamelaeon