karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Krenn Daniel <Daniel.Kr...@team-con.de>
Subject AW: Weird issues with feature.xml
Date Mon, 26 Aug 2019 17:40:43 GMT
Hi Jean-Baptiste,

thanks for your info, I found it very useful.
I removed a bunch of bundles from my feature.xml and now it works!

This is my current feature.xml:

<?xml version="1.0" encoding="UTF-8"?>
<features name="${project.artifactId}-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.0.0">
    <feature name='${project.artifactId}' version='${project.version}'>
        <feature prerequisite="true" dependency="false">wrap</feature>
        <!-- MILO -->
        <bundle>mvn:org.eclipse.milo/sdk-core/0.2.5</bundle>
        <bundle>mvn:org.eclipse.milo/sdk-client/0.2.5</bundle>
        <bundle>mvn:org.eclipse.milo/sdk-server/0.2.5</bundle>

        <bundle>mvn:org.eclipse.milo/bsd-parser-core/0.2.5</bundle>

        <bundle>mvn:org.eclipse.milo/stack-core/0.2.5</bundle>
        <bundle>mvn:org.eclipse.milo/stack-client/0.2.5</bundle>
        <bundle>mvn:org.eclipse.milo/stack-server/0.2.5</bundle>

        <!-- GOOGLE -->
        <bundle dependency="true">mvn:com.google.guava/guava/19.0</bundle>
        <bundle dependency="true">mvn:com.google.code.gson/gson/2.8.2</bundle>
        <bundle dependency="true">mvn:com.google.code.findbugs/jsr305/3.0.1</bundle>

        <!-- NETTY -->
        <bundle dependency="true">mvn:io.netty/netty-codec/4.0.56.Final</bundle>
        <bundle dependency="true">mvn:io.netty/netty-transport/4.0.56.Final</bundle>
        <bundle dependency="true">mvn:io.netty/netty-handler/4.0.56.Final</bundle>
        <bundle dependency="true">mvn:io.netty/netty-buffer/4.0.56.Final</bundle>
        <bundle dependency="true">mvn:io.netty/netty-common/4.0.56.Final</bundle>

        <!-- APACHE -->
        <bundle dependency="true">mvn:org.apache.commons/commons-lang3/3.4</bundle>

        <!-- OTHER -->
        <bundle dependency="true">mvn:com.codepoetics/protonpack/1.8</bundle>
        <bundle dependency="true">mvn:io.dropwizard.metrics/metrics-core/3.1.2</bundle>
        <bundle dependency="true">mvn:org.mongodb/mongo-java-driver/3.10.1</bundle>
        <bundle dependency="true">mvn:org.jooq/jool/0.9.10</bundle>
        <bundle dependency="true">mvn:org.json/json/20160810</bundle>

        <!-- THE ACTUAL BEANS-->
        <bundle>wrap:mvn:com.tcon/beans/${project.version}</bundle>
    </feature>
</features>

I still have some questions, though. I want to really understand why it works now.

1. When I execute dependency:tree on my project, I get an additional like 15 dependencies.
But I found that I can get away with not including them in my feature.xml. Why is that? Are
those dependencies already exposed by another feature inside karaf?


2. I'm not sure about the dependency=true flag. I read online that if that flag is set, the
dependency resolver only includes these dependencies if they are truly necessary. How does
the resolver determine that? Does it look at my imports and somehow extrapolates which dependencies
it needs? It's a bit weird, because my KAR was 9MB in size before I set all these dependency=true
flags, now it's 2,5MB and doesn't include any of the dependencies I marked with dependency=true...


3. I had to compile this feature.xml manually, which took a really long time. Can I somehow
do that automatically? I already tried the karaf-maven-plugin with the feature goal. It doesn't
seem to work with my project structure, though.

My structure looks as follows
  _ parent
|__ beanproject, this holds all my beans
|__ featureproject, this holds just my feature.xml

My parent project holds the two other projects as modules. The parent project has <packaging>pom</packaging>
defined as packaging.
Now, if I try to use <packaging>feature</packaging> in my featureproject I get
the error: The packaging plugin for this project did not assign a main file to the project
but it has attachments. Change packaging to 'pom'.

I would really like it if the feature.xml gets generated automatically from my POM, and then
used again to generate the KAR file with all needed dependencies, including my bean project.
Is that possible?

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: Montag, 26. August 2019 15:59
An: user@karaf.apache.org
Betreff: Re: Weird issues with feature.xml

Hi,

The reason is because one of your bundle has a requirement to Spring in a version between
2.x and 4.x (excluded):

(&(osgi.wiring.package=org.springframework.beans)(version>=2.5.0)(!(version>=4.0.0))

By default, Karaf ships Spring 5.x.

You have to add the spring-legacy features XML (or reference it in your
features.xml):

feature:repo-add spring-legacy

spring-legacy brings "old" Spring version, including 3.x one.

By the way, I don't think your features.xml is good: you are bringing a bunch of non OSGi
bundle whereas you have features in Karaf available for that (for instance, it's the case
for spring).

Regards
JB

On 26/08/2019 14:49, Krenn Daniel wrote:
> Hello all,
> 
>  
> 
> I have this feature.xml:
> 
>  
> 
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <features name="beanbundle"
> xmlns="http://karaf.apache.org/xmlns/features/v1.0.0">
> 
>     <feature name='beanbundle' description='${project.name}' 
> version='1'>
> 
>         <details>${project.description}</details>
> 
>         <feature>wrap</feature>
> 
>         <bundle>mvn:org.eclipse.milo/sdk-core/0.2.5</bundle>
> 
>         <bundle>mvn:org.eclipse.milo/sdk-client/0.2.5</bundle>
> 
>         <bundle>mvn:org.eclipse.milo/bsd-parser-core/0.2.5</bundle>
> 
>         <bundle>mvn:com.google.code.gson/gson/2.8.2</bundle>
> 
>         <bundle>wrap:mvn:javax.xml.bind/jaxb-api/2.2.7</bundle>
> 
>         <bundle>mvn:com.codepoetics/protonpack/1.8</bundle>
> 
>         <bundle>mvn:org.eclipse.milo/sdk-server/0.2.5</bundle>
> 
>         <bundle>mvn:io.dropwizard.metrics/metrics-core/3.1.2</bundle>
> 
>         <bundle>mvn:org.eclipse.milo/stack-core/0.2.5</bundle>
> 
>         <bundle>mvn:com.google.guava/guava/19.0</bundle>
> 
>         <bundle>mvn:com.google.code.findbugs/jsr305/3.0.1</bundle>
> 
>         <bundle>mvn:io.netty/netty-codec/4.0.56.Final</bundle>
> 
>         <bundle>mvn:io.netty/netty-transport/4.0.56.Final</bundle>
> 
>         <bundle>mvn:io.netty/netty-handler/4.0.56.Final</bundle>
> 
>         <bundle>mvn:io.netty/netty-buffer/4.0.56.Final</bundle>
> 
>         <bundle>mvn:io.netty/netty-common/4.0.56.Final</bundle>
> 
>         <bundle>mvn:org.jooq/jool/0.9.10</bundle>
> 
>         <bundle>mvn:org.eclipse.milo/stack-client/0.2.5</bundle>
> 
>         <bundle>mvn:org.eclipse.milo/stack-server/0.2.5</bundle>
> 
>         <bundle>mvn:org.mongodb/mongo-java-driver/3.10.1</bundle>
> 
>         <bundle>mvn:org.json/json/20160810</bundle>
> 
>         
> <bundle>mvn:org.eclipse.jetty/jetty-server/9.4.15.v20190215</bundle>
> 
>         
> <bundle>mvn:org.eclipse.jetty/jetty-http/9.4.15.v20190215</bundle>
> 
>         
> <bundle>mvn:org.eclipse.jetty/jetty-util/9.4.15.v20190215</bundle>
> 
>         
> <bundle>mvn:org.eclipse.jetty/jetty-io/9.4.15.v20190215</bundle>
> 
>         <bundle>mvn:org.apache.activemq/activemq-camel/5.9.1</bundle>
> 
>         
> <bundle>wrap:mvn:org.apache.activemq/activemq-spring/5.9.1</bundle>
> 
>         <bundle>mvn:org.apache.xbean/xbean-spring/3.15</bundle>
> 
>         
> <bundle>wrap:mvn:org.apache.activemq/activemq-broker/5.9.1</bundle>
> 
>        
> <bundle>wrap:mvn:org.apache.activemq/activemq-openwire-legacy/5.9.1</b
> undle>
> 
>        
> <bundle>wrap:mvn:org.apache.geronimo.specs/geronimo-jta_1.0.1B_spec/1.
> 0.1</bundle>
> 
>         
> <bundle>wrap:mvn:org.apache.activemq/activemq-pool/5.9.1</bundle>
> 
>        
> <bundle>wrap:mvn:org.apache.activemq/activemq-jms-pool/5.9.1</bundle>
> 
>      
>   
> <bundle>mvn:org.apache.geronimo.specs/geronimo-jms_1.1_spec/1.1.1</bun
> dle>
> 
>         
> <bundle>wrap:mvn:org.apache.activemq/activemq-client/5.9.1</bundle>
> 
>         <bundle>mvn:org.fusesource.hawtbuf/hawtbuf/1.9</bundle>
> 
>        
> <bundle>mvn:org.apache.geronimo.specs/geronimo-j2ee-management_1.1_spe
> c/1.0.1</bundle>
> 
>        
> <bundle>wrap:mvn:org.springframework/spring-context/4.1.5.RELEASE</bun
> dle>
> 
>         <bundle>mvn:org.osgi/org.osgi.core/6.0.0</bundle>
> 
>         
> <bundle>mvn:com.fasterxml.jackson.core/jackson-core/2.9.8</bundle>
> 
>         <bundle>mvn:org.apache.commons/commons-lang3/3.4</bundle>
> 
>         <bundle>mvn:org.slf4j/slf4j-api/1.7.12</bundle>
> 
>         <bundle>mvn:org.slf4j/slf4j-log4j12/1.7.12</bundle>
> 
>         <bundle>mvn:log4j/log4j/1.2.17</bundle>
> 
>         <bundle>mvn:org.eclipse.milo/sdk-core/0.2.4</bundle>
> 
>         <bundle>mvn:org.eclipse.milo/sdk-client/0.2.4</bundle>
> 
>         <bundle>mvn:org.eclipse.milo/bsd-parser-core/0.2.4</bundle>
> 
>         <bundle>mvn:org.eclipse.milo/sdk-server/0.2.4</bundle>
> 
>         <bundle>mvn:org.eclipse.milo/stack-core/0.2.4</bundle>
> 
>         <bundle>mvn:io.netty/netty-codec/4.0.36.Final</bundle>
> 
>         <bundle>mvn:io.netty/netty-transport/4.0.36.Final</bundle>
> 
>         <bundle>mvn:io.netty/netty-handler/4.0.36.Final</bundle>
> 
>         <bundle>mvn:io.netty/netty-buffer/4.0.36.Final</bundle>
> 
>         <bundle>mvn:io.netty/netty-common/4.0.36.Final</bundle>
> 
>         <bundle>mvn:org.eclipse.milo/stack-client/0.2.4</bundle>
> 
>         <bundle>mvn:org.eclipse.milo/stack-server/0.2.4</bundle>
> 
>         <bundle>mvn:javax.servlet/javax.servlet-api/3.1.0</bundle>
> 
>         <bundle>mvn:org.apache.activemq/activemq-camel/5.6.0</bundle>
> 
>         <bundle>mvn:org.apache.camel/camel-jms/2.9.2</bundle>
> 
>         <bundle>mvn:org.apache.camel/camel-spring/2.9.2</bundle>
> 
>         
> <bundle>mvn:org.springframework/spring-jms/3.0.7.RELEASE</bundle>
> 
>         
> <bundle>mvn:org.springframework/spring-tx/3.0.7.RELEASE</bundle>
> 
>         <bundle>mvn:org.apache.activemq/activemq-core/5.6.0</bundle>
> 
>         <bundle>mvn:org.apache.activemq/kahadb/5.6.0</bundle>
> 
>        
> <bundle>wrap:mvn:org.apache.activemq.protobuf/activemq-protobuf/1.1</b
> undle>
> 
>        
> <bundle>wrap:mvn:org.fusesource.fuse-extra/fusemq-leveldb/1.1</bundle>
> 
>         <bundle>mvn:org.fusesource.hawtbuf/hawtbuf-proto/1.9</bundle>
> 
>        
> <bundle>mvn:org.fusesource.hawtdispatch/hawtdispatch-scala/1.9</bundle
> >
> 
>         
> <bundle>mvn:org.fusesource.hawtdispatch/hawtdispatch/1.9</bundle>
> 
>         <bundle>wrap:mvn:org.iq80.leveldb/leveldb/0.2</bundle>
> 
>         <bundle>wrap:mvn:org.iq80.leveldb/leveldb-api/0.2</bundle>
> 
>         <bundle>mvn:com.google.inject/guice/3.0</bundle>
> 
>         <bundle>wrap:mvn:javax.inject/javax.inject/1</bundle>
> 
>        
> <bundle>mvn:com.google.inject.extensions/guice-multibindings/3.0</bund
> le>
> 
>        
> <bundle>wrap:mvn:org.fusesource.leveldbjni/leveldbjni-osx/1.2</bundle>
> 
>         <bundle>mvn:org.fusesource.leveldbjni/leveldbjni/1.2</bundle>
> 
>         
> <bundle>wrap:mvn:org.fusesource.hawtjni/hawtjni-runtime/1.5</bundle>
> 
>        
> <bundle>wrap:mvn:org.fusesource.leveldbjni/leveldbjni-linux32/1.2</bun
> dle>
> 
>        
> <bundle>wrap:mvn:org.fusesource.leveldbjni/leveldbjni-linux64/1.2</bun
> dle>
> 
>         <bundle>mvn:org.xerial.snappy/snappy-java/1.0.3</bundle>
> 
>         
> <bundle>mvn:org.codehaus.jackson/jackson-core-asl/1.9.2</bundle>
> 
>         
> <bundle>mvn:org.codehaus.jackson/jackson-mapper-asl/1.9.2</bundle>
> 
>         <bundle>wrap:mvn:org.apache.hadoop/hadoop-core/1.0.0</bundle>
> 
>         
> <bundle>mvn:commons-configuration/commons-configuration/1.6</bundle>
> 
>         
> <bundle>mvn:commons-collections/commons-collections/3.2.1</bundle>
> 
>         <bundle>mvn:commons-lang/commons-lang/2.4</bundle>
> 
>         
> <bundle>wrap:mvn:commons-digester/commons-digester/1.8</bundle>
> 
>         
> <bundle>wrap:mvn:commons-beanutils/commons-beanutils/1.7.0</bundle>
> 
>        
> <bundle>wrap:mvn:commons-beanutils/commons-beanutils-core/1.8.0</bundl
> e>
> 
>         <bundle>mvn:org.mortbay.jetty/jetty/6.1.26</bundle>
> 
>         
> <bundle>mvn:org.mortbay.jetty/servlet-api/2.5-20081211</bundle>
> 
>         <bundle>mvn:org.mortbay.jetty/jetty-util/6.1.26</bundle>
> 
>         <bundle>mvn:org.mortbay.jetty/jsp-api-2.1/6.1.14</bundle>
> 
>         <bundle>mvn:org.mortbay.jetty/servlet-api-2.5/6.1.14</bundle>
> 
>         <bundle>mvn:org.mortbay.jetty/jsp-2.1/6.1.14</bundle>
> 
>         <bundle>wrap:mvn:ant/ant/1.6.5</bundle>
> 
>         <bundle>wrap:mvn:org.scala-lang/scala-library/2.9.1</bundle>
> 
>         
> <bundle>mvn:org.fusesource.mqtt-client/mqtt-client/1.0</bundle>
> 
>        
> <bundle>mvn:org.fusesource.hawtdispatch/hawtdispatch-transport/1.9</bu
> ndle>
> 
>         <bundle>mvn:commons-net/commons-net/2.2</bundle>
> 
>         <bundle>wrap:mvn:org.jasypt/jasypt/1.8</bundle>
> 
>        
> <bundle>wrap:mvn:org.springframework/spring-aop/4.1.5.RELEASE</bundle>
> 
>         <bundle>wrap:mvn:aopalliance/aopalliance/1.0</bundle>
> 
>        
> <bundle>wrap:mvn:org.springframework/spring-beans/4.1.5.RELEASE</bundl
> e>
> 
>        
> <bundle>wrap:mvn:org.springframework/spring-core/4.1.5.RELEASE</bundle
> >
> 
>        
> <bundle>wrap:mvn:org.springframework/spring-expression/4.1.5.RELEASE</
> bundle>
> 
>     </feature>
> 
> </features>
> 
>  
> 
> When I try to drop that feature.xml in my Karaf’s deploy folder, I get 
> this error in my karaf shell:
> 
>  
> 
> Error executing command: Unable to resolve root: missing requirement 
> [root] osgi.identity; osgi.identity=beanbundle; type=karaf.feature; 
> version="[1.0.0,1.0.0]"; 
> filter:="(&(osgi.identity=beanbundle)(type=karaf.feature)(version>=1.0.0)(version<=1.0.0))"
> [caused by: Unable to resolve beanbundle/1.0.0: missing requirement 
> [beanbundle/1.0.0] osgi.identity; 
> osgi.identity=org.apache.xbean.spring;
> type=osgi.bundle; version="[3.15.0,3.15.0]"; resolution:=mandatory 
> [caused by: Unable to resolve org.apache.xbean.spring/3.15.0: missing 
> requirement [org.apache.xbean.spring/3.15.0] osgi.wiring.package; 
> filter:="(&(osgi.wiring.package=org.springframework.beans)(version>=2.
> 5.0)(!(version>=4.0.0)))"]]
> 
>  
> 
> If I read this error correctly, it’s trying to find
> org.apache.xbean.spring/3.15.0 on a maven repo. But the version 3.15.0 
> doesn’t exist on any maven repo. Also, in the feature.xml it also says 3.15.
> 
> When I substitute the version 3.15 with the version 3.4.1 (which has 
> two separation points), I get a different error, so I assume it could 
> be resolved.
> 
>  
> 
> The same happens with the
> <bundle>mvn:org.springframework/spring-jms/3.0.7.RELEASE</bundle>
> bundle. This seems to get muddled into 
> org.springframework.jms/3.0.7.RELEASE.
> 
>  
> 
> Am I doing something wrong or have I found a bug?
> 
>  
> 
> Best regards,
> 
> *Daniel* *Krenn*
> Consultant Manufacturing Execution
> 
> Daniel.Krenn@team-con.de <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/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

Mime
View raw message