Define Deployment Sequence of Activator Bundles in Karaf

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Define Deployment Sequence of Activator Bundles in Karaf

Kirti Arora
Hello,

I am new to Karaf. I have three bundles in my Karaf_Home/deploy directory and 
bundles are dependent on each other. So, I want to define a specific sequence of 
bundle deployment in Karaf to avoid runtime ClassNotFoundException.

Can someone please guide me, how can I define bundle deployment sequence in Karaf?

Thanks,
Kirti Arora
Reply | Threaded
Open this post in threaded view
|

Re: Define Deployment Sequence of Activator Bundles in Karaf

duan2ping
This post was updated on .
Hi Kirti Arora!

You can look at the features in karaf.Define a set of Bundles as follows and
configure start-level based on their dependencies, then use feature:install
xxx.xml to install a feature.Hope this helps you!

http://karaf.apache.org/manual/latest/#_feature_bundles

 <feature name="my-project" version="1.0.0">
    <bundle
start-level="80">mvn:com.mycompany.myproject/myproject-dao</bundle>
    <bundle
start-level="85">mvn:com.mycompany.myproject/myproject-service</bundle>
  </feature>

Regards
duan



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: Define Deployment Sequence of Activator Bundles in Karaf

Kirti Arora
Hi Duan,

Thanks for the reply.
Yes, I saw this approach. Can you please tell me the location of the feature xml file or where can I define the features?

Thanks,
Kirti Arora

On Tue, Nov 5, 2019 at 4:11 PM duan2ping <[hidden email]> wrote:
Hi Kirti Arora!

You can look at the features in karaf.Define a set of Bundles as follows and
configure start-level based on their dependencies, then use feature:install
xxx.xml to install a feature.Hope this helps you!

 <feature name="my-project" version="1.0.0">
    <bundle
start-level="80">mvn:com.mycompany.myproject/myproject-dao</bundle>
    <bundle
start-level="85">mvn:com.mycompany.myproject/myproject-service</bundle>
  </feature>

Regards
duan



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: Define Deployment Sequence of Activator Bundles in Karaf

jbonofre
Hi,

First, if start-level is supported, you should think about your bundle.
If your bundles NEED an order, that's probably something wrong.

Anyway, the features XML is something you provide, and you add into
Karaf (using feature:repo-add).

On the other hand, you can also add your bundle (with start level) in
etc/startup.properties.

Regards
JB

On 05/11/2019 15:28, Kirti Arora wrote:

> Hi Duan,
>
> Thanks for the reply.
> Yes, I saw this approach. Can you please tell me the location of the
> feature xml file or where can I define the features?
>
> Thanks,
> Kirti Arora
>
> On Tue, Nov 5, 2019 at 4:11 PM duan2ping <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hi Kirti Arora!
>
>     You can look at the features in karaf.Define a set of Bundles as
>     follows and
>     configure start-level based on their dependencies, then use
>     feature:install
>     xxx.xml to install a feature.Hope this helps you!
>
>      <feature name="my-project" version="1.0.0">
>         <bundle
>     start-level="80">mvn:com.mycompany.myproject/myproject-dao</bundle>
>         <bundle
>     start-level="85">mvn:com.mycompany.myproject/myproject-service</bundle>
>       </feature>
>
>     Regards
>     duan
>
>
>
>     --
>     Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Define Deployment Sequence of Activator Bundles in Karaf

Toni Menzel-2
In reply to this post by Kirti Arora
"bundles are dependent on each other. So, I want to define a specific sequence of 
bundle deployment in Karaf to avoid runtime ClassNotFoundException"
Can you explain what you are doing? Because this is exactly what should not happen: the CnfE should not happen when you have proper metadata (imports/exports) in your manifest. Also there should not be bundle order dependencies (yes there are very few exceptions, but first try hard to make bundle ordering not mandatory).

Toni


Toni Menzel | [hidden email]
Software Engineering Therapist @ rebaze
Alleestrasse 25 / 30167 Hannover / Germany

rebaze is a developer experience consultancy.

rebaze GmbH, Zollstrasse 6, 39114 Magdeburg, Germany
Managing Director: Toni Menzel
Registration Court: District Court of Stendal
Registration Number: HRB 17993
Sales Tax (VAT) Registration Number: DE282233792



On Mon, Nov 4, 2019 at 3:18 PM Kirti Arora <[hidden email]> wrote:
Hello,

I am new to Karaf. I have three bundles in my Karaf_Home/deploy directory and 
bundles are dependent on each other. So, I want to define a specific sequence of 
bundle deployment in Karaf to avoid runtime ClassNotFoundException.

Can someone please guide me, how can I define bundle deployment sequence in Karaf?

Thanks,
Kirti Arora
Reply | Threaded
Open this post in threaded view
|

Re: Define Deployment Sequence of Activator Bundles in Karaf

duan2ping
In reply to this post by jbonofre
Hi JB

If  bundles NEED an order, that's probably something wrong.Is this a problem
with module design? That how to design correctly.

For example, I have two Bundles, BundleA provides the API and then BundleB
implements the API of BundleA. In this way, BundleB relies on BundleA, which
causes BundleA to be started before BundleB.


Regards
duan




--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: Define Deployment Sequence of Activator Bundles in Karaf

jbonofre
Hi

What you describe is resolution, not start.

For resolution, you don't need start level.

A bundle first go in resolved state and eventually it goes in started state.

In your case, just create the features according to the resolution, no need of start level.

Regards
JB

Le 6 nov. 2019 02:29, duan2ping <[hidden email]> a écrit :

Hi JB

If  bundles NEED an order, that's probably something wrong.Is this a problem
with module design? That how to design correctly.

For example, I have two Bundles, BundleA provides the API and then BundleB
implements the API of BundleA. In this way, BundleB relies on BundleA, which
causes BundleA to be started before BundleB.


Regards
duan




--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html


Reply | Threaded
Open this post in threaded view
|

Re: Define Deployment Sequence of Activator Bundles in Karaf

cschneider
In reply to this post by Kirti Arora
Does the problem only happen when you put the bundles into the deploy folder while karaf is running or does it also happen when you first put all bundles into the deploy folder and then start karaf?



Am Mo., 4. Nov. 2019 um 15:18 Uhr schrieb Kirti Arora <[hidden email]>:
Hello,

I am new to Karaf. I have three bundles in my Karaf_Home/deploy directory and 
bundles are dependent on each other. So, I want to define a specific sequence of 
bundle deployment in Karaf to avoid runtime ClassNotFoundException.

Can someone please guide me, how can I define bundle deployment sequence in Karaf?

Thanks,
Kirti Arora


--
--
Christian Schneider

http://www.liquid-reality.de

Computer Scientist

Reply | Threaded
Open this post in threaded view
|

Re: Define Deployment Sequence of Activator Bundles in Karaf

jbonofre
In reply to this post by duan2ping
By the way, if you have a ClassNotFoundException, maybe you are using
optional import. So, it means that the bundle will go in resolved state
even if "required" packages are not there. It could explain the CNFE.

Regards
JB

On 06/11/2019 02:29, duan2ping wrote:

> Hi JB
>
> If  bundles NEED an order, that's probably something wrong.Is this a problem
> with module design? That how to design correctly.
>
> For example, I have two Bundles, BundleA provides the API and then BundleB
> implements the API of BundleA. In this way, BundleB relies on BundleA, which
> causes BundleA to be started before BundleB.
>
>
> Regards
> duan
>
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Define Deployment Sequence of Activator Bundles in Karaf

duan2ping
Hi JB

Thank you for your answer.I seem to understand.
When do you need to use start-level?

Regards
duan



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: Define Deployment Sequence of Activator Bundles in Karaf

jbonofre
Hi,

Theoretically, you should never use start-level (from an end-user
perspective) if you cleanly implement your bundle as "dynamic" (using
service tracker, managed service, etc).
start-level could be use for "low level" bundles or as a workaround for
"bad" activator/bundles.

Regards
JB

On 06/11/2019 14:00, duan2ping wrote:

> Hi JB
>
> Thank you for your answer.I seem to understand.
> When do you need to use start-level?
>
> Regards
> duan
>
>
>
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Define Deployment Sequence of Activator Bundles in Karaf

duan2ping
Hi JB

Thank you very much!
Your answer is very useful to me.

Regards
duan



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
Reply | Threaded
Open this post in threaded view
|

Re: Define Deployment Sequence of Activator Bundles in Karaf

Kirti Arora
Hello All,

Thanks for your answers :)
I now understand the concept of why we shouldn't use start-level for bundle ordering. 
I have added proper metadata and it is working fine now.

Thanks,
Kirti Arora


On Thu, Nov 7, 2019 at 7:15 AM duan2ping <[hidden email]> wrote:
Hi JB

Thank you very much!
Your answer is very useful to me.

Regards
duan



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html