Hi Nicolas, let me try to clear up some of that fog :) when installing certain features which depend on each other in the same "run" you might end up with a "race-condition" as the required feature isn't installed as it would usually be installed in the same run. One example for this is if you have bundles using the wrap: URL-Handler, those require the wrap-feature to be installed prior to the using feature. To navigate around this, you need to declare your own feature to be dependent on the other feature with a prerequisite.
Now concerning your blueprint bundles, those need to have the blueprint feature installed prior to your own bundle. So in that case you either can set your own bundles start level much higher then the blueprint one and hope that this works out or also set the prerequisite flag on this feature set. regards, Achim 2016-02-19 20:17 GMT+01:00 Nicolas Brasey <[email protected]>: > Hi Achim, > > Thanks a lot for your comment, even if I still don't fully understand what > was wrong, I finally got it to work. Maybe you can explain me more... > > Even if I did not really understood what you meant by "placing brackets > around them", it made me play with the start level of my bundle and set > higher than 100. I set mine to 500 to make sure they get loader after the > system bundles. And maybe that is what you meant, but I also had to > duplicate the declaration of my features both in "bootFeature" section and > in "startupFeatures". What is the reason for doing so ? > > > Here is the extract from my pom: > > <plugin> > <groupId>org.apache.karaf.tooling</groupId> > <artifactId>karaf-maven-plugin</artifactId> > <configuration> > <javase>1.8</javase> > > <bootFeatures> > <feature>wrap</feature> > <feature>aries-blueprint</feature> > <feature>shell</feature> > <feature>shell-compat</feature> > <feature>feature</feature> > <feature>jaas</feature> > <feature>ssh</feature> > <feature>management</feature> > <feature>bundle</feature> > <feature>config</feature> > <feature>deployer</feature> > <feature>diagnostic</feature> > <feature>feature</feature> > <feature>instance</feature> > <feature>kar</feature> > <feature>log</feature> > <feature>package</feature> > <feature>service</feature> > <feature>system</feature> > > > <feature>dms-content</feature> > <feature>dms-item</feature> > <feature>dms-file</feature> > </bootFeatures> > > <installedFeatures> > <feature>wrapper</feature> > </installedFeatures> > > > <startupFeatures> > <feature>eventadmin</feature> > <feature>dms-content</feature> > <feature>dms-item</feature> > <feature>dms-file</feature> > </startupFeatures> > > </configuration> > </plugin> > > > Thanks a lot!! > > Have a very good weekend! > Regards, > > Nicolas > > > > > On Fri, Feb 19, 2016 at 6:52 PM, Achim Nierbeck <[email protected]> > wrote: > >> Hi, >> >> did you set your own bundle also as a boot feature, in that case separate >> the karaf boot features from your own feature by placing brackets around >> them. As you would do with the wrap feature. (See ml for details of that) >> Most likely it's because while your feature is installed the blueprint >> one isn't available yet. >> >> Regards, Achim >> >> sent from mobile device >> Am 19.02.2016 5:29 nachm. schrieb "Nicolas Brasey" < >> [email protected]>: >> >>> Hi Morgan, >>> >>> Thanks for the quick reply! >>> >>> Here is my feature. I use the karaf-maven-plugin to generate it from my >>> pom.xml transitive dependencies: >>> >>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> >>> <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" >>> name="dms-content-features"> >>> >>> <repository>mvn:org.apache.karaf.features/standard/4.0.4/xml/features</repository> >>> >>> <repository>mvn:org.apache.cxf.karaf/apache-cxf/3.1.2/xml/features</repository> >>> <feature name="dms-content" description="dms-content-features" >>> version="0.0.1.SNAPSHOT"> >>> <configfile >>> finalname="/etc/dms.content.cfg">mvn:com.xxx.dms/dms-content-features/0.0.1-SNAPSHOT/cfg</configfile> >>> <feature prerequisite="false" dependency="true">cxf</feature> >>> <feature prerequisite="false" >>> dependency="true">cxf-http-jetty</feature> >>> <bundle >>> start-level="100">mvn:com.xxx.dms/dms-content-core-impl/0.0.1-SNAPSHOT</bundle> >>> <bundle >>> start-level="100">mvn:com.xxx.dms/dms-content-core-api/0.0.1-SNAPSHOT</bundle> >>> <bundle >>> start-level="100">mvn:com.xxx.dms/dms-content-storage-api/0.0.1-SNAPSHOT</bundle> >>> <bundle >>> start-level="100">mvn:com.xxx.dms/dms-model/0.0.1-SNAPSHOT</bundle> >>> <bundle >>> start-level="100">mvn:com.fasterxml.jackson.core/jackson-annotations/2.6.3</bundle> >>> <bundle >>> start-level="100">mvn:com.fasterxml.jackson.core/jackson-databind/2.6.3</bundle> >>> <bundle >>> start-level="100">mvn:com.fasterxml.jackson.core/jackson-core/2.6.3</bundle> >>> <bundle >>> start-level="100">mvn:com.google.guava/guava/18.0</bundle> >>> <bundle >>> start-level="100">mvn:com.xxx.dms/dms-content-rs-cxf/0.0.1-SNAPSHOT</bundle> >>> <bundle >>> start-level="100">mvn:com.xxx.dms/dms-content-rs-api/0.0.1-SNAPSHOT</bundle> >>> <bundle >>> start-level="100">mvn:org.apache.cxf/cxf-rt-frontend-jaxrs/3.1.2</bundle> >>> <bundle >>> start-level="100">mvn:org.apache.cxf/cxf-core/3.1.2</bundle> >>> <bundle >>> start-level="100">mvn:org.codehaus.woodstox/woodstox-core-asl/4.4.1</bundle> >>> <bundle >>> start-level="100">mvn:org.codehaus.woodstox/stax2-api/3.1.4</bundle> >>> <bundle >>> start-level="100">mvn:org.apache.ws.xmlschema/xmlschema-core/2.2.1</bundle> >>> <bundle start-level="100">mvn:javax.ws.rs/javax.ws.rs-api/2.0.1 >>> </bundle> >>> <bundle >>> start-level="100">mvn:javax.annotation/javax.annotation-api/1.2</bundle> >>> <bundle >>> start-level="100">mvn:org.apache.cxf/cxf-rt-transports-http/3.1.2</bundle> >>> <bundle >>> start-level="100">mvn:com.xxx.dms/dms-common/0.0.1-SNAPSHOT</bundle> >>> <bundle >>> start-level="100">mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider/2.6.3</bundle> >>> <bundle >>> start-level="100">mvn:com.fasterxml.jackson.jaxrs/jackson-jaxrs-base/2.6.3</bundle> >>> <bundle >>> start-level="100">mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/2.6.3</bundle> >>> <bundle >>> start-level="100">mvn:com.xxx.dms/dms-content-storage-gridfs/0.0.1-SNAPSHOT</bundle> >>> <bundle >>> start-level="100">mvn:org.mongodb/mongo-java-driver/3.0.0</bundle> >>> </feature> >>> </features> >>> >>> >>> As you can see, the feature seems to be correct: >>> >>> <bundle >>> start-level="100">mvn:com.xxx.dms/dms-content-rs-cxf/0.0.1-SNAPSHOT</bundle> >>> >>> >>> The OSGi resolver error message are still a little cryptic for me at the >>> moment, I'm not sure what the resolver is trying the find, but I believe it >>> cannot find blueprint: >>> >>> osgi.wiring.package; >>> filter:="(&(osgi.wiring.package=org.osgi.service.blueprint)(version>=1.0.0)(!(version>=2.0.0)))"]] >>> >>> >>> I cannot figure why as I thought it was embedded in the base karaf >>> features. >>> >>> >>> Thanks again! >>> Nicolas >>> >>> >>> >>> >>> On Fri, Feb 19, 2016 at 4:53 PM, Morgan <[email protected]> >>> wrote: >>> >>>> Nicolas, >>>> >>>> From what I read in your pom. Your feature should look for >>>> >>>> com.xxx.dms/content-rs-cxf/0.0.1.SNAPSHOT >>>> >>>> instead of >>>> >>>> com.xxx.dms.content-rs-cxf/0.0.1.SNAPSHOT >>>> >>>> Regards, >>>> Morgan >>>> >>>> On 2016-02-19 15:46, Nicolas Brasey wrote: >>>> >>>> Hey guys, >>>> >>>> I'm evaluating karaf at the moment to be our middleware runtime for our >>>> product. >>>> >>>> Our solution runs within internal networks with no connection to the >>>> outside world so we need built our custom karaf distribution containing all >>>> the needed bundles already packaged in the system repository. >>>> >>>> I trying to create my own distribution based on the example found on >>>> the documentation, but I can't figure out why the felix resolver cannot >>>> resolve a package: >>>> >>>> Caused by: org.osgi.service.resolver.ResolutionException: Unable to >>>> resolve root: missing requirement [root] osgi.identity; >>>> osgi.identity=dms-content; type=karaf.feature; version=0.0.1.SNAPSHOT; >>>> filter:="(&(osgi.identity=dms-content)(type=karaf.feature)(version>=0.0.1.SNAPSHOT))" >>>> [caused by: Unable to resolve dms-content/0.0.1.SNAPSHOT: missing >>>> requirement [dms-content/0.0.1.SNAPSHOT] osgi.identity; >>>> osgi.identity=com.xxx.dms.content-rs-cxf; type=osgi.bundle; >>>> version="[0.0.1.SNAPSHOT,0.0.1.SNAPSHOT]"; resolution:=mandatory [caused >>>> by: Unable to resolve com.xxx.dms.content-rs-cxf/0.0.1.SNAPSHOT: missing >>>> requirement [com.xxx.dms.content-rs-cxf/0.0.1.SNAPSHOT] >>>> osgi.wiring.package; >>>> filter:="(&(osgi.wiring.package=org.osgi.service.blueprint)(version>=1.0.0)(!(version>=2.0.0)))"]] >>>> at >>>> org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42) >>>> at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:235) >>>> at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:158) >>>> at >>>> org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:216) >>>> at >>>> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:263) >>>> at org.apache.karaf.profile.assembly.Builder.resolve(Builder.java:1214) >>>> at >>>> org.apache.karaf.profile.assembly.Builder.startupStage(Builder.java:1002) >>>> at >>>> org.apache.karaf.profile.assembly.Builder.doGenerateAssembly(Builder.java:606) >>>> at >>>> org.apache.karaf.profile.assembly.Builder.generateAssembly(Builder.java:389) >>>> at >>>> org.apache.karaf.tooling.AssemblyMojo.doExecute(AssemblyMojo.java:392) >>>> at org.apache.karaf.tooling.AssemblyMojo.execute(AssemblyMojo.java:228) >>>> ... 22 more >>>> >>>> >>>> >>>> >>>> Here is the content of the pom.xml: >>>> >>>> >>>> <?xml version="1.0" encoding="UTF-8"?> >>>> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=" >>>> http://www.w3.org/2001/XMLSchema-instance" >>>> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 >>>> http://maven.apache.org/xsd/maven-4.0.0.xsd"> >>>> <modelVersion>4.0.0</modelVersion> >>>> >>>> <parent> >>>> <artifactId>dms-karaf</artifactId> >>>> <groupId>com.xxx.dms</groupId> >>>> <version>0.0.1-SNAPSHOT</version> >>>> </parent> >>>> >>>> <artifactId>dms-karaf-minimal</artifactId> >>>> <packaging>karaf-assembly</packaging> >>>> <name>${project.artifactId}</name> >>>> >>>> <dependencies> >>>> <dependency> >>>> <!-- scope is compile so all features (there is only one) >>>> are installed into startup.properties and the feature repo itself is not >>>> added in etc/org.apache.karaf.features.cfg file --> >>>> <groupId>org.apache.karaf.features</groupId> >>>> <artifactId>framework</artifactId> >>>> <version>4.0.4</version> >>>> <type>kar</type> >>>> </dependency> >>>> >>>> <dependency> >>>> <!-- scope is runtime so the feature repo is listed in >>>> etc/org.apache.karaf.features.cfg file, and features will installed into >>>> the system directory --> >>>> <groupId>org.apache.karaf.features</groupId> >>>> <artifactId>standard</artifactId> >>>> <classifier>features</classifier> >>>> <version>4.0.4</version> >>>> <type>xml</type> >>>> <scope>runtime</scope> >>>> </dependency> >>>> >>>> <dependency> >>>> <!-- scope is runtime so the feature repo is listed in >>>> etc/org.apache.karaf.features.cfg file, and features will installed into >>>> the system directory if specify in the plugin configuration --> >>>> <groupId>com.xxx.dms</groupId> >>>> <artifactId>dms-content-features</artifactId> >>>> <version>${project.version}</version> >>>> <classifier>features</classifier> >>>> <type>xml</type> >>>> <scope>compile</scope> >>>> </dependency> >>>> >>>> >>>> </dependencies> >>>> >>>> <build> >>>> <!-- if you want to include resources in the distribution --> >>>> <resources> >>>> <resource> >>>> <directory>src/main/resources</directory> >>>> <filtering>false</filtering> >>>> <includes> >>>> <include>**/*</include> >>>> </includes> >>>> </resource> >>>> <resource> >>>> <directory>src/main/filtered-resources</directory> >>>> <filtering>true</filtering> >>>> <includes> >>>> <include>**/*</include> >>>> </includes> >>>> </resource> >>>> </resources> >>>> >>>> <plugins> >>>> <!-- if you want to include resources in the distribution >>>> --> >>>> <plugin> >>>> <groupId>org.apache.maven.plugins</groupId> >>>> <artifactId>maven-resources-plugin</artifactId> >>>> <version>2.6</version> >>>> <executions> >>>> <execution> >>>> <id>process-resources</id> >>>> <goals> >>>> <goal>resources</goal> >>>> </goals> >>>> </execution> >>>> </executions> >>>> </plugin> >>>> >>>> <!-- karaf-maven-plugin will call both assembly and archive >>>> goals --> >>>> <plugin> >>>> <groupId>org.apache.karaf.tooling</groupId> >>>> <artifactId>karaf-maven-plugin</artifactId> >>>> <configuration> >>>> <javase>1.8</javase> >>>> >>>> <bootFeatures> >>>> <feature>jaas</feature> >>>> <feature>shell</feature> >>>> <feature>ssh</feature> >>>> <feature>management</feature> >>>> <feature>bundle</feature> >>>> <feature>config</feature> >>>> <feature>deployer</feature> >>>> <feature>diagnostic</feature> >>>> <feature>instance</feature> >>>> <feature>kar</feature> >>>> <feature>log</feature> >>>> <feature>package</feature> >>>> <feature>service</feature> >>>> <feature>system</feature> >>>> <feature>aries-blueprint</feature> >>>> <feature>dms-content</feature> >>>> </bootFeatures> >>>> >>>> </configuration> >>>> </plugin> >>>> </plugins> >>>> </build> >>>> </project> >>>> >>>> >>>> >>>> Thanks a lot! >>>> >>>> Nicolas >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>> > -- 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
