You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by th...@artenum.com on 2011/09/10 11:49:35 UTC
OSGi application deployment and Felix auto-deploy problem
Hi everyone,
I am currently developing an OSGi desktop application and I would like some advice and/or feedback on the release process that I put in place.
The project is a multi-modules Maven project, where each modules generates an OSGi bundle (with BND and for some bundles iPOJO).
In addition, I have an Ant script controlling Maven with Maven Ant Tasks and I have a special release target that automatically performs the following actions:
1) It first calls "mvn install" that generates the bundle in each target directory of the modules
2) It creates a "release" directory named after the SVN revision number and 4 sub-directories: linux32b, linux64b, osx64b and win32b
3) It unzips Felix framework in each of the release directories (its a light version of Felix, with only the OBR bundle in the "bundle" directory)
4) It copies all modules bundles in the "bundle" directory of the Felix framework. I have some of my bundles using native code (for 3d visualisation for instance). They are named my-bundle-platform-version.jar,
where platform takes the values linux32b, linux64b, osx64b and win32b. The Ant script thus only copies the bundle for the required platform in each directory
5) It copies the execution scripts (.sh for Linux/OSX, .bat for Windows) for each platform in each directory (ultimately, I will have .exe and .app respectively for Windows and Mac, but one step at a time)
6) I can then zip (manually or with Ant) each release directory and distribute them to my users depending on their platform.
My questions are the following:
A) My first problem is with the automatic bundle deployment from Felix.
In a first attempt, I only deployed two bundles that are (for example for Linux 64 bits) :
- org-test-sample-view3d-0.0.1.jar
- org-test-view3d-linux64b-0.0.1.jar
org-test-sample-view3d-0.0.1.jar imports the Java wrapping of the native library while org-test-view3d-linux64b-0.0.1.jar exports it (and calls the System.loadLibrary method in its BundleActivator).
The problem is that when Felix is launched, it installs and starts the bundle org-test-sample-view3d-0.0.1.jar first, resulting in an UnsatisfiedLinkError. When I rename org-test-sample-view3d-0.0.1.jar to org-test-
xsample-view3d-0.0.1.jar, then Felix installs and starts org-test-view3d-linux64b-0.0.1.jar first and everything works perfectly.
Is this normal behavior (starting jars in alphabetical order)? Do I really have to play with start levels? I thought OSGi would be smart enough to launch first the bundles providing the function and then the one
requiring it.
B) The whole process is a bit rigid. I know I could have performed all the Ant actions with Maven assembly plugin, but it is less flexible than Ant (regarding naming and positioning of the output and SVN revision
checking) and slower (I tried both in fact).
The problem is at step 4): sometimes, I just want to deploy a certain number of bundles (says, the 3d visualization ones) and sometimes only the 2d visualization for instance. This smells a lot like configuring
different OBR to me, but I'm not sure to know how. Is there a way to automate this with Ant (or Maven)?
Kind regards
Ben
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: OSGi application deployment and Felix auto-deploy problem
Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 9/10/11 5:49 AM, thiebault@artenum.com wrote:
> Hi everyone,
>
> I am currently developing an OSGi desktop application and I would like some advice and/or feedback on the release process that I put in place.
>
> The project is a multi-modules Maven project, where each modules generates an OSGi bundle (with BND and for some bundles iPOJO).
>
> In addition, I have an Ant script controlling Maven with Maven Ant Tasks and I have a special release target that automatically performs the following actions:
>
> 1) It first calls "mvn install" that generates the bundle in each target directory of the modules
> 2) It creates a "release" directory named after the SVN revision number and 4 sub-directories: linux32b, linux64b, osx64b and win32b
> 3) It unzips Felix framework in each of the release directories (its a light version of Felix, with only the OBR bundle in the "bundle" directory)
> 4) It copies all modules bundles in the "bundle" directory of the Felix framework. I have some of my bundles using native code (for 3d visualisation for instance). They are named my-bundle-platform-version.jar,
> where platform takes the values linux32b, linux64b, osx64b and win32b. The Ant script thus only copies the bundle for the required platform in each directory
> 5) It copies the execution scripts (.sh for Linux/OSX, .bat for Windows) for each platform in each directory (ultimately, I will have .exe and .app respectively for Windows and Mac, but one step at a time)
> 6) I can then zip (manually or with Ant) each release directory and distribute them to my users depending on their platform.
>
> My questions are the following:
>
> A) My first problem is with the automatic bundle deployment from Felix.
>
> In a first attempt, I only deployed two bundles that are (for example for Linux 64 bits) :
> - org-test-sample-view3d-0.0.1.jar
> - org-test-view3d-linux64b-0.0.1.jar
>
> org-test-sample-view3d-0.0.1.jar imports the Java wrapping of the native library while org-test-view3d-linux64b-0.0.1.jar exports it (and calls the System.loadLibrary method in its BundleActivator).
>
> The problem is that when Felix is launched, it installs and starts the bundle org-test-sample-view3d-0.0.1.jar first, resulting in an UnsatisfiedLinkError. When I rename org-test-sample-view3d-0.0.1.jar to org-test-
> xsample-view3d-0.0.1.jar, then Felix installs and starts org-test-view3d-linux64b-0.0.1.jar first and everything works perfectly.
>
> Is this normal behavior (starting jars in alphabetical order)? Do I really have to play with start levels? I thought OSGi would be smart enough to launch first the bundles providing the function and then the one
> requiring it.
The order is whatever order returned by File.listFiles(), I would guess.
The bundles are not installed and started one at a time, they are all
installed, then all started. This ensures that any code-level
dependencies (i.e., Import-Package) will be satisfied properly. This
doesn't help service-level dependencies, which have to be handled by the
bundles themselves (or something like iPOJO).
If you are not getting a resolve exception, then your code-level
dependencies are properly satisfied. Just a guess, are you doing your
load library in your activator start() method? If so, perhaps you should
try to do it in a static block instead or else make the bundle lazily
activated so it will be started automatically on first class load.
-> richard
>
> B) The whole process is a bit rigid. I know I could have performed all the Ant actions with Maven assembly plugin, but it is less flexible than Ant (regarding naming and positioning of the output and SVN revision
> checking) and slower (I tried both in fact).
>
> The problem is at step 4): sometimes, I just want to deploy a certain number of bundles (says, the 3d visualization ones) and sometimes only the 2d visualization for instance. This smells a lot like configuring
> different OBR to me, but I'm not sure to know how. Is there a way to automate this with Ant (or Maven)?
>
> Kind regards
>
> Ben
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org