Best practice for deploying beans to use in camel blueprints

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

Best practice for deploying beans to use in camel blueprints

Krenn Daniel

Hello!

 

We have several blueprint XMLs in our Karaf’s deploy directory. We now need to use beans in those blueprints.

How do I best make my beans available to the blueprints inside of our Karaf’s deploy directory?

 

Currently, I just mvn clean install my project where I develop my beans. This gives me a JAR file which I can drop in the deploy folder. This way, I can access my beans.

I just don’t know how to handle dependencies this way.

 

For example, I need the apache-commons library. I have declared this dependency in my POM.xml, like

 

<dependency>

<groupId>org.apache.commons</groupId>

<artifactId>commons-lang3</artifactId>

<version>3.4</version>

</dependency>

 

But inside Karaf, the dependency doesn’t seem to be available, as I’m getting some ClassNotFound exceptions.

I tried to use the maven-assembly-plugin with “jar-with-dependencies”, in order to just bundle all dependencies with my project, but that yields a JAR file over 50MB in size. I do have a high number of dependencies. When I try to deploy that, Karaf just crashes.

 

Does anyone know a better approach?

 

Best regards,

Daniel Krenn
Consultant Manufacturing Execution

[hidden email]

 |   Tel. +49 (9931) 981 365

 

 

T.CON GmbH & Co. KG
T.CON GmbH & Co. KG 
www.team-con.de

 
Hauptsitz: Straubinger Straße 2 | 94447 Plattling | Tel: <a href="tel:+499931981100" target="_blank" id="LPlnk689713" style="text-decoration:none;color:#7F7F7F;">+49 (0)9931 981-100
​​
Events | Newsletter

T.CON | Facebook
T.CON | Twitter
T.CON | LinkedIn
T.CON | YouTube
T.CON | Instagram
T.CON | Xing
SAP Gold Partner
Geschäftsführer: Karl Fuchs, Michael Gulde, Stefan Fiedler | KG: AG Deggendorf HRA 1618 
Pers. haftender Ges.: T.CON Beteiligungs-GmbH | Sitz: Plattling | AG Deggendorf HRB 2053
iT.CONnect 2019
Reply | Threaded
Open this post in threaded view
|

ODP: Best practice for deploying beans to use in camel blueprints

kamilantlgc

Krenn,

 

I believe that Karaf „feature.xml” is what you looking for (https://karaf.apache.org/manual/latest/provisioning).

I use Gradle + https://github.com/lburgazzoli/gradle-karaf-plugin but I’m sure there is a plugin for Maven as well.

 

Kind regards,

Kamil

 

 

Od: [hidden email]
Wysłano: piątek, 23 sierpnia 2019 14:43
Do: [hidden email]
Temat: Best practice for deploying beans to use in camel blueprints

 

Hello!

 

We have several blueprint XMLs in our Karaf’s deploy directory. We now need to use beans in those blueprints.

How do I best make my beans available to the blueprints inside of our Karaf’s deploy directory?

 

Currently, I just mvn clean install my project where I develop my beans. This gives me a JAR file which I can drop in the deploy folder. This way, I can access my beans.

I just don’t know how to handle dependencies this way.

 

For example, I need the apache-commons library. I have declared this dependency in my POM.xml, like

 

<dependency>

<groupId>org.apache.commons</groupId>

<artifactId>commons-lang3</artifactId>

<version>3.4</version>

</dependency>

 

But inside Karaf, the dependency doesn’t seem to be available, as I’m getting some ClassNotFound exceptions.

I tried to use the maven-assembly-plugin with “jar-with-dependencies”, in order to just bundle all dependencies with my project, but that yields a JAR file over 50MB in size. I do have a high number of dependencies. When I try to deploy that, Karaf just crashes.

 

Does anyone know a better approach?

 

Best regards,

Daniel Krenn
Consultant Manufacturing Execution

[hidden email]

 |   Tel. +49 (9931) 981 365

 

 

T.CON GmbH & Co. KG

T.CON GmbH & Co. KG 
www.team-con.de
 

Hauptsitz: Straubinger Straße 2 | 94447 Plattling | Tel: <a href="tel:+499931981100" target="_blank">+49 (0)9931 981-100
​​
Events | Newsletter

T.CON | Facebook

T.CON | Twitter

T.CON | LinkedIn

T.CON | YouTube

T.CON | Instagram

T.CON | Xing

SAP Gold Partner

Geschäftsführer: Karl Fuchs, Michael Gulde, Stefan Fiedler | KG: AG Deggendorf HRA 1618 
Pers. haftender Ges.: T.CON Beteiligungs-GmbH | Sitz: Plattling | AG Deggendorf HRB 2053

iT.CONnect 2019

 

 

Reply | Threaded
Open this post in threaded view
|

Re: Best practice for deploying beans to use in camel blueprints

jbonofre
In reply to this post by Krenn Daniel
Hi Daniel,

you have different options:

1. The cleanest approach is probably to package your blueprint XML in a
bundle (in OSGI-INF/blueprint) and then use regular import package. You
can provision all using karaf features
2. You can drop the jar in the deploy folder. By default, blueprint
deployer creates "on the fly" a bundle with your blueprint XML (that's
why you can see your blueprint when you do bundle:list), using dynamic
import.
3. You can define the third party in lib/ext or startup to make it
available to the whole container.

I can help you if needed for a example.

Regards
JB

On 23/08/2019 14:43, Krenn Daniel wrote:

> Hello!
>
>  
>
> We have several blueprint XMLs in our Karaf’s deploy directory. We now
> need to use beans in those blueprints.
>
> How do I best make my beans available to the blueprints inside of our
> Karaf’s deploy directory?
>
>  
>
> Currently, I just mvn clean install my project where I develop my beans.
> This gives me a JAR file which I can drop in the deploy folder. This
> way, I can access my beans.
>
> I just don’t know how to handle dependencies this way.
>
>  
>
> For example, I need the apache-commons library. I have declared this
> dependency in my POM.xml, like
>
>  
>
> <dependency>
>
> <groupId>org.apache.commons</groupId>
>
> <artifactId>commons-lang3</artifactId>
>
> <version>3.4</version>
>
> </dependency>
>
>  
>
> But inside Karaf, the dependency doesn’t seem to be available, as I’m
> getting some ClassNotFound exceptions.
>
> I tried to use the maven-assembly-plugin with “jar-with-dependencies”,
> in order to just bundle all dependencies with my project, but that
> yields a JAR file over 50MB in size. I do have a high number of
> dependencies. When I try to deploy that, Karaf just crashes.
>
>  
>
> Does anyone know a better approach?
>
>  
>
> Best regards,
>
> *Daniel* *Krenn*
> Consultant Manufacturing Execution
>
> [hidden email] <mailto:[hidden email]>
>
>
>
>  |   Tel. +49 (9931) 981 365
>
>
>
>  
>
>  
>
> T.CON GmbH & Co. KG <https://www.team-con.de/>
> T.CON GmbH & Co. KG ​
> ​*www.team-con.de* <http://www.team-con.de/>
>  
>
> *​*
> <http://www.team-con.de/>Hauptsitz: Straubinger Straße 2 | 94447 Plattling | Tel: *+49 (0)9931 981-100*
> <tel:+499931981100>
> ​​*Events*
> <http://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltungen.html> | *Newsletter*
> <https://www2.team-con.de/newsletter>
>
> T.CON | Facebook <https://www.facebook.com/TEAMCONde/>
> T.CON | Twitter <https://twitter.com/team_consulting>
>
> T.CON | LinkedIn <https://www.linkedin.com/company/t-con-gmbh-&-co-kg/>
> T.CON | YouTube <https://www.youtube.com/user/TEAMCONde>
>
> T.CON | Instagram <https://www.instagram.com/team.consulting/>
> T.CON | Xing <https://www.xing.com/companies/t.congmbhco.kg>
>
>
> SAP Gold Partner <https://www.sap.com/germany/index.html>
>
> Geschäftsführer: Karl Fuchs, Michael Gulde, Stefan Fiedler | KG: AG
> Deggendorf HRA 1618 
> Pers. haftender Ges.: T.CON Beteiligungs-GmbH | Sitz: Plattling | AG
> Deggendorf HRB 2053
>
> iT.CONnect 2019
> <https://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltungen/itconnect.html?utm_source=employee&utm_medium=email&utm_campaign=de_it.connect>
>

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

AW: Best practice for deploying beans to use in camel blueprints

Krenn Daniel
Hello JB,

The first option isn't an option, because we want to have the ability to edit the blueprint without having to compile a java project.
The second option seems really dirty, I'd have to add like 30 jars (because of transitive dependencies).
The third option is the same as the first option, if I understand correctly.

Can't I just drop a feature.xml with the required dependencies into the deploy folder?
Actually, I'm in the process of trying this. But when I drop the feature.xml in my deploy folder, Karaf can't resolve the bundles.

I actually don't understand why Karaf wouldn't be able to resolve my dependency tree from either my project's POM or a generated feature.xml.
It has all the info it needs, isn't it possible for karaf to download the dependencies from maven automatically?
If that isn't possible, I guess I'll drop the 30+ jars in the lib/ext folder.

I HAVE to be missing something, it can't be that hard to do this.


Best regards,
Daniel Krenn
Consultant Manufacturing Execution

mailto:[hidden email]  | Tel. +49 (9931) 981 365  

T.CON GmbH & Co. KG
T.CON GmbH & Co. KG 
www.team-con.de

 
Hauptsitz: Straubinger Straße 2 | 94447 Plattling | Tel: <a href="tel:+499931981100" target="_blank" id="LPlnk689713" style="text-decoration:none;color:#7F7F7F;">+49 (0)9931 981-100
​​
Events | Newsletter

T.CON | Facebook
T.CON | Twitter
T.CON | LinkedIn
T.CON | YouTube
T.CON | Instagram
T.CON | Xing
SAP Gold Partner
Geschäftsführer: Karl Fuchs, Michael Gulde, Stefan Fiedler | KG: AG Deggendorf HRA 1618 
Pers. haftender Ges.: T.CON Beteiligungs-GmbH | Sitz: Plattling | AG Deggendorf HRB 2053
iT.CONnect 2019
-----Ursprüngliche Nachricht-----
Von: Jean-Baptiste Onofré <[hidden email]>
Gesendet: Samstag, 24. August 2019 07:34
An: [hidden email]
Betreff: Re: Best practice for deploying beans to use in camel blueprints

Hi Daniel,

you have different options:

1. The cleanest approach is probably to package your blueprint XML in a bundle (in OSGI-INF/blueprint) and then use regular import package. You can provision all using karaf features 2. You can drop the jar in the deploy folder. By default, blueprint deployer creates "on the fly" a bundle with your blueprint XML (that's why you can see your blueprint when you do bundle:list), using dynamic import.
3. You can define the third party in lib/ext or startup to make it available to the whole container.

I can help you if needed for a example.

Regards
JB

On 23/08/2019 14:43, Krenn Daniel wrote:

> Hello!
>
>  
>
> We have several blueprint XMLs in our Karaf’s deploy directory. We now
> need to use beans in those blueprints.
>
> How do I best make my beans available to the blueprints inside of our
> Karaf’s deploy directory?
>
>  
>
> Currently, I just mvn clean install my project where I develop my beans.
> This gives me a JAR file which I can drop in the deploy folder. This
> way, I can access my beans.
>
> I just don’t know how to handle dependencies this way.
>
>  
>
> For example, I need the apache-commons library. I have declared this
> dependency in my POM.xml, like
>
>  
>
> <dependency>
>
> <groupId>org.apache.commons</groupId>
>
> <artifactId>commons-lang3</artifactId>
>
> <version>3.4</version>
>
> </dependency>
>
>  
>
> But inside Karaf, the dependency doesn’t seem to be available, as I’m
> getting some ClassNotFound exceptions.
>
> I tried to use the maven-assembly-plugin with “jar-with-dependencies”,
> in order to just bundle all dependencies with my project, but that
> yields a JAR file over 50MB in size. I do have a high number of
> dependencies. When I try to deploy that, Karaf just crashes.
>
>  
>
> Does anyone know a better approach?
>
>  
>
> Best regards,
>
> *Daniel* *Krenn*
> Consultant Manufacturing Execution
>
> [hidden email] <mailto:[hidden email]>
>
>
>
>  |   Tel. +49 (9931) 981 365
>
>
>
>  
>
>  
>
> T.CON GmbH & Co. KG <https://www.team-con.de/> T.CON GmbH & Co. KG ​
> ​*www.team-con.de* <http://www.team-con.de/>
>  
>
> *​*
> <http://www.team-con.de/>Hauptsitz: Straubinger Straße 2 | 94447 
> Plattling | Tel: *+49 (0)9931 981-100* <tel:+499931981100>
> ​​*Events*
> <http://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltung
> en.html> | *Newsletter* <https://www2.team-con.de/newsletter>
>
> T.CON | Facebook <https://www.facebook.com/TEAMCONde/>
> T.CON | Twitter <https://twitter.com/team_consulting>
>
> T.CON | LinkedIn <https://www.linkedin.com/company/t-con-gmbh-&-co-kg/>
> T.CON | YouTube <https://www.youtube.com/user/TEAMCONde>
>
> T.CON | Instagram <https://www.instagram.com/team.consulting/>
> T.CON | Xing <https://www.xing.com/companies/t.congmbhco.kg>
>
>
> SAP Gold Partner <https://www.sap.com/germany/index.html>
>
> Geschäftsführer: Karl Fuchs, Michael Gulde, Stefan Fiedler | KG: AG
> Deggendorf HRA 1618 Pers. haftender Ges.: T.CON Beteiligungs-GmbH |
> Sitz: Plattling | AG Deggendorf HRB 2053
>
> iT.CONnect 2019
> <https://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltun
> gen/itconnect.html?utm_source=employee&utm_medium=email&utm_campaign=d
> e_it.connect>
>

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

AW: Best practice for deploying beans to use in camel blueprints

Krenn Daniel

Hi all,

 

I think I found a solution that is satisfactory:

 

  1. Generate a parent project with the archetype root-pom or pom-root, I don’t remember
  2. Inside that project, generate one project (maven-archetype-simple) for your beans and one (karaf-archetype-kar) for your feature.xml
  3. Program your beans and manually add your desired dependencies to feature.xml, including your bean project, so that it gets included in your KAR
  4. Mark your dependencies that you don’t want to expose in karaf, e.g. google guava, with dependency=true
  5. Mvn clean install, and it spits out a really small (in my case 2,5MB (that’s much better than 50MB))

 

I find this to be clean enough. The only thing I need to figure out now is how to automatically create the feature.xml from my POM so I don’t have to do it manually.

If someone wants an example, just say so!

 

Best regards,

Daniel Krenn
Consultant Manufacturing Execution

[hidden email]

 |   Tel. +49 (9931) 981 365

 

 

T.CON GmbH & Co. KG
T.CON GmbH & Co. KG 
www.team-con.de

 
Hauptsitz: Straubinger Straße 2 | 94447 Plattling | Tel: <a href="tel:+499931981100" target="_blank" id="LPlnk689713" style="text-decoration:none;color:#7F7F7F;">+49 (0)9931 981-100
​​
Events | Newsletter

T.CON | Facebook
T.CON | Twitter
T.CON | LinkedIn
T.CON | YouTube
T.CON | Instagram
T.CON | Xing
SAP Gold Partner
Geschäftsführer: Karl Fuchs, Michael Gulde, Stefan Fiedler | KG: AG Deggendorf HRA 1618 
Pers. haftender Ges.: T.CON Beteiligungs-GmbH | Sitz: Plattling | AG Deggendorf HRB 2053
iT.CONnect 2019

Von: Krenn Daniel <[hidden email]>
Gesendet: Montag, 26. August 2019 11:29
An: [hidden email]
Betreff: AW: Best practice for deploying beans to use in camel blueprints

 

Hello JB,

The first option isn't an option, because we want to have the ability to edit the blueprint without having to compile a java project.
The second option seems really dirty, I'd have to add like 30 jars (because of transitive dependencies).
The third option is the same as the first option, if I understand correctly.

Can't I just drop a feature.xml with the required dependencies into the deploy folder?
Actually, I'm in the process of trying this. But when I drop the feature.xml in my deploy folder, Karaf can't resolve the bundles.

I actually don't understand why Karaf wouldn't be able to resolve my dependency tree from either my project's POM or a generated feature.xml.
It has all the info it needs, isn't it possible for karaf to download the dependencies from maven automatically?
If that isn't possible, I guess I'll drop the 30+ jars in the lib/ext folder.

I HAVE to be missing something, it can't be that hard to do this.


Best regards,
Daniel Krenn
Consultant Manufacturing Execution

[hidden email]  | Tel. +49 (9931) 981 365  

T.CON GmbH & Co. KG

T.CON GmbH & Co. KG 
www.team-con.de
 

Hauptsitz: Straubinger Straße 2 | 94447 Plattling | Tel: <a href="tel:&#43;499931981100" target="_blank">+49 (0)9931 981-100
​​
Events | Newsletter

T.CON | Facebook

T.CON | Twitter

T.CON | LinkedIn

T.CON | YouTube

T.CON | Instagram

T.CON | Xing

SAP Gold Partner

Geschäftsführer: Karl Fuchs, Michael Gulde, Stefan Fiedler | KG: AG Deggendorf HRA 1618 
Pers. haftender Ges.: T.CON Beteiligungs-GmbH | Sitz: Plattling | AG Deggendorf HRB 2053

iT.CONnect 2019

-----Ursprüngliche Nachricht-----
Von: Jean-Baptiste Onofré <[hidden email]>
Gesendet: Samstag, 24. August 2019 07:34
An: [hidden email]
Betreff: Re: Best practice for deploying beans to use in camel blueprints

Hi Daniel,

you have different options:

1. The cleanest approach is probably to package your blueprint XML in a bundle (in OSGI-INF/blueprint) and then use regular import package. You can provision all using karaf features 2. You can drop the jar in the deploy folder. By default, blueprint deployer creates "on the fly" a bundle with your blueprint XML (that's why you can see your blueprint when you do bundle:list), using dynamic import.
3. You can define the third party in lib/ext or startup to make it available to the whole container.

I can help you if needed for a example.

Regards
JB

On 23/08/2019 14:43, Krenn Daniel wrote:
> Hello!
>
>  
>
> We have several blueprint XMLs in our Karaf’s deploy directory. We now
> need to use beans in those blueprints.
>
> How do I best make my beans available to the blueprints inside of our
> Karaf’s deploy directory?
>
>  
>
> Currently, I just mvn clean install my project where I develop my beans.
> This gives me a JAR file which I can drop in the deploy folder. This
> way, I can access my beans.
>
> I just don’t know how to handle dependencies this way.
>
>  
>
> For example, I need the apache-commons library. I have declared this
> dependency in my POM.xml, like
>
>  
>
> <dependency>
>
> <groupId>org.apache.commons</groupId>
>
> <artifactId>commons-lang3</artifactId>
>
> <version>3.4</version>
>
> </dependency>
>
>  
>
> But inside Karaf, the dependency doesn’t seem to be available, as I’m
> getting some ClassNotFound exceptions.
>
> I tried to use the maven-assembly-plugin with “jar-with-dependencies”,
> in order to just bundle all dependencies with my project, but that
> yields a JAR file over 50MB in size. I do have a high number of
> dependencies. When I try to deploy that, Karaf just crashes.
>
>  
>
> Does anyone know a better approach?
>
>  
>
> Best regards,
>
> *Daniel* *Krenn*
> Consultant Manufacturing Execution
>
> [hidden email] <[hidden email]>
>
>
>
>  |   Tel. +49 (9931) 981 365
>
>
>
>  
>
>  
>
> T.CON GmbH & Co. KG <https://www.team-con.de/> T.CON GmbH & Co. KG ​
> ​*www.team-con.de* <http://www.team-con.de/>
>  
>
> *​*
> <http://www.team-con.de/>Hauptsitz: Straubinger Straße 2 | 94447 
> Plattling | Tel: *+49 (0)9931 981-100* <<a href="tel:&#43;499931981100">tel:+499931981100>
> ​​*Events*
> <http://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltung
> en.html> | *Newsletter* <https://www2.team-con.de/newsletter>
>
> T.CON | Facebook <https://www.facebook.com/TEAMCONde/>
> T.CON | Twitter <https://twitter.com/team_consulting>
>
> T.CON | LinkedIn <https://www.linkedin.com/company/t-con-gmbh-&-co-kg/>
> T.CON | YouTube <https://www.youtube.com/user/TEAMCONde>
>
> T.CON | Instagram <https://www.instagram.com/team.consulting/>
> T.CON | Xing <https://www.xing.com/companies/t.congmbhco.kg>
>
>
> SAP Gold Partner <https://www.sap.com/germany/index.html>
>
> Geschäftsführer: Karl Fuchs, Michael Gulde, Stefan Fiedler | KG: AG
> Deggendorf HRA 1618 Pers. haftender Ges.: T.CON Beteiligungs-GmbH |
> Sitz: Plattling | AG Deggendorf HRB 2053
>
> iT.CONnect 2019
> <https://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltun
> gen/itconnect.html?utm_source=employee&utm_medium=email&utm_campaign=d
> e_it.connect>
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply | Threaded
Open this post in threaded view
|

Re: AW: Best practice for deploying beans to use in camel blueprints

jbonofre
Hi,

I'm not a big fan. I prefer to use the processor/service approach.

It's a better OSGi approach, with a clean separation of bean and route.

I will add an example here:

https://github.com/apache/karaf/blob/master/examples/karaf-camel-example/karaf-camel-example-blueprint/src/main/resources/OSGI-INF/blueprint/route.xml

In the mean time, you can take a look on an example I wrote for the
Mastering Apache Camel book:

https://github.com/jbonofre/blog-camel-blueprint/blob/master/my-route/src/main/resources/OSGI-INF/blueprint/route.xml

The whole project is there:

https://github.com/jbonofre/blog-camel-blueprint

Regards
JB

On 26/08/2019 19:47, Krenn Daniel wrote:

> Hi all,
>
>  
>
> I think I found a solution that is satisfactory:
>
>  
>
>  1. Generate a parent project with the archetype root-pom or pom-root, I
>     don’t remember
>  2. Inside that project, generate one project (maven-archetype-simple)
>     for your beans and one (karaf-archetype-kar) for your feature.xml
>  3. Program your beans and manually add your desired dependencies to
>     feature.xml, including your bean project, so that it gets included
>     in your KAR
>  4. Mark your dependencies that you don’t want to expose in karaf, e.g.
>     google guava, with dependency=true
>  5. Mvn clean install, and it spits out a really small (in my case 2,5MB
>     (that’s much better than 50MB))
>
>  
>
> I find this to be clean enough. The only thing I need to figure out now
> is how to automatically create the feature.xml from my POM so I don’t
> have to do it manually.
>
> If someone wants an example, just say so!
>
>  
>
> Best regards,
>
> *Daniel* *Krenn*
> Consultant Manufacturing Execution
>
> [hidden email] <mailto:[hidden email]>
>
>
>
>  |   Tel. +49 (9931) 981 365
>
>
>
>  
>
>  
>
> T.CON GmbH & Co. KG <https://www.team-con.de/>
> T.CON GmbH & Co. KG ​
> ​*www.team-con.de* <http://www.team-con.de/>
>  
>
> *​*
> <http://www.team-con.de/>Hauptsitz: Straubinger Straße 2 | 94447 Plattling | Tel: *+49 (0)9931 981-100*
> <tel:+499931981100>
> ​​*Events*
> <http://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltungen.html> | *Newsletter*
> <https://www2.team-con.de/newsletter>
>
> T.CON | Facebook <https://www.facebook.com/TEAMCONde/>
> T.CON | Twitter <https://twitter.com/team_consulting>
>
> T.CON | LinkedIn <https://www.linkedin.com/company/t-con-gmbh-&-co-kg/>
> T.CON | YouTube <https://www.youtube.com/user/TEAMCONde>
>
> T.CON | Instagram <https://www.instagram.com/team.consulting/>
> T.CON | Xing <https://www.xing.com/companies/t.congmbhco.kg>
>
>
> SAP Gold Partner <https://www.sap.com/germany/index.html>
>
> Geschäftsführer: Karl Fuchs, Michael Gulde, Stefan Fiedler | KG: AG
> Deggendorf HRA 1618 
> Pers. haftender Ges.: T.CON Beteiligungs-GmbH | Sitz: Plattling | AG
> Deggendorf HRB 2053
>
> iT.CONnect 2019
> <https://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltungen/itconnect.html?utm_source=employee&utm_medium=email&utm_campaign=de_it.connect>
>
> *Von:* Krenn Daniel <[hidden email]>
> *Gesendet:* Montag, 26. August 2019 11:29
> *An:* [hidden email]
> *Betreff:* AW: Best practice for deploying beans to use in camel blueprints
>
>  
>
> Hello JB,
>
> The first option isn't an option, because we want to have the ability to
> edit the blueprint without having to compile a java project.
> The second option seems really dirty, I'd have to add like 30 jars
> (because of transitive dependencies).
> The third option is the same as the first option, if I understand correctly.
>
> Can't I just drop a feature.xml with the required dependencies into the
> deploy folder?
> Actually, I'm in the process of trying this. But when I drop the
> feature.xml in my deploy folder, Karaf can't resolve the bundles.
>
> I actually don't understand why Karaf wouldn't be able to resolve my
> dependency tree from either my project's POM or a generated feature.xml.
> It has all the info it needs, isn't it possible for karaf to download
> the dependencies from maven automatically?
> If that isn't possible, I guess I'll drop the 30+ jars in the lib/ext
> folder.
>
> I HAVE to be missing something, it can't be that hard to do this.
>
>
> Best regards,
> Daniel Krenn
> Consultant Manufacturing Execution
>
> mailto:[hidden email]  | Tel. +49 (9931) 981 365  
>
> T.CON GmbH & Co. KG <https://www.team-con.de/>
>
> *T.CON GmbH & Co. KG **​**
> ​***www.team-con.de* <http://www.team-con.de/>**
>  *
>
> **​*
> <http://www.team-con.de/>*Hauptsitz: Straubinger Straße 2 | 94447 Plattling | Tel: *+49 (0)9931 981-100*
> <tel:+499931981100>
> ​​*Events*
> <http://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltungen.html> | *Newsletter*
> <https://www2.team-con.de/newsletter>
>
> T.CON | Facebook <https://www.facebook.com/TEAMCONde/>
>
>
>
> T.CON | Twitter <https://twitter.com/team_consulting>
>
>
>
> T.CON | LinkedIn <https://www.linkedin.com/company/t-con-gmbh-&-co-kg/>
>
>
>
> T.CON | YouTube <https://www.youtube.com/user/TEAMCONde>
>
>
>
> T.CON | Instagram <https://www.instagram.com/team.consulting/>
>
>
>
> T.CON | Xing <https://www.xing.com/companies/t.congmbhco.kg>
>
>
>
> SAP Gold Partner <https://www.sap.com/germany/index.html>
>
> Geschäftsführer: Karl Fuchs, Michael Gulde, Stefan Fiedler | KG: AG
> Deggendorf HRA 1618 
> Pers. haftender Ges.: T.CON Beteiligungs-GmbH | Sitz: Plattling | AG
> Deggendorf HRB 2053
>
> iT.CONnect 2019
> <https://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltungen/itconnect.html?utm_source=employee&utm_medium=email&utm_campaign=de_it.connect>
>
> -----Ursprüngliche Nachricht-----
> Von: Jean-Baptiste Onofré <[hidden email] <mailto:[hidden email]>>
> Gesendet: Samstag, 24. August 2019 07:34
> An: [hidden email] <mailto:[hidden email]>
> Betreff: Re: Best practice for deploying beans to use in camel blueprints
>
> Hi Daniel,
>
> you have different options:
>
> 1. The cleanest approach is probably to package your blueprint XML in a
> bundle (in OSGI-INF/blueprint) and then use regular import package. You
> can provision all using karaf features 2. You can drop the jar in the
> deploy folder. By default, blueprint deployer creates "on the fly" a
> bundle with your blueprint XML (that's why you can see your blueprint
> when you do bundle:list), using dynamic import.
> 3. You can define the third party in lib/ext or startup to make it
> available to the whole container.
>
> I can help you if needed for a example.
>
> Regards
> JB
>
> On 23/08/2019 14:43, Krenn Daniel wrote:
>> Hello!
>>
>>  
>>
>> We have several blueprint XMLs in our Karaf’s deploy directory. We now
>> need to use beans in those blueprints.
>>
>> How do I best make my beans available to the blueprints inside of our
>> Karaf’s deploy directory?
>>
>>  
>>
>> Currently, I just mvn clean install my project where I develop my beans.
>> This gives me a JAR file which I can drop in the deploy folder. This
>> way, I can access my beans.
>>
>> I just don’t know how to handle dependencies this way.
>>
>>  
>>
>> For example, I need the apache-commons library. I have declared this
>> dependency in my POM.xml, like
>>
>>  
>>
>> <dependency>
>>
>> <groupId>org.apache.commons</groupId>
>>
>> <artifactId>commons-lang3</artifactId>
>>
>> <version>3.4</version>
>>
>> </dependency>
>>
>>  
>>
>> But inside Karaf, the dependency doesn’t seem to be available, as I’m
>> getting some ClassNotFound exceptions.
>>
>> I tried to use the maven-assembly-plugin with “jar-with-dependencies”,
>> in order to just bundle all dependencies with my project, but that
>> yields a JAR file over 50MB in size. I do have a high number of
>> dependencies. When I try to deploy that, Karaf just crashes.
>>
>>  
>>
>> Does anyone know a better approach?
>>
>>  
>>
>> Best regards,
>>
>> *Daniel* *Krenn*
>> Consultant Manufacturing Execution
>>
>> [hidden email] <mailto:[hidden email]>
> <mailto:[hidden email]>
>>
>>
>>
>>  |   Tel. +49 (9931) 981 365
>>
>>
>>
>>  
>>
>>  
>>
>> T.CON GmbH & Co. KG <https://www.team-con.de/> T.CON GmbH & Co. KG ​
>> ​*www.team-con.de* <http://www.team-con.de/>
>>  
>>
>> *​*
>> <http://www.team-con.de/>Hauptsitz: Straubinger Straße 2 | 94447 
>> Plattling | Tel: *+49 (0)9931 981-100* <tel:+499931981100>
>> ​​*Events*
>> <http://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltung
> <http://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltung%0b>>
> en.html> | *Newsletter* <https://www2.team-con.de/newsletter>
>>
>> T.CON | Facebook <https://www.facebook.com/TEAMCONde/>
>> T.CON | Twitter <https://twitter.com/team_consulting>
>>
>> T.CON | LinkedIn <https://www.linkedin.com/company/t-con-gmbh-&-co-kg/>
>> T.CON | YouTube <https://www.youtube.com/user/TEAMCONde>
>>
>> T.CON | Instagram <https://www.instagram.com/team.consulting/>
>> T.CON | Xing <https://www.xing.com/companies/t.congmbhco.kg>
>>
>>
>> SAP Gold Partner <https://www.sap.com/germany/index.html>
>>
>> Geschäftsführer: Karl Fuchs, Michael Gulde, Stefan Fiedler | KG: AG
>> Deggendorf HRA 1618 Pers. haftender Ges.: T.CON Beteiligungs-GmbH |
>> Sitz: Plattling | AG Deggendorf HRB 2053
>>
>> iT.CONnect 2019
>> <https://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltun
> <https://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltun%0b>>
> gen/itconnect.html?utm_source=employee&utm_medium=email&utm_campaign=d
>> e_it.connect>
>>
>
> --
> Jean-Baptiste Onofré
> [hidden email] <mailto:[hidden email]>
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

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

Re: AW: Best practice for deploying beans to use in camel blueprints

jbonofre
In reply to this post by Krenn Daniel
FYI, it's possible to deploy "exploded" bundle, and define the deps as
private package. It's pretty similar to kar, but without features.xml.

Regards
JB

On 26/08/2019 19:47, Krenn Daniel wrote:

> Hi all,
>
>  
>
> I think I found a solution that is satisfactory:
>
>  
>
>  1. Generate a parent project with the archetype root-pom or pom-root, I
>     don’t remember
>  2. Inside that project, generate one project (maven-archetype-simple)
>     for your beans and one (karaf-archetype-kar) for your feature.xml
>  3. Program your beans and manually add your desired dependencies to
>     feature.xml, including your bean project, so that it gets included
>     in your KAR
>  4. Mark your dependencies that you don’t want to expose in karaf, e.g.
>     google guava, with dependency=true
>  5. Mvn clean install, and it spits out a really small (in my case 2,5MB
>     (that’s much better than 50MB))
>
>  
>
> I find this to be clean enough. The only thing I need to figure out now
> is how to automatically create the feature.xml from my POM so I don’t
> have to do it manually.
>
> If someone wants an example, just say so!
>
>  
>
> Best regards,
>
> *Daniel* *Krenn*
> Consultant Manufacturing Execution
>
> [hidden email] <mailto:[hidden email]>
>
>
>
>  |   Tel. +49 (9931) 981 365
>
>
>
>  
>
>  
>
> T.CON GmbH & Co. KG <https://www.team-con.de/>
> T.CON GmbH & Co. KG ​
> ​*www.team-con.de* <http://www.team-con.de/>
>  
>
> *​*
> <http://www.team-con.de/>Hauptsitz: Straubinger Straße 2 | 94447 Plattling | Tel: *+49 (0)9931 981-100*
> <tel:+499931981100>
> ​​*Events*
> <http://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltungen.html> | *Newsletter*
> <https://www2.team-con.de/newsletter>
>
> T.CON | Facebook <https://www.facebook.com/TEAMCONde/>
> T.CON | Twitter <https://twitter.com/team_consulting>
>
> T.CON | LinkedIn <https://www.linkedin.com/company/t-con-gmbh-&-co-kg/>
> T.CON | YouTube <https://www.youtube.com/user/TEAMCONde>
>
> T.CON | Instagram <https://www.instagram.com/team.consulting/>
> T.CON | Xing <https://www.xing.com/companies/t.congmbhco.kg>
>
>
> SAP Gold Partner <https://www.sap.com/germany/index.html>
>
> Geschäftsführer: Karl Fuchs, Michael Gulde, Stefan Fiedler | KG: AG
> Deggendorf HRA 1618 
> Pers. haftender Ges.: T.CON Beteiligungs-GmbH | Sitz: Plattling | AG
> Deggendorf HRB 2053
>
> iT.CONnect 2019
> <https://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltungen/itconnect.html?utm_source=employee&utm_medium=email&utm_campaign=de_it.connect>
>
> *Von:* Krenn Daniel <[hidden email]>
> *Gesendet:* Montag, 26. August 2019 11:29
> *An:* [hidden email]
> *Betreff:* AW: Best practice for deploying beans to use in camel blueprints
>
>  
>
> Hello JB,
>
> The first option isn't an option, because we want to have the ability to
> edit the blueprint without having to compile a java project.
> The second option seems really dirty, I'd have to add like 30 jars
> (because of transitive dependencies).
> The third option is the same as the first option, if I understand correctly.
>
> Can't I just drop a feature.xml with the required dependencies into the
> deploy folder?
> Actually, I'm in the process of trying this. But when I drop the
> feature.xml in my deploy folder, Karaf can't resolve the bundles.
>
> I actually don't understand why Karaf wouldn't be able to resolve my
> dependency tree from either my project's POM or a generated feature.xml.
> It has all the info it needs, isn't it possible for karaf to download
> the dependencies from maven automatically?
> If that isn't possible, I guess I'll drop the 30+ jars in the lib/ext
> folder.
>
> I HAVE to be missing something, it can't be that hard to do this.
>
>
> Best regards,
> Daniel Krenn
> Consultant Manufacturing Execution
>
> mailto:[hidden email]  | Tel. +49 (9931) 981 365  
>
> T.CON GmbH & Co. KG <https://www.team-con.de/>
>
> *T.CON GmbH & Co. KG **​**
> ​***www.team-con.de* <http://www.team-con.de/>**
>  *
>
> **​*
> <http://www.team-con.de/>*Hauptsitz: Straubinger Straße 2 | 94447 Plattling | Tel: *+49 (0)9931 981-100*
> <tel:+499931981100>
> ​​*Events*
> <http://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltungen.html> | *Newsletter*
> <https://www2.team-con.de/newsletter>
>
> T.CON | Facebook <https://www.facebook.com/TEAMCONde/>
>
>
>
> T.CON | Twitter <https://twitter.com/team_consulting>
>
>
>
> T.CON | LinkedIn <https://www.linkedin.com/company/t-con-gmbh-&-co-kg/>
>
>
>
> T.CON | YouTube <https://www.youtube.com/user/TEAMCONde>
>
>
>
> T.CON | Instagram <https://www.instagram.com/team.consulting/>
>
>
>
> T.CON | Xing <https://www.xing.com/companies/t.congmbhco.kg>
>
>
>
> SAP Gold Partner <https://www.sap.com/germany/index.html>
>
> Geschäftsführer: Karl Fuchs, Michael Gulde, Stefan Fiedler | KG: AG
> Deggendorf HRA 1618 
> Pers. haftender Ges.: T.CON Beteiligungs-GmbH | Sitz: Plattling | AG
> Deggendorf HRB 2053
>
> iT.CONnect 2019
> <https://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltungen/itconnect.html?utm_source=employee&utm_medium=email&utm_campaign=de_it.connect>
>
> -----Ursprüngliche Nachricht-----
> Von: Jean-Baptiste Onofré <[hidden email] <mailto:[hidden email]>>
> Gesendet: Samstag, 24. August 2019 07:34
> An: [hidden email] <mailto:[hidden email]>
> Betreff: Re: Best practice for deploying beans to use in camel blueprints
>
> Hi Daniel,
>
> you have different options:
>
> 1. The cleanest approach is probably to package your blueprint XML in a
> bundle (in OSGI-INF/blueprint) and then use regular import package. You
> can provision all using karaf features 2. You can drop the jar in the
> deploy folder. By default, blueprint deployer creates "on the fly" a
> bundle with your blueprint XML (that's why you can see your blueprint
> when you do bundle:list), using dynamic import.
> 3. You can define the third party in lib/ext or startup to make it
> available to the whole container.
>
> I can help you if needed for a example.
>
> Regards
> JB
>
> On 23/08/2019 14:43, Krenn Daniel wrote:
>> Hello!
>>
>>  
>>
>> We have several blueprint XMLs in our Karaf’s deploy directory. We now
>> need to use beans in those blueprints.
>>
>> How do I best make my beans available to the blueprints inside of our
>> Karaf’s deploy directory?
>>
>>  
>>
>> Currently, I just mvn clean install my project where I develop my beans.
>> This gives me a JAR file which I can drop in the deploy folder. This
>> way, I can access my beans.
>>
>> I just don’t know how to handle dependencies this way.
>>
>>  
>>
>> For example, I need the apache-commons library. I have declared this
>> dependency in my POM.xml, like
>>
>>  
>>
>> <dependency>
>>
>> <groupId>org.apache.commons</groupId>
>>
>> <artifactId>commons-lang3</artifactId>
>>
>> <version>3.4</version>
>>
>> </dependency>
>>
>>  
>>
>> But inside Karaf, the dependency doesn’t seem to be available, as I’m
>> getting some ClassNotFound exceptions.
>>
>> I tried to use the maven-assembly-plugin with “jar-with-dependencies”,
>> in order to just bundle all dependencies with my project, but that
>> yields a JAR file over 50MB in size. I do have a high number of
>> dependencies. When I try to deploy that, Karaf just crashes.
>>
>>  
>>
>> Does anyone know a better approach?
>>
>>  
>>
>> Best regards,
>>
>> *Daniel* *Krenn*
>> Consultant Manufacturing Execution
>>
>> [hidden email] <mailto:[hidden email]>
> <mailto:[hidden email]>
>>
>>
>>
>>  |   Tel. +49 (9931) 981 365
>>
>>
>>
>>  
>>
>>  
>>
>> T.CON GmbH & Co. KG <https://www.team-con.de/> T.CON GmbH & Co. KG ​
>> ​*www.team-con.de* <http://www.team-con.de/>
>>  
>>
>> *​*
>> <http://www.team-con.de/>Hauptsitz: Straubinger Straße 2 | 94447 
>> Plattling | Tel: *+49 (0)9931 981-100* <tel:+499931981100>
>> ​​*Events*
>> <http://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltung
> <http://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltung%0b>>
> en.html> | *Newsletter* <https://www2.team-con.de/newsletter>
>>
>> T.CON | Facebook <https://www.facebook.com/TEAMCONde/>
>> T.CON | Twitter <https://twitter.com/team_consulting>
>>
>> T.CON | LinkedIn <https://www.linkedin.com/company/t-con-gmbh-&-co-kg/>
>> T.CON | YouTube <https://www.youtube.com/user/TEAMCONde>
>>
>> T.CON | Instagram <https://www.instagram.com/team.consulting/>
>> T.CON | Xing <https://www.xing.com/companies/t.congmbhco.kg>
>>
>>
>> SAP Gold Partner <https://www.sap.com/germany/index.html>
>>
>> Geschäftsführer: Karl Fuchs, Michael Gulde, Stefan Fiedler | KG: AG
>> Deggendorf HRA 1618 Pers. haftender Ges.: T.CON Beteiligungs-GmbH |
>> Sitz: Plattling | AG Deggendorf HRB 2053
>>
>> iT.CONnect 2019
>> <https://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltun
> <https://www.team-con.de/unternehmen/news-veranstaltungen/veranstaltun%0b>>
> gen/itconnect.html?utm_source=employee&utm_medium=email&utm_campaign=d
>> e_it.connect>
>>
>
> --
> Jean-Baptiste Onofré
> [hidden email] <mailto:[hidden email]>
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com