You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Krenn Daniel <Da...@team-con.de> on 2019/08/23 12:43:35 UTC

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
Daniel.Krenn@team-con.de<ma...@team-con.de>
 |   Tel. +49 (9931) 981 365



T.CON GmbH & Co. KG 
​www.team-con.de
 
​Hauptsitz: Straubinger Straße 2 | 94447 Plattling | Tel: +49 (0)9931 981-100
​​Events | Newsletter
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
 

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

Posted by Kamil Paśko <ka...@antologic.com>.
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: Krenn Daniel
Wysłano: piątek, 23 sierpnia 2019 14:43
Do: user@karaf.apache.org
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
Daniel.Krenn@team-con.de

 |   Tel. +49 (9931) 981 365

 


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


​Hauptsitz: Straubinger Straße 2 | 94447 Plattling | Tel: +49 (0)9931 981-100
​​Events | Newsletter



















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











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

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
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
> 
> Daniel.Krenn@team-con.de <ma...@team-con.de>
> 
> 	
> 
>  |   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 <Da...@team-con.de>
> *Gesendet:* Montag, 26. August 2019 11:29
> *An:* user@karaf.apache.org
> *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:Daniel.Krenn@team-con.de  | 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é <jb@nanthrax.net <ma...@nanthrax.net>>
> Gesendet: Samstag, 24. August 2019 07:34
> An: user@karaf.apache.org <ma...@karaf.apache.org>
> 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
>>
>> Daniel.Krenn@team-con.de <ma...@team-con.de>
> <ma...@team-con.de>
>>
>>
>>
>>  |   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é
> jbonofre@apache.org <ma...@apache.org>
> http://blog.nanthrax.net
> Talend - http://www.talend.com
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

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

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
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
> 
> Daniel.Krenn@team-con.de <ma...@team-con.de>
> 
> 	
> 
>  |   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 <Da...@team-con.de>
> *Gesendet:* Montag, 26. August 2019 11:29
> *An:* user@karaf.apache.org
> *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:Daniel.Krenn@team-con.de  | 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é <jb@nanthrax.net <ma...@nanthrax.net>>
> Gesendet: Samstag, 24. August 2019 07:34
> An: user@karaf.apache.org <ma...@karaf.apache.org>
> 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
>>
>> Daniel.Krenn@team-con.de <ma...@team-con.de>
> <ma...@team-con.de>
>>
>>
>>
>>  |   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é
> jbonofre@apache.org <ma...@apache.org>
> http://blog.nanthrax.net
> Talend - http://www.talend.com
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

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

Posted by Krenn Daniel <Da...@team-con.de>.
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
Daniel.Krenn@team-con.de<ma...@team-con.de>
 |   Tel. +49 (9931) 981 365



T.CON GmbH & Co. KG 
​www.team-con.de
 
​Hauptsitz: Straubinger Straße 2 | 94447 Plattling | Tel: +49 (0)9931 981-100
​​Events | Newsletter
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
 
Von: Krenn Daniel <Da...@team-con.de>
Gesendet: Montag, 26. August 2019 11:29
An: user@karaf.apache.org
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:Daniel.Krenn@team-con.de  | 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é <jb...@nanthrax.net>>
Gesendet: Samstag, 24. August 2019 07:34
An: user@karaf.apache.org<ma...@karaf.apache.org>
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
>
> Daniel.Krenn@team-con.de<ma...@team-con.de> <ma...@team-con.de>
>
>
>
>  |   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é
jbonofre@apache.org<ma...@apache.org>
http://blog.nanthrax.net
Talend - http://www.talend.com

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

Posted by Krenn Daniel <Da...@team-con.de>.
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:Daniel.Krenn@team-con.de  |   Tel. +49 (9931) 981 365  


T.CON GmbH & Co. KG 
​www.team-con.de
 
​Hauptsitz: Straubinger Straße 2 | 94447 Plattling | Tel: +49 (0)9931 981-100
​​Events | Newsletter
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
 
-----Ursprüngliche Nachricht-----
Von: Jean-Baptiste Onofré <jb...@nanthrax.net> 
Gesendet: Samstag, 24. August 2019 07:34
An: user@karaf.apache.org
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
> 
> Daniel.Krenn@team-con.de <ma...@team-con.de>
> 
> 	
> 
>  |   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é
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

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

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
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
> 
> Daniel.Krenn@team-con.de <ma...@team-con.de>
> 
> 	
> 
>  |   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é
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com