[Karaf] Missing requirement

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

[Karaf] Missing requirement

GFO
Hello,

I am builing an application for Apache Karaf.

I am using karaf-maven-plugin for packaging by app in a KAR archive.

My project has some dependencies, and I want them to be included in KAR
file.

One of tese dependencies is slf4j. The KAR file contains it. But when I try
to deploy my KAR file into Karaf, I have the following error :



Here is my pom.xml file:



Do you know where my problem comes from?

Thanks a lot!



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

Re: [Karaf] Missing requirement

jbonofre
Hi,

you should not depend to the sfl4j bundle directly.

Your bundles should just do an optional imports to slf4j: the slf4j packages are
provided by pax-logging/log features already present in Karaf.

So basically, your kar should not embeds slf4j.

Regards
JB

On 12/14/2017 03:32 PM, GFO wrote:

> Hello,
>
> I am builing an application for Apache Karaf.
>
> I am using karaf-maven-plugin for packaging by app in a KAR archive.
>
> My project has some dependencies, and I want them to be included in KAR
> file.
>
> One of tese dependencies is slf4j. The KAR file contains it. But when I try
> to deploy my KAR file into Karaf, I have the following error :
>
>
>
> Here is my pom.xml file:
>
>
>
> Do you know where my problem comes from?
>
> Thanks a lot!
>
>
>
> --
> 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
GFO
Reply | Threaded
Open this post in threaded view
|

Re: [Karaf] Missing requirement

GFO
Hello jbonofre,

Thanks for your answer, I have specified slf4j as "optional" in my pom.xml
and I have excluded it in the karaf-maven-plugin configuration as below. Is
it the best way to do it?



Now, Karaf tries to install it. But it is very very long... such long that
it has never been installed for now. As an additional information, when
Karaf is trying to install my app, my CPU is around 90% of usage...

Maybe it comes from the amount of dependencies Karaf has to install via my
feature.xml file.

You'll find my feature.xml file below, generated by the plugin. What I
notice is that I have a lot of dependencies mentioned as "wrap". Does it can
be the source of the problem? If I have understood what "wrap" means, it
converts "basic" jars into bundles. I guess it can be time consuming and
resource consuming...
How can I deal with it? My app should be fast to install.



Thanks in advance for you answer.

Best regards,
GFO




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

Re: [Karaf] Missing requirement

jbonofre
Hi,

it's not possible to attach file on message for the mailing list.

Can you please send it to me via paste.bin or gist and eventually share your
project ?

Thanks,
Regards
JB

On 12/15/2017 10:21 AM, GFO wrote:

> Hello jbonofre,
>
> Thanks for your answer, I have specified slf4j as "optional" in my pom.xml
> and I have excluded it in the karaf-maven-plugin configuration as below. Is
> it the best way to do it?
>
>
>
> Now, Karaf tries to install it. But it is very very long... such long that
> it has never been installed for now. As an additional information, when
> Karaf is trying to install my app, my CPU is around 90% of usage...
>
> Maybe it comes from the amount of dependencies Karaf has to install via my
> feature.xml file.
>
> You'll find my feature.xml file below, generated by the plugin. What I
> notice is that I have a lot of dependencies mentioned as "wrap". Does it can
> be the source of the problem? If I have understood what "wrap" means, it
> converts "basic" jars into bundles. I guess it can be time consuming and
> resource consuming...
> How can I deal with it? My app should be fast to install.
>
>
>
> Thanks in advance for you answer.
>
> Best regards,
> GFO
>
>
>
>
> --
> 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
GFO
Reply | Threaded
Open this post in threaded view
|

Re: [Karaf] Missing requirement

GFO
Hello,

Indeed, I didn't notice my examples are not in my messages... thanks for the
information!

exclusion of slf4j : https://pastebin.com/Wa36sas1
feature.xml : https://pastebin.com/wr9S2q2t

Thanks.

Regards,
GFO



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

Re: [Karaf] Missing requirement

Achim Nierbeck
Hi,

you should try to depend on already existing features.
For one, there are spring features available from Karaf itself, that'll reduce already.
Same is for all the logging part.
Make sure to define your logging dependencies in your maven pom as
provided

CXF etc. are also features which already exist, for those you'll need to make sure to actually depend on those.

That'll help you.

regards, Achim

2017-12-15 10:33 GMT+01:00 GFO <[hidden email]>:
Hello,

Indeed, I didn't notice my examples are not in my messages... thanks for the
information!

exclusion of slf4j : https://pastebin.com/Wa36sas1
feature.xml : https://pastebin.com/wr9S2q2t

Thanks.

Regards,



--

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master 

GFO
Reply | Threaded
Open this post in threaded view
|

Re: [Karaf] Missing requirement

GFO
Hello Achim,

Thanks for your explanations.
I have marked several pom dependencies as "provided": my feature.xml is less
imposing.

My project needs the spring-jdbc dependency. I have noticed Spring is
provided by Karaf (I am using Karaf 4.0.9 through Servicemix) and permits to
use different Spring versions (3.2.18.RELEASE_1 and 4.3.5.RELEASE_1 for
instance).

By default, Spring version 3.2.18.RELEASE_1  is started by Karaf. At startup
I would like Spring 4.3.5.RELEASE_1 to be started.

=> Why does Spring 3.2.18.RELEASE_1 is started by default?

I noticed that Apache Camel (which is a Karaf provided feature) has
transitive Spring dependencies :

Feature depends on:
  camel-core 2.16.5
  camel-spring 2.16.5

and camel-spring depends on:

Feature depends on:
  spring [3.2,4)

=> Does Karaf start the first version of Spring it finds?

I tried to mention the version I want to be started through the featuresBoot
property but it does not work. Spring 3.2.18.RELEASE_1 is still started when
I start Apache Karaf.

Here is an extract of my featuresBoot property:

        spring;version=4.3.5.RELEASE_1, \
        spring-orm;version=4.3.5.RELEASE_1, \
        spring-tx;version=4.3.5.RELEASE_1, \
        spring-jdbc;version=4.3.5.RELEASE_1, \

=> Do you know how to force Apache Karaf to start a specific version of a
feature when several versions of a feature are available?

Thanks a lot.

Regards,
GFO



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