问题
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
回答1:
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.
来源:https://stackoverflow.com/questions/35289763/karaf-pax-exam-fails-with-unknown-protocol-wrap