1

Hi my pax exam fails with the error Unknown protocol: wrap

org.apache.karaf.features.internal.util.MultiException: Error
    at org.apache.karaf.features.internal.download.impl.MavenDownloadManager$MavenDownloader.<init>(MavenDownloadManager.java:84)[9:org.apache.karaf.features.core:4.0.4]
    at org.apache.karaf.features.internal.download.impl.MavenDownloadManager.createDownloader(MavenDownloadManager.java:72)[9:org.apache.karaf.features.core:4.0.4]
    at org.apache.karaf.features.internal.region.Subsystem.downloadBundles(Subsystem.java:363)[9:org.apache.karaf.features.core:4.0.4]
    at org.apache.karaf.features.internal.region.Subsystem.downloadBundles(Subsystem.java:360)[9:org.apache.karaf.features.core:4.0.4]
    at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:187)[9:org.apache.karaf.features.core:4.0.4]
    at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:263)[9:org.apache.karaf.features.core:4.0.4]
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1089)[9:org.apache.karaf.features.core:4.0.4]
    at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:985)[9:org.apache.karaf.features.core:4.0.4]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_79]
    at java.lang.Thread.run(Thread.java:745)[:1.7.0_79]
Caused by: java.io.IOException: Error downloading wrap:file:/C:/Users/609620968/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
    at org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:67)[9:org.apache.karaf.features.core:4.0.4]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_79]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_79]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)[:1.7.0_79]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)[:1.7.0_79]
    ... 3 more
Caused by: java.io.IOException: Could not download [wrap:file:/C:/Users/609620968/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar]
    at org.apache.karaf.features.internal.download.impl.SimpleDownloadTask.download(SimpleDownloadTask.java:90)[9:org.apache.karaf.features.core:4.0.4]
    at org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:58)[9:org.apache.karaf.features.core:4.0.4]
    ... 7 more
Caused by: java.net.MalformedURLException: Unknown protocol: wrap
    at java.net.URL.<init>(URL.java:619)[:1.7.0_79]
    at java.net.URL.<init>(URL.java:482)[:1.7.0_79]
    at java.net.URL.<init>(URL.java:431)[:1.7.0_79]
    at org.apache.karaf.features.internal.download.impl.SimpleDownloadTask.download(SimpleDownloadTask.java:62)[9:org.apache.karaf.features.core:4.0.4]
    ... 8 more

This error started coming when i changed my karaf version from 3.03 to 4.04

Charity
  • 213
  • 1
  • 5
  • 23

1 Answers1

8

Your own feature needs to have a dependency to the wrap feature. With prerequiste="true".

<feature prerequisite="true">wrap</feature>

This tells the karaf resolver to fist load the wrap feature and only then try to resolve your feature.

Christian Schneider
  • 19,420
  • 2
  • 39
  • 64
  • do you know how to give this in java in the Karaf configuration pax-exam – Charity Feb 09 '16 at 16:00
  • 1
    You have to create your own feature file and load it with pax exam. – Christian Schneider Feb 09 '16 at 16:03
  • Just in case anyone hits this for a non-Karaf Pax Exam, as I just did: adding a dependency to Pax URL's Wrap is what you're missing (e.g. "org.ops4j.pax.url:pax-url-wrap:2.5.2") – vorburger Jan 07 '17 at 22:46
  • 1
    Does this apply to Karaf 4.1.0 as well? Trying to use pax-exam there, and wrap is failing even with the prerequisite flag in my feature. – Matt Jan 31 '17 at 22:20