You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Annies <an...@yahoo.com> on 2008/09/10 22:09:28 UTC

Exact version match using BND

Hi 

I want to my Import-Package to specify an exact version match for a
particular package. 
E.g., Import-Package: foo.bar;version="[1.0.0, 1.0.0]"

When I give the following configuration to the BND maven plugin, 
<Import-Package>foo.bar;version=[1.1.0,1.1.0]</Import-Package>
it generates 
Import-Package: foo.bar;version="[1.1.0",

This leads to an exception during bundle install 
java.lang.NumberFormatException: For input string: "[1"

How should I do this?

Thanks
Annies





-- 
View this message in context: http://www.nabble.com/Exact-version-match-using-BND-tp19422162p19422162.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Exact version match using BND

Posted by Stuart McCulloch <mc...@gmail.com>.
2008/9/12 Annies <an...@yahoo.com>

>
> Thanks Stuart. I missed that one.
>
> With the quotes, I get the proper version in the manifest like this
> javax.transaction;version="[1.1.0,
> 1.1.0]",javax.transaction.xa;version="[1.1.0, 1.1.0]"
>
> However I am facing another (possibly Felix) issue. Is it possible to have
> two copies of a package that have the same major version but different
> minor
> version and choose which one you want to import.
>

that is certainly possible - it's one of the core strengths of OSGi


> For example, take the javax.transaction package. The system bundle exports
> 1.5.0 of javax.transaction and I have another bundle that exports 1.1.0.
>
> In my importing bundle, I am explicitly specifying 1.1.0 as the version
> that
> I want to import.
> However when I try to install it, I get the following WARNING.
>
> DEBUG: Constraint violation for 29.0 detected; module can see
> javax.transaction.xa from [4.0] and javax.transaction.xa from [0]
> WARNING: Unable to resolve bundle 29 (org.osgi.framework.BundleException:
> Unable to resolve due to constraint violation.)
> DEBUG: Constraint violation for 29.0 detected; module can see
> javax.transaction.xa from [4.0] and javax.transaction.xa from [0]
> WARNING: Unable to resolve bundle 29 (org.osgi.framework.BundleException:
> Unable to resolve due to constraint violation.)
>

I just coded up a very quick test and was not able to recreate this error

which version of Felix are you using and how are you starting it - and
do you change any of the framework configuration properties, such as
bootdelegation or the system package list?

could you also post the output of the following console commands:

   packages

   headers 29        (ie. the bundle id from the constraint message)

as this will hopefully help identify the problem...

Thanks
> Annies
>
> Stuart McCulloch wrote:
> >
> > 2008/9/11 Annies <an...@yahoo.com>
> >
> >>
> >> Hi
> >>
> >> I want to my Import-Package to specify an exact version match for a
> >> particular package.
> >> E.g., Import-Package: foo.bar;version="[1.0.0, 1.0.0]"
> >>
> >> When I give the following configuration to the BND maven plugin,
> >> <Import-Package>foo.bar;version=[1.1.0,1.1.0]</Import-Package>
> >
> >
> > you must protect the comma in the version string by adding quotes, for
> > example:
> >
> >    <Import-Package>foo.bar;version="[1.1.0,1.1.0]"</Import-Package>
> >
> > otherwise BND will think the comma is separating two different package
> > clauses
> >
> >
> >> it generates
> >> Import-Package: foo.bar;version="[1.1.0",
> >>
> >> This leads to an exception during bundle install
> >> java.lang.NumberFormatException: For input string: "[1"
> >>
> >> How should I do this?
> >>
> >> Thanks
> >> Annies
> >>
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Exact-version-match-using-BND-tp19422162p19422162.html
> >> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >> For additional commands, e-mail: users-help@felix.apache.org
> >>
> >>
> >
> >
> > --
> > Cheers, Stuart
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Exact-version-match-using-BND-tp19422162p19445080.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
-- 
Cheers, Stuart

Re: Exact version match using BND

Posted by Annies <an...@yahoo.com>.
Thanks Stuart. I missed that one.

With the quotes, I get the proper version in the manifest like this
javax.transaction;version="[1.1.0,
1.1.0]",javax.transaction.xa;version="[1.1.0, 1.1.0]"

However I am facing another (possibly Felix) issue. Is it possible to have
two copies of a package that have the same major version but different minor
version and choose which one you want to import.

For example, take the javax.transaction package. The system bundle exports
1.5.0 of javax.transaction and I have another bundle that exports 1.1.0. 

In my importing bundle, I am explicitly specifying 1.1.0 as the version that
I want to import.
However when I try to install it, I get the following WARNING.

DEBUG: Constraint violation for 29.0 detected; module can see
javax.transaction.xa from [4.0] and javax.transaction.xa from [0]
WARNING: Unable to resolve bundle 29 (org.osgi.framework.BundleException:
Unable to resolve due to constraint violation.)
DEBUG: Constraint violation for 29.0 detected; module can see
javax.transaction.xa from [4.0] and javax.transaction.xa from [0]
WARNING: Unable to resolve bundle 29 (org.osgi.framework.BundleException:
Unable to resolve due to constraint violation.)


Thanks
Annies



Stuart McCulloch wrote:
> 
> 2008/9/11 Annies <an...@yahoo.com>
> 
>>
>> Hi
>>
>> I want to my Import-Package to specify an exact version match for a
>> particular package.
>> E.g., Import-Package: foo.bar;version="[1.0.0, 1.0.0]"
>>
>> When I give the following configuration to the BND maven plugin,
>> <Import-Package>foo.bar;version=[1.1.0,1.1.0]</Import-Package>
> 
> 
> you must protect the comma in the version string by adding quotes, for
> example:
> 
>    <Import-Package>foo.bar;version="[1.1.0,1.1.0]"</Import-Package>
> 
> otherwise BND will think the comma is separating two different package
> clauses
> 
> 
>> it generates
>> Import-Package: foo.bar;version="[1.1.0",
>>
>> This leads to an exception during bundle install
>> java.lang.NumberFormatException: For input string: "[1"
>>
>> How should I do this?
>>
>> Thanks
>> Annies
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Exact-version-match-using-BND-tp19422162p19422162.html
>> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
> 
> 
> -- 
> Cheers, Stuart
> 
> 

-- 
View this message in context: http://www.nabble.com/Exact-version-match-using-BND-tp19422162p19445080.html
Sent from the Apache Felix - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Exact version match using BND

Posted by Stuart McCulloch <mc...@gmail.com>.
2008/9/11 Annies <an...@yahoo.com>

>
> Hi
>
> I want to my Import-Package to specify an exact version match for a
> particular package.
> E.g., Import-Package: foo.bar;version="[1.0.0, 1.0.0]"
>
> When I give the following configuration to the BND maven plugin,
> <Import-Package>foo.bar;version=[1.1.0,1.1.0]</Import-Package>


you must protect the comma in the version string by adding quotes, for
example:

   <Import-Package>foo.bar;version="[1.1.0,1.1.0]"</Import-Package>

otherwise BND will think the comma is separating two different package
clauses


> it generates
> Import-Package: foo.bar;version="[1.1.0",
>
> This leads to an exception during bundle install
> java.lang.NumberFormatException: For input string: "[1"
>
> How should I do this?
>
> Thanks
> Annies
>
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Exact-version-match-using-BND-tp19422162p19422162.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Cheers, Stuart