I've done some research and found interesting things.

1 : For my example to work, I should have put

<Bundle-NativeCode>LcdTimer.dll;osname=WindowsXP;processor=x86</Bundle-NativeCode>.

Can we say that the parameters osname and processor are, among the all
others, the only mandatory ones? Or does OSGi framework simply needs a
non-ambiguous clause?

2 : OSGi r4 clearly stats that the osname Win32 is an alias for all windows
platforms. Felix does not accept this alias. For my case to work, using
felix 1.0.1, I need to use exactly osname=WindowsXP (beware of case
sensitivity!).

Have Felix guys envisaged to strictly comply to OSGi r4 specs? Due to the
context of this question, I'm only talking about Bundle-NativeCode
parameters. 

Page 93 of the r4 specs, there's a listing of all the parameter values &
aliases defined by the OSGi alliance.

Cheers all,

Elvy.


Elvy wrote:
> 
> Hi all,
> 
> I need to load .dll or .so libraries but I just don't succeed. Let's focus
> on the windows platform for the moment.
> 
> my pom looks like this, for the maven-bundle-plugin:
> __
> <plugin>
>                 <groupId>org.apache.felix</groupId>
>                 <artifactId>maven-bundle-plugin</artifactId>
>                 <version>1.1.0-SNAPSHOT</version>
>                 <extensions>true</extensions>
>                 <configuration>
>                     <instructions>
>                         <Bundle-Name>Ted</Bundle-Name>
>                         <Bundle-Version>${pom.version}</Bundle-Version>
>                        
> <Private-Package>com.thalesgroup.ted</Private-Package>
>                         <Export-Package>
>                             com.thalesgroup.ted.openapi.*;version:=0.1,
>                             com.jidesoft.*;version:=2.2.1.05,
>                             org.apache.log4j.*;version:=1.2.14
>                         </Export-Package>
>                         <Import-Package>
>                             *;resolution:=optional,
>                         </Import-Package>
>                        
> <Embed-Dependency>*;scope=compile|runtime;inline=false</Embed-Dependency>
>                         <Embed-Transitive>true</Embed-Transitive>
>                        
> <Bundle-Activator>com.thalesgroup.ted.TedActivator</Bundle-Activator>
>                        
> <Include-Resource>native/win32/LcdTimer.dll</Include-Resource>
>                         <Bundle-NativeCode>
>                             /LcdTimer.dll
>                         </Bundle-NativeCode>
>                     </instructions>
>                 </configuration>
>             </plugin>
> __
>  
> I checked the resulting jar and it does contain the .dll in the root
> directory.
> 
> When ran in Felix, and I get the following...
> __
> Welcome to Felix.
> =================
> 
> org.osgi.framework.BundleException: Unable to select a native library
> clause.
>         at
> org.apache.felix.framework.util.manifestparser.ManifestParser.getSelectedLibraryClause(ManifestParser.java:337)
>         at
> org.apache.felix.framework.util.manifestparser.ManifestParser.getLibraries(ManifestParser.java:294)
>         at org.apache.felix.framework.Felix.createModule(Felix.java:3351)
>         at
> org.apache.felix.framework.Felix.createBundleInfo(Felix.java:3277)
>         at org.apache.felix.framework.Felix.installBundle(Felix.java:2231)
>         at org.apache.felix.framework.Felix.installBundle(Felix.java:2145)
>         at
> org.apache.felix.framework.Felix.processAutoProperties(Felix.java:3667)
>         at org.apache.felix.framework.Felix.start(Felix.java:803)
>         at org.apache.felix.main.Main.main(Main.java:195)
> ERROR: Auto-properties install. (org.osgi.framework.BundleException: Could
> not create bundle object.)
> org.osgi.framework.BundleException: Unable to select a native library
> clause.
>         at
> org.apache.felix.framework.util.manifestparser.ManifestParser.getSelectedLibraryClause(ManifestParser.java:337)
>         at
> org.apache.felix.framework.util.manifestparser.ManifestParser.getLibraries(ManifestParser.java:294)
>         at org.apache.felix.framework.Felix.createModule(Felix.java:3351)
>         at
> org.apache.felix.framework.Felix.createBundleInfo(Felix.java:3277)
>         at org.apache.felix.framework.Felix.installBundle(Felix.java:2231)
>         at org.apache.felix.framework.Felix.installBundle(Felix.java:2145)
>         at
> org.apache.felix.framework.Felix.processAutoProperties(Felix.java:3667)
>         at org.apache.felix.framework.Felix.start(Felix.java:803)
>         at org.apache.felix.main.Main.main(Main.java:195)
> org.osgi.framework.BundleException: Unable to select a native library
> clause.
>         at
> org.apache.felix.framework.util.manifestparser.ManifestParser.getSelectedLibraryClause(ManifestParser.java:337)
>         at
> org.apache.felix.framework.util.manifestparser.ManifestParser.getLibraries(ManifestParser.java:294)
>         at org.apache.felix.framework.Felix.createModule(Felix.java:3351)
>         at
> org.apache.felix.framework.Felix.createBundleInfo(Felix.java:3277)
>         at org.apache.felix.framework.Felix.installBundle(Felix.java:2231)
>         at org.apache.felix.framework.Felix.installBundle(Felix.java:2145)
>         at
> org.apache.felix.framework.Felix.processAutoProperties(Felix.java:3699)
>         at org.apache.felix.framework.Felix.start(Felix.java:803)
>         at org.apache.felix.main.Main.main(Main.java:195)
> ERROR: Auto-properties start. (org.osgi.framework.BundleException: Could
> not create bundle object.)
> org.osgi.framework.BundleException: Unable to select a native library
> clause.
>         at
> org.apache.felix.framework.util.manifestparser.ManifestParser.getSelectedLibraryClause(ManifestParser.java:337)
>         at
> org.apache.felix.framework.util.manifestparser.ManifestParser.getLibraries(ManifestParser.java:294)
>         at org.apache.felix.framework.Felix.createModule(Felix.java:3351)
>         at
> org.apache.felix.framework.Felix.createBundleInfo(Felix.java:3277)
>         at org.apache.felix.framework.Felix.installBundle(Felix.java:2231)
>         at org.apache.felix.framework.Felix.installBundle(Felix.java:2145)
>         at
> org.apache.felix.framework.Felix.processAutoProperties(Felix.java:3699)
>         at org.apache.felix.framework.Felix.start(Felix.java:803)
>         at org.apache.felix.main.Main.main(Main.java:195)
> DEBUG: WIRE: 1.0 -> org.ungoverned.osgi.service.shell -> 1.0
> DEBUG: WIRE: 1.0 -> org.osgi.service.startlevel -> 0
> DEBUG: WIRE: 1.0 -> org.apache.felix.shell -> 1.0
> DEBUG: WIRE: 1.0 -> org.osgi.framework -> 0
> DEBUG: WIRE: 1.0 -> org.osgi.service.packageadmin -> 0
> DEBUG: WIRE: 2.0 -> org.apache.felix.shell -> 1.0
> DEBUG: WIRE: 2.0 -> org.osgi.framework -> 0
> -> DEBUG: WIRE: 3.0 -> org.osgi.framework -> 0
> DEBUG: WIRE: 3.0 -> org.osgi.service.obr -> 3.0
> DEBUG: WIRE: 3.0 -> org.apache.felix.shell -> 1.0
> __
> 
> Do I need to explicitly configure RuntimePermission[loadLibrary.<library
> name>] as it is said in the OSGi r4 core specification (page 58 of the
> pdf).
> 


-----
Tell me something you don't know!
-- 
View this message in context: 
http://www.nabble.com/Bundle-NativeCode%2C-how-to...-tp14337619p14338665.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to