Hello,

I'm struggling getting Apache Unomi tests to work since I migrated from
Karaf 3 to Karaf 4.

Here is the error I am getting in the logs:

*2018-03-02T17:01:54,018 | ERROR | pool-1-thread-2  |
BootFeaturesInstaller            | 10 - org.apache.karaf.features.core -
4.1.5 | Error installing boot features*

*org.apache.karaf.features.internal.util.MultiException: Error:*

*        Error downloading
wrap:file:/Users/loom/.m2/repository/org/apache/kafka/kafka-clients/0.10.1.0/kafka-clients-0.10.1.0.jar
<http://0.10.1.0/kafka-clients-0.10.1.0.jar>*

*        Error downloading
wrap:file:/Users/loom/.m2/repository/org/apache/kafka/kafka-clients/0.10.1.0/kafka-clients-0.10.1.0.jar
<http://0.10.1.0/kafka-clients-0.10.1.0.jar>*

*        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:1248)
~[?:?]*

*        at
org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$1(FeaturesServiceImpl.java:1147)
~[?:?]*

*        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]*

*        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[?:?]*

*        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[?:?]*

*        at java.lang.Thread.run(Thread.java:745) [?:?]*

*        Suppressed: java.io.IOException: Error downloading
wrap:file:/Users/loom/.m2/repository/org/apache/kafka/kafka-clients/0.10.1.0/kafka-clients-0.10.1.0.jar
<http://0.10.1.0/kafka-clients-0.10.1.0.jar>*

*                at
org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:77)
[10:org.apache.karaf.features.core:4.1.5]*

*                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:1142)
[?:?]*

*                at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[?:?]*

*                at java.lang.Thread.run(Thread.java:745) [?:?]*

*        Caused by: java.io.IOException: Could not download
[wrap:file:/Users/loom/.m2/repository/org/apache/kafka/kafka-clients/0.10.1.0/kafka-clients-0.10.1.0.jar
<http://0.10.1.0/kafka-clients-0.10.1.0.jar>]*

*                at
org.apache.karaf.features.internal.download.impl.SimpleDownloadTask.download(SimpleDownloadTask.java:90)
~[?:?]*

*                at
org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:60)
~[?:?]*

*                ... 7 more*

*        Caused by: java.net.MalformedURLException: Unknown protocol: wrap*

*                at java.net.URL.<init>(URL.java:627) ~[?:?]*

*                at java.net.URL.<init>(URL.java:490) ~[?:?]*

*                at java.net.URL.<init>(URL.java:439) ~[?:?]*

*                at
org.apache.karaf.features.internal.download.impl.SimpleDownloadTask.download(SimpleDownloadTask.java:62)
~[?:?]*

*                at
org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:60)
~[?:?]*

*                ... 7 more*

*        Caused by: java.lang.IllegalStateException: Unknown protocol: wrap*

*                at
org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:373)
~[?:?]*

*                at java.net.URL.<init>(URL.java:622) ~[?:?]*

*                at java.net.URL.<init>(URL.java:490) ~[?:?]*

*                at java.net.URL.<init>(URL.java:439) ~[?:?]*

*                at
org.apache.karaf.features.internal.download.impl.SimpleDownloadTask.download(SimpleDownloadTask.java:62)
~[?:?]*

*                at
org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:60)
~[?:?]*

*                ... 7 more*

Here is the setup for the Test case:

    protected static final String HTTP_PORT = "8181";

    protected static final String URL = "http://localhost:"; + HTTP_PORT;

    protected static final String KARAF_DIR = "target/exam";

    @Configuration
    public Option[] config() {
        MavenArtifactUrlReference karafUrl = maven()
                .groupId("org.apache.karaf")
                .artifactId("apache-karaf")
                .version("4.1.5")
                .type("tar.gz");

        MavenUrlReference karafStandardRepo = maven()
                .groupId("org.apache.karaf.features")
                .artifactId("standard")
                .classifier("features")
                .type("xml")
                .versionAsInProject();
        MavenUrlReference karafCellarRepo = maven()
                .groupId("org.apache.karaf.cellar")
                .artifactId("apache-karaf-cellar")
                .classifier("features")
                .type("xml")
                .versionAsInProject();
        MavenUrlReference karafPaxWebRepo = maven()
                .groupId("org.ops4j.pax.web")
                .artifactId("pax-web-features")
                .classifier("features")
                .type("xml")
                .versionAsInProject();
        MavenUrlReference karafCxfRepo = maven()
                .groupId("org.apache.cxf.karaf")
                .artifactId("apache-cxf")
                .classifier("features")
                .type("xml")
                .versionAsInProject();
        MavenUrlReference contextServerRepo = maven()
                .groupId("org.apache.unomi")
                .artifactId("unomi-kar")
                .classifier("features")
                .type("xml")
                .versionAsInProject();
        MavenUrlReference routerRepo = maven()
                .groupId("org.apache.unomi")
                .artifactId("unomi-router-karaf-feature")
                .classifier("features")
                .type("xml")
                .versionAsInProject();

        return new Option[]{
                debugConfiguration("5005", false),
                karafDistributionConfiguration()
                        .frameworkUrl(karafUrl)
                        .unpackDirectory(new File(KARAF_DIR))
                        .useDeployFolder(true),

replaceConfigurationFile("etc/org.apache.unomi.router.cfg", new File(
                        "src/test/resources/org.apache.unomi.router.cfg")),

replaceConfigurationFile("data/tmp/recurrent_import/2-surfers-test.csv",
new File(
                        "src/test/resources/2-surfers-test.csv")),

replaceConfigurationFile("data/tmp/recurrent_import/3-surfers-overwrite-test.csv",
new File(
                        "src/test/resources/3-surfers-overwrite-test.csv")),

replaceConfigurationFile("data/tmp/recurrent_import/4-surfers-delete-test.csv",
new File(
                        "src/test/resources/4-surfers-delete-test.csv")),

replaceConfigurationFile("data/tmp/recurrent_import/5-ranking-test.csv",
new File(
                        "src/test/resources/5-ranking-test.csv")),

replaceConfigurationFile("data/tmp/recurrent_import/6-actors-test.csv",
new File(
                        "src/test/resources/6-actors-test.csv")),
                keepRuntimeFolder(),
                configureConsole().ignoreLocalConsole(),
                logLevel(LogLevel.INFO),
//
editConfigurationFilePut("etc/org.ops4j.pax.web.cfg",
"org.osgi.service.http.port", HTTP_PORT),
//                systemProperty("org.osgi.service.http.port").value(HTTP_PORT),
                systemProperty("org.ops4j.pax.exam.rbc.rmi.port").value("1199"),

systemProperty("org.apache.unomi.itests.elasticsearch.transport.port").value("9500"),

systemProperty("org.apache.unomi.itests.elasticsearch.cluster.name").value("contextElasticSearchITests"),

systemProperty("org.apache.unomi.itests.elasticsearch.http.port").value("9400"),

systemProperty("org.apache.unomi.itests.elasticsearch.bootstrap.seccomp").value("false"),
                systemProperty("unomi.autoStart").value("true"),
                features(karafPaxWebRepo, "shell"),
                features(karafStandardRepo, "wrap"),
                features(karafPaxWebRepo, "war"),
                features(karafCxfRepo, "cxf"),
                features(karafCellarRepo, "cellar"),
                features(contextServerRepo, "unomi-kar"),
                features(routerRepo, "unomi-router-karaf-feature"),
                // we need to wrap the HttpComponents libraries
ourselves since the OSGi bundles provided by the project are incorrect
                wrappedBundle(mavenBundle("org.apache.httpcomponents",
                        "httpcore").versionAsInProject()),
                wrappedBundle(mavenBundle("org.apache.httpcomponents",
                        "httpmime").versionAsInProject()),
                wrappedBundle(mavenBundle("org.apache.httpcomponents",
                        "httpclient").versionAsInProject())
        };

It seems the problem is that the "unomi-router-karaf-feature" uses the wrap
protocol but the resolver can't use it because it's also being deployed as
a feature. It seems I need to specifiy it as a startup feature but I don't
know how to achieve that.

If you prefer to have a look at the repository, you can find the full
integration test here :

https://github.com/apache/incubator-unomi/tree/feature-UNOMI-5-KARAF4-1/itests

I'm quite stuck with this, so any help would be greatly appreciated !

cheers,
  Serge...

Serge Huber
CTO & Co-Founder
T +41 22 361 3424
9 route des Jeunes | 1227 Acacias | Switzerland
jahia.com <http://www.jahia.com/>
SKYPE | LINKEDIN <https://www.linkedin.com/in/sergehuber> | TWITTER
<https://twitter.com/sergehuber> | VCARD
<http://www.jahia.com/vcard/HuberSerge.vcf>


> JOIN OUR COMMUNITY <http://www.jahia.com/> to evaluate, get trained and
to discover why Jahia is a leading User Experience Platform (UXP) for
Digital Transformation.

Reply via email to