You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Roger Searjeant <ro...@gmail.com> on 2008/09/16 18:12:30 UTC

Small mistake in

I think there is a small mistake in the bare-bones custom Felix launcher
described on this page:
http://cwiki.apache.org/confluence/display/FELIX/Launching+and+Embedding+Apache+Felix

The variable configMap is re-declared in the try block, when there should be
a second Map (configProps) created from the first.  The changed lines:

      Map configProps = new StringMap(configMap, false);
      m_felix = new Felix(configProps, list);

Now the code will compile and run.

-- Roger Searjeant.

Re: Small mistake in

Posted by Stuart McCulloch <mc...@gmail.com>.
008/9/17 Roger Searjeant <ro...@gmail.com>

> Hope you'll all excuse my ignorance - this is my first day with OSGi and
> Felix.
> How are you supposed to work out the correct version numbers to include in
> configuration properties for bundles?
>
> The wiki sample code referred to earlier in this thread now builds, but
> still doesn't run for me.  The exception messages gave me some clues, and
> it
> turned out that the version numbers in the system package and bundle map
> were (I think) incorrect.  The version numbers in the lines below work for
> me, when I run against Felix v1.2.1:
>
> configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES,
>            "org.osgi.framework; version=1.4.0," +
>            "org.osgi.service.packageadmin; version=1.2.0," +
>            "org.osgi.service.startlevel; version=1.1.0," +
>            "org.osgi.service.url; version=1.0.0");
>
> configMap.put(AutoActivator.AUTO_START_PROP +
>            ".1", // Run level 1
>            "file:bundle/org.apache.felix.shell-1.0.2.jar " +
>            "file:bundle/org.apache.felix.shell.tui-1.0.2.jar");
>
> The exceptions I had been getting with the original code shown on the wiki
> page were (e.g.) "ERROR: Error starting
> file:bundle/org.apache.felix.shell-1.0.2.jar
> (org.osgi.framework.BundleException: Unresolved constraint in bundle 37:
> package...".
>

the instructions on that wiki page are for Felix 1.0.4 using version
1.0.0 of the shell bundles - and this definitely works for me locally
(configMap on the wiki has  ...shell-1.0.0.jar not ...shell-1.0.2.jar)

it looks like the 1.0.2 release of the shell bundles updated their
imports to mandate at least the 1.4 version of the framework api
and 1.1.0 of the startlevel service - IMHO this was an accidental
change, probably due to compiling against the latest framework
when they were released (* see later)

because the 1.0.2 shell bundles mandate the new API versions
then you would need to update the configMap respectively - but
if you use the 1.0.0 shell bundles, as in the wiki example then
no change is required.

* going back to the accidental update of the minimum versions,
this was because the shell bundle poms were updated to build
against the latest framework rather than the minimum level that
they actually need

my personal view is that dependencies should only be updated
if you need something from the new version - but also the BND
instructions in the shell bundle poms should really have explicit
version ranges on their imports, which would have avoided this
accidental bump in the minimum version

Clearly something to do with versions and dependencies.  So I decided to
> look in the Felix config.properties file, and use the numbers I found
> there.  Using those, the code worked.  (So I think the sample needs
> editing,
> for it to work with the current Felix release).
>
> My question is: if you give me a new release of Felix in a jar, how do I
> discover the version numbers of the framework packages it exports?  I tried
> hunting through the manifest files in the jars, but it didn't help.  Where
> should I be looking?  Is it always the case that the f/work jar must be
> accompanied by the config.properties file or some documentation/readme to
> provide the numbers?
>
> OK, now you can tell me which page(s) I should have read.
>
> Cheers,
> Roger Searjeant.
>
>
> On Tue, Sep 16, 2008 at 7:22 PM, Stuart McCulloch <mc...@gmail.com>
> wrote:
>
> > 2008/9/17 Stuart McCulloch <mc...@gmail.com>
> >
> > > 2008/9/17 Roger Searjeant <ro...@gmail.com>
> > >
> > >> I think there is a small mistake in the bare-bones custom Felix
> launcher
> > >> described on this page:
> > >>
> > >>
> >
> http://cwiki.apache.org/confluence/display/FELIX/Launching+and+Embedding+Apache+Felix
> > >>
> > >
> > > I think you're right - looks like a simple copy/paste error from an
> > earlier
> > > example... I'll fix it, thanks for reporting this
> > >
> >
> > done, I also fixed a couple of other minor typos - should be mirrored to
> > the
> > main site in a few hours
> >
> >
> > > The variable configMap is re-declared in the try block, when there
> should
> > >> be
> > >> a second Map (configProps) created from the first.  The changed lines:
> > >>
> > >>      Map configProps = new StringMap(configMap, false);
> > >>      m_felix = new Felix(configProps, list);
> > >>
> > >> Now the code will compile and run.
> > >>
> > >> -- Roger Searjeant.
> > >>
> > >
> > > --
> > > Cheers, Stuart
> > >
> >
> >
> >
> > --
> > Cheers, Stuart
> >
>



-- 
Cheers, Stuart

Re: Small mistake in

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Roger Searjeant wrote:
> My question is: if you give me a new release of Felix in a jar, how do I
> discover the version numbers of the framework packages it exports?  I tried
> hunting through the manifest files in the jars, but it didn't help.  Where
> should I be looking?  Is it always the case that the f/work jar must be
> accompanied by the config.properties file or some documentation/readme to
> provide the numbers?
>   

At this point in time, these version numbers for the exported packages 
are always from a properties file, either conf/config.properties or 
default.properties inside the JAR file itself. This exact procedure will 
likely change in the not-so-distant future, since the next spec will say 
something about this topic.

-> richard

> OK, now you can tell me which page(s) I should have read.
>
> Cheers,
> Roger Searjeant.
>
>
> On Tue, Sep 16, 2008 at 7:22 PM, Stuart McCulloch <mc...@gmail.com> wrote:
>
>   
>> 2008/9/17 Stuart McCulloch <mc...@gmail.com>
>>
>>     
>>> 2008/9/17 Roger Searjeant <ro...@gmail.com>
>>>
>>>       
>>>> I think there is a small mistake in the bare-bones custom Felix launcher
>>>> described on this page:
>>>>
>>>>
>>>>         
>> http://cwiki.apache.org/confluence/display/FELIX/Launching+and+Embedding+Apache+Felix
>>     
>>> I think you're right - looks like a simple copy/paste error from an
>>>       
>> earlier
>>     
>>> example... I'll fix it, thanks for reporting this
>>>
>>>       
>> done, I also fixed a couple of other minor typos - should be mirrored to
>> the
>> main site in a few hours
>>
>>
>>     
>>> The variable configMap is re-declared in the try block, when there should
>>>       
>>>> be
>>>> a second Map (configProps) created from the first.  The changed lines:
>>>>
>>>>      Map configProps = new StringMap(configMap, false);
>>>>      m_felix = new Felix(configProps, list);
>>>>
>>>> Now the code will compile and run.
>>>>
>>>> -- Roger Searjeant.
>>>>
>>>>         
>>> --
>>> Cheers, Stuart
>>>
>>>       
>>
>> --
>> Cheers, Stuart
>>
>>     
>
>   

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


Re: Small mistake in

Posted by Roger Searjeant <ro...@gmail.com>.
Hope you'll all excuse my ignorance - this is my first day with OSGi and
Felix.
How are you supposed to work out the correct version numbers to include in
configuration properties for bundles?

The wiki sample code referred to earlier in this thread now builds, but
still doesn't run for me.  The exception messages gave me some clues, and it
turned out that the version numbers in the system package and bundle map
were (I think) incorrect.  The version numbers in the lines below work for
me, when I run against Felix v1.2.1:

configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES,
            "org.osgi.framework; version=1.4.0," +
            "org.osgi.service.packageadmin; version=1.2.0," +
            "org.osgi.service.startlevel; version=1.1.0," +
            "org.osgi.service.url; version=1.0.0");

configMap.put(AutoActivator.AUTO_START_PROP +
            ".1", // Run level 1
            "file:bundle/org.apache.felix.shell-1.0.2.jar " +
            "file:bundle/org.apache.felix.shell.tui-1.0.2.jar");

The exceptions I had been getting with the original code shown on the wiki
page were (e.g.) "ERROR: Error starting
file:bundle/org.apache.felix.shell-1.0.2.jar
(org.osgi.framework.BundleException: Unresolved constraint in bundle 37:
package...".

Clearly something to do with versions and dependencies.  So I decided to
look in the Felix config.properties file, and use the numbers I found
there.  Using those, the code worked.  (So I think the sample needs editing,
for it to work with the current Felix release).

My question is: if you give me a new release of Felix in a jar, how do I
discover the version numbers of the framework packages it exports?  I tried
hunting through the manifest files in the jars, but it didn't help.  Where
should I be looking?  Is it always the case that the f/work jar must be
accompanied by the config.properties file or some documentation/readme to
provide the numbers?

OK, now you can tell me which page(s) I should have read.

Cheers,
Roger Searjeant.


On Tue, Sep 16, 2008 at 7:22 PM, Stuart McCulloch <mc...@gmail.com> wrote:

> 2008/9/17 Stuart McCulloch <mc...@gmail.com>
>
> > 2008/9/17 Roger Searjeant <ro...@gmail.com>
> >
> >> I think there is a small mistake in the bare-bones custom Felix launcher
> >> described on this page:
> >>
> >>
> http://cwiki.apache.org/confluence/display/FELIX/Launching+and+Embedding+Apache+Felix
> >>
> >
> > I think you're right - looks like a simple copy/paste error from an
> earlier
> > example... I'll fix it, thanks for reporting this
> >
>
> done, I also fixed a couple of other minor typos - should be mirrored to
> the
> main site in a few hours
>
>
> > The variable configMap is re-declared in the try block, when there should
> >> be
> >> a second Map (configProps) created from the first.  The changed lines:
> >>
> >>      Map configProps = new StringMap(configMap, false);
> >>      m_felix = new Felix(configProps, list);
> >>
> >> Now the code will compile and run.
> >>
> >> -- Roger Searjeant.
> >>
> >
> > --
> > Cheers, Stuart
> >
>
>
>
> --
> Cheers, Stuart
>

Re: Small mistake in

Posted by Stuart McCulloch <mc...@gmail.com>.
2008/9/17 Stuart McCulloch <mc...@gmail.com>

> 2008/9/17 Roger Searjeant <ro...@gmail.com>
>
>> I think there is a small mistake in the bare-bones custom Felix launcher
>> described on this page:
>>
>> http://cwiki.apache.org/confluence/display/FELIX/Launching+and+Embedding+Apache+Felix
>>
>
> I think you're right - looks like a simple copy/paste error from an earlier
> example... I'll fix it, thanks for reporting this
>

done, I also fixed a couple of other minor typos - should be mirrored to the
main site in a few hours


> The variable configMap is re-declared in the try block, when there should
>> be
>> a second Map (configProps) created from the first.  The changed lines:
>>
>>      Map configProps = new StringMap(configMap, false);
>>      m_felix = new Felix(configProps, list);
>>
>> Now the code will compile and run.
>>
>> -- Roger Searjeant.
>>
>
> --
> Cheers, Stuart
>



-- 
Cheers, Stuart

Re: Small mistake in

Posted by Stuart McCulloch <mc...@gmail.com>.
2008/9/17 Roger Searjeant <ro...@gmail.com>

> I think there is a small mistake in the bare-bones custom Felix launcher
> described on this page:
>
> http://cwiki.apache.org/confluence/display/FELIX/Launching+and+Embedding+Apache+Felix
>

I think you're right - looks like a simple copy/paste error from an earlier
example... I'll fix it, thanks for reporting this


> The variable configMap is re-declared in the try block, when there should
> be
> a second Map (configProps) created from the first.  The changed lines:
>
>      Map configProps = new StringMap(configMap, false);
>      m_felix = new Felix(configProps, list);
>
> Now the code will compile and run.
>
> -- Roger Searjeant.
>

-- 
Cheers, Stuart