felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard S. Hall" <he...@ungoverned.org>
Subject Re: How to know what version of the framework is available?
Date Fri, 07 Oct 2011 19:16:22 GMT
On 10/7/11 9:18 AM, Benoît Thiébault wrote:
> Thank you Per-Erik. This is not confusing at all and it fully answered
> my question.
>
> I did "inspect p c 0" and got:

Just an FYI, in the latest Gogo Command (included with framework 4.0), 
the "inspect" command has been changed to work like this:

     inspect <capability | requirement> <namespace> <bundle>

So, if you want to do the equivalent of the above, you would do:

     inspect c osgi.wiring.package 0

You can use wildcards for the namespace, so you can also do:

     inspect c *.package 0

If you wanted to see all capabilities from any namespace, you could do:

     inspect c * 0

Similarly for requirements.

-> richard

> org.apache.felix.framework [0] exports packages:
> ------------------------------------------------
> org.osgi.framework; version=1.5.0
> ...
>
> When I don't set the org.osgi.framework package import version in my
> Maven build, the Maven bundle plugin replaces it by version=[1.6,2.0).
> Which fails at runtime because my felix installation exports the package
> in version 1.5...
>
> This also explains why it works when I set the package import to
> version=[1.3,2.0)
>
> Problem solved
>
> Thanks again
>
> Ben
>
> Le vendredi 07 octobre 2011 à 14:40 +0200, Per-Erik Svensson a écrit :
>> I believe the confusion comes from mixing maven and osgi versioning
>> concepts, coupled with the difference between bundle version and package
>> version.
>>
>> What OSGi sees is
>>
>> A bundle with the name "osgi.core" of version 4.3.0.201102171602
>> A bundle with the name "org.apache.felix.framework" of version 4.0.0
>> Your bundle with the name "org.acme.foo" of version 1.0.0
>>
>> What maven sees is
>>
>> An artifact with the name "org.osgi.core" with the version 4.3.0 (note that
>> this is not the same as the bundle name OR version)
>> An artifact with the name "org.apache.felix.framework" of version 4.0.0
>> (note that this happens to coincide with the bundle name and version)
>> Your bundle with some artifactId (name) and version.
>>
>> Now, these names and versions are different and applies to different
>> systems. The first 3 things above is concerning OSGi, the latter 3 things is
>> only applicable to maven. So, when you see a version number, you need to ask
>> yourself, "what system does this version apply to"? Is it OSGi or Maven or
>> some other versioning system?
>>
>> So, org.apache.felix.framework 4.0.0 is both a bundle name/version and a
>> maven artifact name/version. The maven artifact contain classes and
>> interfaces and a project description file, all used to build the osgi
>> bundle. That osgi bundle contain a manifest file where the name of the
>> bundle, the version of the bundle and the exported/imported packages are
>> declared. One of the exported packages is org.osgi.framework version 1.6.
>>
>> What has happend in your case is that you've likely told Maven to compile
>> your bundle with the dependency org.osgi.core version 4.3.0. When this was
>> done, maven built (with the help of maven-bundle-plugin) a bundle that
>> imports the package org.osgi.framework with version range [1.6, 2.0). You
>> then deployed this bundle into a container that does not export this package
>> in the given range.
>>
>> Maven versions can (loosely) be seen as complie time versions while OSGi
>> versions are runtime versions. They are completely separate and even employ
>> different semantics when it comes to version numbers.
>>
>> This wall of text likely didn't help you much but if you try and separate
>> (in your head) the build system from the deployment time system (maven vs.
>> osgi container) it may help.
>>
>> Regarding your questions about gogo:
>>
>> gogo has commands for inspecting bundles, what packages they export and
>> import. To see what packages that the osgi framework implementation (felix)
>> exports you type
>>
>> inspect p c 0
>> or
>> inspect package capability 0
>>
>> To see what your bundle need in terms of packages you type
>>
>> inspect p r<bundle-id-of-your-bundle>
>> or
>> inspect package requirement<bundle-id-of-your-bundle>
>>
>> You can also grep the results from these commands as in
>>
>> inspect p c 0 | grep org.osgi
>>
>> However, there is no way for gogo (that I know of) to inspect what version
>> the maven artifact is off. Some bundles might not even come from a maven
>> build but from, say, an ant build. Then there is (obviously) no way of
>> knowing the maven artifact version.
>>
>> Hope this... does not confuse you more. :(
>>
>> Regards,
>> Per-Erik Svensson
>>
>> 2011/10/7 Benoît Thiébault<thiebault@artenum.com>
>>
>>> Thank you Richard,
>>>
>>> Ok for the API version. I indeed compile against version 4.3:
>>>
>>> <dependency>
>>>     <groupId>org.osgi</groupId>
>>>     <artifactId>org.osgi.core</artifactId>
>>>     <version>4.3.0</version>
>>> </dependency>
>>>
>>> As I said in my previous post, when I do not set the version in BND, it
>>> crashes.
>>> However, when I configure the framework version like this, it works:
>>>
>>> <Import-Package>
>>>   org.osgi.framework;version="[1.3, 2.0)",
>>> ...
>>> </Import-Package>
>>>
>>> What I find confusing are all these version numbers:
>>> - API: 4.3
>>> - org.osgi.framework: between 1.3 and 2.0
>>> - felix: 4.0
>>>
>>> What is the correspondance between all these numbers? Does Felix 4
>>> supports API 4.3 and exports org.osgi.framework 1.3?
>>> Is there a way to check it (via a gogo command for instance)?
>>>
>>> Kind regards,
>>>
>>> Ben
>>>
>>>
>>> Le mardi 04 octobre 2011 à 20:01 -0400, Richard Hall a écrit :
>>>> Typically the version is inserted by bnd based on the version it compiles
>>>> against. If you are compiling it against R4.3 API and then deploying to
>>> an
>>>> R4.2 framework, then you might see this issue. You should always compile
>>>> against the lowest required version.
>>>>
>>>> ->  richard
>>>>
>>>> 2011/10/4 Benoît Thiébault<thiebault@artenum.com>
>>>>
>>>>> Hi,
>>>>>
>>>>> When starting my bundle, I have the following error:
>>>>>
>>>>> org.osgi.framework.BundleException: Unresolved constraint in bundle
>>>>> org-keridwen-vtk-linux64b [12]: Unable to resolve 12.0: missing
>>>>> requirement [12.0] package;
>>>>> (&(package=org.osgi.framework)(version>=1.6.0)(!(version>=2.0.0)))
>>>>>
>>>>> In the bundle manifest, I have the following entry:
>>>>> <Import-Package>
>>>>> org.osgi.framework,
>>>>> javax.swing.*
>>>>> </Import-Package>
>>>>>
>>>>> The osgi framework is set as an import, but no version is provided.
>>>>> How can I know what version to set here? I guess it depends on my felix
>>>>> install? How do I know what version is exported by the my felix
>>>>> framework?
>>>>>
>>>>> 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
>>>
>>>
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message