bundle() method comes from the PaxExam probe. A possible issue is that PaxExam probe doesn't have the DynamicImport-Package and so it doesn't use the URL.
Can you please create a Jira at OPS4J PaxExam ? I will take a look. In the mean time, using the bundle context as workaround is fine. Regards JB On 09/07/2018 14:32, Matteo Rulli wrote: > And the reference protocol works also if I install the exploded bundle > from the test method with: > > @Test > *public* *void* testCase() *throws* Exception { > /assertNotNull/(/bcontext/); > /bcontext/.installBundle("reference:file:/Users/username/git/contoso/iot/project-develop/support/project.sc.servlet/target/classes/").start(); > Thread./sleep/(Long.*/MAX_VALUE/*); > } > > So the only way it gives problem is with the bundle() option. Isn’t this > strange? Could it be a timing/race problem? Or a missing pax-exam > configuration? > > Matteo > >> On 9 Jul 2018, at 14:20, Matteo Rulli <matteo.ru...@gmail.com >> <mailto:matteo.ru...@gmail.com>> wrote: >> >> Hi, >> I’m using a custom Karaf distro where I modify the framework feature >> in order to include the pax-url-reference bundles in the >> startup.properties through the karaf-maven-plugin. >> >> Apparently, the pax-url-reference bundles are installed correctly and >> they work because if I start the test, I do ssh into the running karaf >> and execute the >> >> flairbit@root()> >> install >> reference:file:/Users/username/git/contoso/iot/project-develop/support/project.sc.servlet/target/classes/ >> Bundle ID: 131 >> >> the command works fine. Despite this, when I try to install the >> exploded bundle with the >> >> bundle("reference:file:target/classes/“) >> >> option, I get the reported error, both using the absolute and relative >> path for target folder. >> >> Thank you, >> Matteo >> >> >>> On 9 Jul 2018, at 13:39, Jean-Baptiste Onofré <j...@nanthrax.net >>> <mailto:j...@nanthrax.net>> wrote: >>> >>> Hi Matteo, >>> >>> it seems you are using in Pax Exam. Do you use your custom dispo in Pax >>> Exam ? I suspect that you use the standard Karaf distribution coming >>> with Pax Exam, so you will need to install pax-url-reference in >>> @Configuration of your test. >>> >>> Regards >>> JB >>> >>> On 09/07/2018 13:00, Matteo Rulli wrote: >>>> If I set >>>> >>>> bundle("reference:file:/Users/username/git/contoso/iot/project-develop/support/project.sc.servlet/target/classes/“), >>>> >>>> In the test opts (i.e. the absolute path of target folder) I get the >>>> same exception reported in the previous email (the data/tmp (Is a >>>> directory) one). >>>> >>>> Matteo >>>> >>>>> On 9 Jul 2018, at 12:52, Francois Papon >>>>> <francois.pa...@openobject.fr <mailto:francois.pa...@openobject.fr> >>>>> <mailto:francois.pa...@openobject.fr>> wrote: >>>>> >>>>> Ok, but I see in your code : >>>>> >>>>> bundle("reference:file:target/classes/") >>>>> >>>>> Could you try with the full path of the repository ? >>>>> >>>>> >>>>> Le 09/07/2018 à 14:50, Matteo Rulli a écrit : >>>>>> Yes. If I remove the bundle(“reference:….”) line in the test ops and >>>>>> I manually do >>>>>> >>>>>> installreference:file:/Users/username/git/contoso/iot/project-develop/support/project.sc.servlet/target/classes/ >>>>>> Bundle ID: 131 >>>>>> *flairbit*@root()> start131 >>>>>> >>>>>> Everything works just fine. >>>>>> >>>>>> Matteo >>>>>> >>>>>> >>>>>>> On 9 Jul 2018, at 12:24, Francois Papon >>>>>>> <francois.pa...@openobject.fr >>>>>>> <mailto:francois.pa...@openobject.fr> >>>>>>> <mailto:francois.pa...@openobject.fr>> >>>>>>> wrote: >>>>>>> >>>>>>> Does it work's without bundle("...") ? >>>>>>> >>>>>>> >>>>>>> Le 09/07/2018 à 14:09, Matteo Rulli a écrit : >>>>>>>> I’m using the Karaf version 4.1.2 and the test is running on MAC-OS. >>>>>>>> >>>>>>>>> On 9 Jul 2018, at 12:07, Francois Papon >>>>>>>>> <francois.pa...@openobject.fr <mailto:francois.pa...@openobject.fr> >>>>>>>>> <mailto:francois.pa...@openobject.fr>> wrote: >>>>>>>>> >>>>>>>>> Which version of Karaf are you using ? >>>>>>>>> >>>>>>>>> regards >>>>>>>>> >>>>>>>>> François >>>>>>>>> >>>>>>>>> >>>>>>>>> Le 09/07/2018 à 14:05, matteor a écrit : >>>>>>>>>> Sorry. It seems that message formatting in nabble does not work >>>>>>>>>> very well... >>>>>>>>>> Here is the message with all the details: >>>>>>>>>> >>>>>>>>>> I tried to enable the reference protocol in Karaf adding these >>>>>>>>>> bundles to >>>>>>>>>> the startup.properties: >>>>>>>>>> >>>>>>>>>> mvn\:org.ops4j.base/ops4j-base-lang/1.5.0 = 11 >>>>>>>>>> mvn\:org.ops4j.base/ops4j-base-util-property/1.5.0 = 11 >>>>>>>>>> mvn\:org.ops4j.pax.swissbox/pax-swissbox-property/1.8.3 = 11 >>>>>>>>>> mvn\:org.ops4j.pax.url/pax-url-commons/2.5.3 = 11 >>>>>>>>>> mvn\:org.ops4j.pax.url/pax-url-reference/2.5.3 = 12 >>>>>>>>>> >>>>>>>>>> And in fact now I can see the installed bundles in my runtime: >>>>>>>>>> >>>>>>>>>> list -t 0 -s | grep pax >>>>>>>>>> 4 │ Active │ 5 │ 2.5.2 │ org.ops4j.pax.url.mvn >>>>>>>>>> 5 │ Active │ 8 │ 1.10.1 │ >>>>>>>>>> org.ops4j.pax.logging.pax-logging-api >>>>>>>>>> 6 │ Active │ 8 │ 1.10.1 │ >>>>>>>>>> org.ops4j.pax.logging.pax-logging-log4j2 >>>>>>>>>> 15 │ Active │ 11 │ 1.8.3 │ >>>>>>>>>> org.ops4j.pax.swissbox.property >>>>>>>>>> 16 │ Active │ 11 │ 2.5.3 │ >>>>>>>>>> org.ops4j.pax.url.commons >>>>>>>>>> 17 │ Active │ 12 │ 2.5.3 │ >>>>>>>>>> org.ops4j.pax.url.reference >>>>>>>>>> 60 │ Active │ 5 │ 2.5.2 │ org.ops4j.pax.url.wrap >>>>>>>>>> >>>>>>>>>> But when in my test I try to use the protocol like this: >>>>>>>>>> >>>>>>>>>> Option[] options = new Option[] { >>>>>>>>>> systemProperty("pax.exam.osgi.unresolved.fail").value("true"), >>>>>>>>>> features(testUtils.getStandardRepo(), "aries-blueprint"), >>>>>>>>>> features(testUtils.getStandardRepo(), "http"), >>>>>>>>>> features(testUtils.getStandardRepo(), "http-whiteboard"), >>>>>>>>>> bundle("reference:file:target/classes/") >>>>>>>>>> }; >>>>>>>>>> >>>>>>>>>> I get quite a strange error: >>>>>>>>>> >>>>>>>>>> org.apache.karaf.features.internal.util.MultiException: Error: >>>>>>>>>> >>>>>>>>>> /Users/username/git/contoso/iot/project-develop/support/project.sc.servlet/target/exam/424a9312-bd8e-4ef9-8e62-e768b5b11cdf/data/tmp >>>>>>>>>> (Is a directory) >>>>>>>>>> at >>>>>>>>>> org.apache.karaf.features.internal.download.impl.MavenDownloadManager$MavenDownloader.<init>(MavenDownloadManager.java:84) >>>>>>>>>> ~[?:?] >>>>>>>>>> at >>>>>>>>>> org.apache.karaf.features.internal.download.impl.MavenDownloadManager.createDownloader(MavenDownloadManager.java:72) >>>>>>>>>> ~[?:?] >>>>>>>>>> at >>>>>>>>>> org.apache.karaf.features.internal.region.Subsystem.downloadBundles(Subsystem.java:375) >>>>>>>>>> ~[?:?] >>>>>>>>>> at >>>>>>>>>> org.apache.karaf.features.internal.region.Subsystem.downloadBundles(Subsystem.java:372) >>>>>>>>>> ~[?:?] >>>>>>>>>> at >>>>>>>>>> org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:187) >>>>>>>>>> ~[?:?] >>>>>>>>>> at >>>>>>>>>> org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:291) >>>>>>>>>> ~[?:?] >>>>>>>>>> at >>>>>>>>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1233) >>>>>>>>>> ~[?:?] >>>>>>>>>> at >>>>>>>>>> org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$0(FeaturesServiceImpl.java:1132) >>>>>>>>>> ~[?:?] >>>>>>>>>> at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?] >>>>>>>>>> at >>>>>>>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) >>>>>>>>>> [?:?] >>>>>>>>>> at >>>>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) >>>>>>>>>> [?:?] >>>>>>>>>> at java.lang.Thread.run(Thread.java:748) [?:?] >>>>>>>>>> Suppressed: java.io.FileNotFoundException: >>>>>>>>>> /Users/username/git/contoso/iot/project-develop/support/project.sc.servlet/target/exam/424a9312-bd8e-4ef9-8e62-e768b5b11cdf/data/tmp >>>>>>>>>> (Is a directory) >>>>>>>>>> at java.io.FileInputStream.open0(Native Method) ~[?:?] >>>>>>>>>> at java.io.FileInputStream.open(FileInputStream.java:195) [?:?] >>>>>>>>>> at java.io.FileInputStream.<init>(FileInputStream.java:138) [?:?] >>>>>>>>>> at >>>>>>>>>> org.apache.karaf.features.internal.download.impl.AbstractDownloadTask.open(AbstractDownloadTask.java:54) >>>>>>>>>> [18:org.apache.karaf.features.core:4.1.2] >>>>>>>>>> at >>>>>>>>>> org.apache.karaf.features.internal.region.Subsystem.getMetadata(Subsystem.java:535) >>>>>>>>>> [18:org.apache.karaf.features.core:4.1.2] >>>>>>>>>> at >>>>>>>>>> org.apache.karaf.features.internal.region.Subsystem$1.downloaded(Subsystem.java:402) >>>>>>>>>> [18:org.apache.karaf.features.core:4.1.2] >>>>>>>>>> at >>>>>>>>>> org.apache.karaf.features.internal.download.impl.MavenDownloadManager$MavenDownloader$1.operationComplete(MavenDownloadManager.java:133) >>>>>>>>>> [18:org.apache.karaf.features.core:4.1.2] >>>>>>>>>> at >>>>>>>>>> org.apache.karaf.features.internal.download.impl.MavenDownloadManager$MavenDownloader$1.operationComplete(MavenDownloadManager.java:127) >>>>>>>>>> [18:org.apache.karaf.features.core:4.1.2] >>>>>>>>>> at >>>>>>>>>> org.apache.karaf.features.internal.download.impl.DefaultFuture.notifyListener(DefaultFuture.java:350) >>>>>>>>>> [18:org.apache.karaf.features.core:4.1.2] >>>>>>>>>> at >>>>>>>>>> org.apache.karaf.features.internal.download.impl.DefaultFuture.notifyListeners(DefaultFuture.java:335) >>>>>>>>>> [18:org.apache.karaf.features.core:4.1.2] >>>>>>>>>> at >>>>>>>>>> org.apache.karaf.features.internal.download.impl.DefaultFuture.setValue(DefaultFuture.java:259) >>>>>>>>>> [18:org.apache.karaf.features.core:4.1.2] >>>>>>>>>> at >>>>>>>>>> org.apache.karaf.features.internal.download.impl.AbstractDownloadTask.setFile(AbstractDownloadTask.java:61) >>>>>>>>>> [18:org.apache.karaf.features.core:4.1.2] >>>>>>>>>> at >>>>>>>>>> org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:61) >>>>>>>>>> [18:org.apache.karaf.features.core:4.1.2] >>>>>>>>>> at >>>>>>>>>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) >>>>>>>>>> [?:?] >>>>>>>>>> at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?] >>>>>>>>>> at >>>>>>>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) >>>>>>>>>> [?:?] >>>>>>>>>> at >>>>>>>>>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) >>>>>>>>>> [?:?] >>>>>>>>>> at >>>>>>>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) >>>>>>>>>> [?:?] >>>>>>>>>> at >>>>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) >>>>>>>>>> [?:?] >>>>>>>>>> at java.lang.Thread.run(Thread.java:748) [?:?] >>>>>>>>>> >>>>>>>>>> Could you please advice on how to address this error? Am I >>>>>>>>>> missing some >>>>>>>>>> configuration entries? >>>>>>>>>> >>>>>>>>>> Thank you very much, >>>>>>>>>> Matteo >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> Sent from: >>>>>>>>>> http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html >>>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >>> -- >>> Jean-Baptiste Onofré >>> jbono...@apache.org <mailto:jbono...@apache.org> >>> http://blog.nanthrax.net <http://blog.nanthrax.net/> >>> Talend - http://www.talend.com <http://www.talend.com/> >> > -- Jean-Baptiste Onofré jbono...@apache.org http://blog.nanthrax.net Talend - http://www.talend.com