You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by João Assunção <jo...@exploitsys.com> on 2022/11/22 17:16:43 UTC

How can one use a third party feature as a startup feature.

Hello all,

I created a custom persistence manager for ConfigAdmin that stores config
properties in a SQL database.
I'm using a custom karaf distro and apparently for my bunde to work it
needs to be listed as a startup bundle, at least when starting karaf for
the first time.
Because my bundle requires JDBC, I need to include the JDBC driver and
"org.osgi.service.jdbc".
...
   <startupBundles>

<startupBundle>mvn:org.osgi/org.osgi.service.jdbc/1.0.0</startupBundle>
      <startupBundle>mvn:org.postgresql/postgresql/42.2.8</startupBundle>

<startupBundle>mvn:com.joaoassuncao.osgi-utils/configadmin-sql-persistence/1.0.2-SNAPSHOT</startupBundle>
   </startupBundles>
..

I wanted to avoid the direct use of bundles and use startupFeatures
instead. Unfortunately, I only managed to make it work when the startup
feature is only of those "core" ones, for example, the eventadmin one.
If I specify pax-jdbc-postgresql as a startup feature its bundles are not
included. I tried to include pax-jdbc-features as a startup repository but
this didn't do it.

Any ideas ?

Thank you in advance.
Best regards,

João Assunção

Re: How can one use a third party feature as a startup feature.

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

Glad it works ;)

Regards
JB

On Tue, Nov 22, 2022 at 11:19 PM João Assunção
<jo...@exploitsys.com> wrote:
>
> Hello JB
>
> After your reply I rechecked my pom and found the reason the feature was not being picked up as a startupFeature. I still had an entry for "pax-jdbc-postgresql" in my bootFeatures. As soon as I removed it, the postgresql driver and org.osgi.service.jdbc bundles were added to startup.properties.
> For this to work I previously changed the scope of org.apache.karaf.features/enterprise from runtime to compile.
> Thank you 👍
>
> Regards
> João Assunção
>
> Email: joao.assuncao@exploitsys.com
> Mobile: +351 916968984
> Phone: +351 211933149
> Web: www.exploitsys.com
>
>
>
>
> On Tue, Nov 22, 2022 at 8:58 PM Jean-Baptiste Onofré <jb...@nanthrax.net> wrote:
>>
>> Hi
>>
>> how did you define the feature ? via dependency (with which scope) or
>> via maven config ?
>>
>> Regards
>> JB
>>
>> On Tue, Nov 22, 2022 at 6:16 PM João Assunção
>> <jo...@exploitsys.com> wrote:
>> >
>> > Hello all,
>> >
>> > I created a custom persistence manager for ConfigAdmin that stores config properties in a SQL database.
>> > I'm using a custom karaf distro and apparently for my bunde to work it needs to be listed as a startup bundle, at least when starting karaf for the first time.
>> > Because my bundle requires JDBC, I need to include the JDBC driver and "org.osgi.service.jdbc".
>> > ...
>> >    <startupBundles>
>> >       <startupBundle>mvn:org.osgi/org.osgi.service.jdbc/1.0.0</startupBundle>
>> >       <startupBundle>mvn:org.postgresql/postgresql/42.2.8</startupBundle>
>> >       <startupBundle>mvn:com.joaoassuncao.osgi-utils/configadmin-sql-persistence/1.0.2-SNAPSHOT</startupBundle>
>> >    </startupBundles>
>> > ..
>> >
>> > I wanted to avoid the direct use of bundles and use startupFeatures instead. Unfortunately, I only managed to make it work when the startup feature is only of those "core" ones, for example, the eventadmin one.
>> > If I specify pax-jdbc-postgresql as a startup feature its bundles are not included. I tried to include pax-jdbc-features as a startup repository but this didn't do it.
>> >
>> > Any ideas ?
>> >
>> > Thank you in advance.
>> > Best regards,
>> >
>> > João Assunção
>> >
>> >

Re: How can one use a third party feature as a startup feature.

Posted by João Assunção <jo...@exploitsys.com>.
Hello JB

After your reply I rechecked my pom and found the reason the feature was
not being picked up as a startupFeature. I still had an entry for
"pax-jdbc-postgresql" in my bootFeatures. As soon as I removed it,
the postgresql driver and org.osgi.service.jdbc bundles were added to
startup.properties.
For this to work I previously changed the scope
of org.apache.karaf.features/enterprise from runtime to compile.
Thank you 👍

Regards
João Assunção

Email: joao.assuncao@exploitsys.com
Mobile: +351 916968984
Phone: +351 211933149
Web: www.exploitsys.com




On Tue, Nov 22, 2022 at 8:58 PM Jean-Baptiste Onofré <jb...@nanthrax.net>
wrote:

> Hi
>
> how did you define the feature ? via dependency (with which scope) or
> via maven config ?
>
> Regards
> JB
>
> On Tue, Nov 22, 2022 at 6:16 PM João Assunção
> <jo...@exploitsys.com> wrote:
> >
> > Hello all,
> >
> > I created a custom persistence manager for ConfigAdmin that stores
> config properties in a SQL database.
> > I'm using a custom karaf distro and apparently for my bunde to work it
> needs to be listed as a startup bundle, at least when starting karaf for
> the first time.
> > Because my bundle requires JDBC, I need to include the JDBC driver and
> "org.osgi.service.jdbc".
> > ...
> >    <startupBundles>
> >
>  <startupBundle>mvn:org.osgi/org.osgi.service.jdbc/1.0.0</startupBundle>
> >       <startupBundle>mvn:org.postgresql/postgresql/42.2.8</startupBundle>
> >
>  <startupBundle>mvn:com.joaoassuncao.osgi-utils/configadmin-sql-persistence/1.0.2-SNAPSHOT</startupBundle>
> >    </startupBundles>
> > ..
> >
> > I wanted to avoid the direct use of bundles and use startupFeatures
> instead. Unfortunately, I only managed to make it work when the startup
> feature is only of those "core" ones, for example, the eventadmin one.
> > If I specify pax-jdbc-postgresql as a startup feature its bundles are
> not included. I tried to include pax-jdbc-features as a startup repository
> but this didn't do it.
> >
> > Any ideas ?
> >
> > Thank you in advance.
> > Best regards,
> >
> > João Assunção
> >
> >
>

Re: How can one use a third party feature as a startup feature.

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi

how did you define the feature ? via dependency (with which scope) or
via maven config ?

Regards
JB

On Tue, Nov 22, 2022 at 6:16 PM João Assunção
<jo...@exploitsys.com> wrote:
>
> Hello all,
>
> I created a custom persistence manager for ConfigAdmin that stores config properties in a SQL database.
> I'm using a custom karaf distro and apparently for my bunde to work it needs to be listed as a startup bundle, at least when starting karaf for the first time.
> Because my bundle requires JDBC, I need to include the JDBC driver and "org.osgi.service.jdbc".
> ...
>    <startupBundles>
>       <startupBundle>mvn:org.osgi/org.osgi.service.jdbc/1.0.0</startupBundle>
>       <startupBundle>mvn:org.postgresql/postgresql/42.2.8</startupBundle>
>       <startupBundle>mvn:com.joaoassuncao.osgi-utils/configadmin-sql-persistence/1.0.2-SNAPSHOT</startupBundle>
>    </startupBundles>
> ..
>
> I wanted to avoid the direct use of bundles and use startupFeatures instead. Unfortunately, I only managed to make it work when the startup feature is only of those "core" ones, for example, the eventadmin one.
> If I specify pax-jdbc-postgresql as a startup feature its bundles are not included. I tried to include pax-jdbc-features as a startup repository but this didn't do it.
>
> Any ideas ?
>
> Thank you in advance.
> Best regards,
>
> João Assunção
>
>