Quantcast

Is there a recent pax exam karaf provisioning example somewhere?

classic Classic list List threaded Threaded
27 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Is there a recent pax exam karaf provisioning example somewhere?

Steinar Bang
Since I have been using karaf for the last 6 months or so, it would be a
good idea to convert the pax exam tests
 https://github.com/steinarb/ukelonn/blob/using-vaadin/ukelonn.tests/src/test/java/no/priv/bang/ukelonn/tests/UkelonnServiceIntegrationTest.java
to karaf provisioning (so that I can use the features and not have to
figure out individual bundles on my own).

A quick google search found me
 http://stackoverflow.com/a/19896241
which points to
 https://github.com/ANierbeck/Camel-Pax-Exam-Demo/blob/master/route-control/src/test/java/de/nierbeck/camel/exam/demo/control/route/KarafRoutingTest.java

But the KarafRoutingTest.java gives me two questions:
 1. The setup seems kind of cumbersome? Is it necessary to specify all
    of that? Is it necessary to specify the karafVersion()? I would have
    thought it was implicit from the version of the zip artifact?
 2. The example uses karaf version 3.0.0 and last checkin on the file
    was in January 2014, so it is fairly old? Is there a more recent
    example somewhere?

(It's possible that google can find me something eventually, but since
something as old as the above was the first search hit, I'm thinking
there may not be any...? Or that I'm searching for the wrong thing? My
search text was "pax exam use karaf features")

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a recent pax exam karaf provisioning example somewhere?

Steinar Bang
>>>>> Steinar Bang <[hidden email]>:

> But the KarafRoutingTest.java gives me two questions:
>  1. The setup seems kind of cumbersome? Is it necessary to specify all
>     of that? Is it necessary to specify the karafVersion()? I would have
>     thought it was implicit from the version of the zip artifact?
>  2. The example uses karaf version 3.0.0 and last checkin on the file
>     was in January 2014, so it is fairly old? Is there a more recent
>     example somewhere?

This one
 http://stackoverflow.com/a/33933342
pointing to
 https://github.com/ANierbeck/Karaf-Cassandra/blob/master/Karaf-Cassandra-ITest/src/test/java/de/nierbeck/cassandra/itest/TestBase.java
looks more promising.

The setup was way smaller, and the last checkin was just a year ago.

(but if there is something easier yet, for karaf 4.0.9 and/or 4.1.1,
please let me know!)

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a recent pax exam karaf provisioning example somewhere?

Zoran Regvart-2
Hi Steinar,
I've done a couple of tests in this repository, perhaps that would be
of use to you:

https://github.com/zregvart/fuse-credential-store/tree/master/fuse-credential-store-karaf-parent/fuse-credential-store-karaf-itests

zoran

On Fri, Apr 14, 2017 at 6:30 PM, Steinar Bang <[hidden email]> wrote:

>>>>>> Steinar Bang <[hidden email]>:
>
>> But the KarafRoutingTest.java gives me two questions:
>>  1. The setup seems kind of cumbersome? Is it necessary to specify all
>>     of that? Is it necessary to specify the karafVersion()? I would have
>>     thought it was implicit from the version of the zip artifact?
>>  2. The example uses karaf version 3.0.0 and last checkin on the file
>>     was in January 2014, so it is fairly old? Is there a more recent
>>     example somewhere?
>
> This one
>  http://stackoverflow.com/a/33933342
> pointing to
>  https://github.com/ANierbeck/Karaf-Cassandra/blob/master/Karaf-Cassandra-ITest/src/test/java/de/nierbeck/cassandra/itest/TestBase.java
> looks more promising.
>
> The setup was way smaller, and the last checkin was just a year ago.
>
> (but if there is something easier yet, for karaf 4.0.9 and/or 4.1.1,
> please let me know!)
>



--
Zoran Regvart
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a recent pax exam karaf provisioning example somewhere?

Steinar Bang
>>>>> Zoran Regvart <[hidden email]>:

> I've done a couple of tests in this repository, perhaps that would be
> of use to you:

> https://github.com/zregvart/fuse-credential-store/tree/master/fuse-credential-store-karaf-parent/fuse-credential-store-karaf-itests

Thanks! Looking at them now. :-)

What's the ignoreLocalConsole() option? Switching off output to the
local console? (I don't think I want that)

(I assume the ignoreRemoteShell() option switches off the ssh server,
and that's OK)

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a recent pax exam karaf provisioning example somewhere?

Achim Nierbeck
Hi Steinar, 

it depends on what you want to test. 

ignoreLocalConsole can safely be enabled, it will produce much less noise on your log for your unit test. 

for a full list of configuration options, take a look at the Pax Exam documentation [1].


regards, Achim 


2017-04-14 18:44 GMT+02:00 Steinar Bang <[hidden email]>:
>>>>> Zoran Regvart <[hidden email]>:

> I've done a couple of tests in this repository, perhaps that would be
> of use to you:

> https://github.com/zregvart/fuse-credential-store/tree/master/fuse-credential-store-karaf-parent/fuse-credential-store-karaf-itests

Thanks! Looking at them now. :-)

What's the ignoreLocalConsole() option? Switching off output to the
local console? (I don't think I want that)

(I assume the ignoreRemoteShell() option switches off the ssh server,
and that's OK)




--

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 

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a recent pax exam karaf provisioning example somewhere?

Steinar Bang
In reply to this post by Steinar Bang
>>>>> Steinar Bang <[hidden email]>:

> Since I have been using karaf for the last 6 months or so, it would be a
> good idea to convert the pax exam tests
>  https://github.com/steinarb/ukelonn/blob/using-vaadin/ukelonn.tests/src/test/java/no/priv/bang/ukelonn/tests/UkelonnServiceIntegrationTest.java
> to karaf provisioning (so that I can use the features and not have to
> figure out individual bundles on my own).

With help from the list, the above test have the following options,
right now (not checked in or pushed, yet):
    @Configuration
    public Option[] config() {
        final MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf-minimal").type("zip").versionAsInProject();
        final MavenArtifactUrlReference ukelonnFeatureRepo = maven().groupId("no.priv.bang.ukelonn").artifactId("ukelonn.karaf").versionAsInProject().type("xml").classifier("features");
        return options(
            karafDistributionConfiguration().frameworkUrl(karafUrl).unpackDirectory(new File("target/exam")).useDeployFolder(false),
            configureConsole().ignoreLocalConsole().ignoreRemoteShell(),
            features(ukelonnFeatureRepo, "ukelonn-db-derby-test", "ukelonn"));
    }

With this, it starts and then fails.  The stack trace in the unit test
complains about
 Caused by: java.rmi.NotBoundException: 051fb5cd-af1b-4b9b-b1a7-00b8600e3a0d

The console output complains about the two non-bundle jars that karaf
wraps on the fly (this works when I'm running in regular karaf).

FWIW I have rebundled versions of the two jars available. They are what
I've been using in the integration tests up until now:
 https://github.com/steinarb/ukelonn/blob/using-vaadin/ukelonn.rebundled/ukelonn.rebundled.com.vaadin.addon.vaadin-touchkit-agpl/pom.xml
 https://github.com/steinarb/ukelonn/blob/using-vaadin/ukelonn.rebundled/ukelonn.rebundled.com.vaadin.external.gwt.gwt-user/pom.xml
(but I thought I could throw these away when moving to karaf based
integration tests).

Here is the console output (I'm confused both by the "Unknown protocol:
wrap" messages and the "error downloading" messages.  Both jars are
present in ~/.m2/repository):

2017-04-15 07:48:08,261 | ERROR | pool-6-thread-1  | BootFeaturesInstaller            | 6 - org.apache.karaf.features.core - 4.0.7 | Error installing boot features
org.apache.karaf.features.internal.util.MultiException: Error
        at org.apache.karaf.features.internal.download.impl.MavenDownloadManager$MavenDownloader.<init>(MavenDownloadManager.java:84)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.download.impl.MavenDownloadManager.createDownloader(MavenDownloadManager.java:72)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.region.Subsystem.downloadBundles(Subsystem.java:363)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.region.Subsystem.downloadBundles(Subsystem.java:360)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:187)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:263)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1176)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:1074)[6:org.apache.karaf.features.core:4.0.7]
        at java.util.concurrent.FutureTask.run(Unknown Source)[:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)[:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)[:1.8.0_121]
        at java.lang.Thread.run(Unknown Source)[:1.8.0_121]
Caused by: java.io.IOException: Error downloading wrap:file:/C:/Users/sbang/.m2/repository/com/vaadin/addon/vaadin-touchkit-agpl/4.1.0/vaadin-touchkit-agpl-4.1.0.jar
        at org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:67)[6:org.apache.karaf.features.core:4.0.7]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)[:1.8.0_121]
        at java.util.concurrent.FutureTask.run(Unknown Source)[:1.8.0_121]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)[:1.8.0_121]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)[:1.8.0_121]
        ... 3 more
Caused by: java.io.IOException: Could not download [wrap:file:/C:/Users/sbang/.m2/repository/com/vaadin/addon/vaadin-touchkit-agpl/4.1.0/vaadin-touchkit-agpl-4.1.0.jar]
        at org.apache.karaf.features.internal.download.impl.SimpleDownloadTask.download(SimpleDownloadTask.java:90)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:58)[6:org.apache.karaf.features.core:4.0.7]
        ... 7 more
Caused by: java.net.MalformedURLException: Unknown protocol: wrap
        at java.net.URL.<init>(Unknown Source)[:1.8.0_121]
        at java.net.URL.<init>(Unknown Source)[:1.8.0_121]
        at java.net.URL.<init>(Unknown Source)[:1.8.0_121]
        at org.apache.karaf.features.internal.download.impl.SimpleDownloadTask.download(SimpleDownloadTask.java:62)[6:org.apache.karaf.features.core:4.0.7]
        ... 8 more
Caused by: java.lang.IllegalStateException: Unknown protocol: wrap
        at org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:373)[org.apache.felix.framework-5.4.0.jar:]
        ... 12 more
Caused by: java.io.IOException: Error downloading wrap:file:/C:/Users/sbang/.m2/repository/com/vaadin/addon/vaadin-touchkit-agpl/4.1.0/vaadin-touchkit-agpl-4.1.0.jar
        at org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:67)[6:org.apache.karaf.features.core:4.0.7]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)[:1.8.0_121]
        at java.util.concurrent.FutureTask.run(Unknown Source)[:1.8.0_121]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)[:1.8.0_121]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)[:1.8.0_121]
        ... 3 more
Caused by: java.io.IOException: Could not download [wrap:file:/C:/Users/sbang/.m2/repository/com/vaadin/addon/vaadin-touchkit-agpl/4.1.0/vaadin-touchkit-agpl-4.1.0.jar]
        at org.apache.karaf.features.internal.download.impl.SimpleDownloadTask.download(SimpleDownloadTask.java:90)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:58)[6:org.apache.karaf.features.core:4.0.7]
        ... 7 more
Caused by: java.net.MalformedURLException: Unknown protocol: wrap
        at java.net.URL.<init>(Unknown Source)[:1.8.0_121]
        at java.net.URL.<init>(Unknown Source)[:1.8.0_121]
        at java.net.URL.<init>(Unknown Source)[:1.8.0_121]
        at org.apache.karaf.features.internal.download.impl.SimpleDownloadTask.download(SimpleDownloadTask.java:62)[6:org.apache.karaf.features.core:4.0.7]
        ... 8 more
Caused by: java.lang.IllegalStateException: Unknown protocol: wrap
        at org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:373)[org.apache.felix.framework-5.4.0.jar:]
        ... 12 more
Caused by: java.io.IOException: Error downloading wrap:file:/C:/Users/sbang/.m2/repository/com/vaadin/external/gwt/gwt-user/2.7.0.vaadin4/gwt-user-2.7.0.vaadin4.jar
        at org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:67)[6:org.apache.karaf.features.core:4.0.7]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)[:1.8.0_121]
        at java.util.concurrent.FutureTask.run(Unknown Source)[:1.8.0_121]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)[:1.8.0_121]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)[:1.8.0_121]
        ... 3 more
Caused by: java.io.IOException: Could not download [wrap:file:/C:/Users/sbang/.m2/repository/com/vaadin/external/gwt/gwt-user/2.7.0.vaadin4/gwt-user-2.7.0.vaadin4.jar]
        at org.apache.karaf.features.internal.download.impl.SimpleDownloadTask.download(SimpleDownloadTask.java:90)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:58)[6:org.apache.karaf.features.core:4.0.7]
        ... 7 more
Caused by: java.net.MalformedURLException: Unknown protocol: wrap
        at java.net.URL.<init>(Unknown Source)[:1.8.0_121]
        at java.net.URL.<init>(Unknown Source)[:1.8.0_121]
        at java.net.URL.<init>(Unknown Source)[:1.8.0_121]
        at org.apache.karaf.features.internal.download.impl.SimpleDownloadTask.download(SimpleDownloadTask.java:62)[6:org.apache.karaf.features.core:4.0.7]
        ... 8 more
Caused by: java.lang.IllegalStateException: Unknown protocol: wrap
        at org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:373)[org.apache.felix.framework-5.4.0.jar:]
        ... 12 more
Caused by: java.io.IOException: Error downloading wrap:file:/C:/Users/sbang/.m2/repository/com/vaadin/external/gwt/gwt-user/2.7.0.vaadin4/gwt-user-2.7.0.vaadin4.jar
        at org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:67)[6:org.apache.karaf.features.core:4.0.7]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)[:1.8.0_121]
        at java.util.concurrent.FutureTask.run(Unknown Source)[:1.8.0_121]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)[:1.8.0_121]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)[:1.8.0_121]
        ... 3 more
Caused by: java.io.IOException: Could not download [wrap:file:/C:/Users/sbang/.m2/repository/com/vaadin/external/gwt/gwt-user/2.7.0.vaadin4/gwt-user-2.7.0.vaadin4.jar]
        at org.apache.karaf.features.internal.download.impl.SimpleDownloadTask.download(SimpleDownloadTask.java:90)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:58)[6:org.apache.karaf.features.core:4.0.7]
        ... 7 more
Caused by: java.net.MalformedURLException: Unknown protocol: wrap
        at java.net.URL.<init>(Unknown Source)[:1.8.0_121]
        at java.net.URL.<init>(Unknown Source)[:1.8.0_121]
        at java.net.URL.<init>(Unknown Source)[:1.8.0_121]
        at org.apache.karaf.features.internal.download.impl.SimpleDownloadTask.download(SimpleDownloadTask.java:62)[6:org.apache.karaf.features.core:4.0.7]
        ... 8 more
Caused by: java.lang.IllegalStateException: Unknown protocol: wrap
        at org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:373)[org.apache.felix.framework-5.4.0.jar:]
        ... 12 more

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a recent pax exam karaf provisioning example somewhere?

Steinar Bang
>>>>> Steinar Bang <[hidden email]>:

> Here is the console output (I'm confused both by the "Unknown protocol:
> wrap" messages and the "error downloading" messages.  Both jars are
> present in ~/.m2/repository):

Ok, the answer to that one was a google search away: http://stackoverflow.com/a/35291578

I added "<feature prerequisite="true">wrap</feature>" to the webapps
main feature template file, and I got past the problems with loading the
wrapped jars:
 https://github.com/steinarb/ukelonn/blob/using-vaadin/ukelonn.bundle/src/main/feature/feature.xml
(I put "<feature prerequisite="true">wrap</feature>" as the first
required feature here)

The next problem seems to be missing feature requirements.  Is this
because the pax exam test is running a minimal karaf installation? Do I
need to "preload" some features?

From the console:
2017-04-15 08:31:56,135 | ERROR | pool-6-thread-1  | BootFeaturesInstaller            | 6 - org.apache.karaf.features.core - 4.0.7 | Error installing boot features
org.osgi.service.resolver.ResolutionException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=ukelonn-db-derby-test; type=karaf.feature; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]"; filter:="(&(osgi.identity=ukelonn-db-derby-test)(type=karaf.feature)(version>=1.0.0.SNAPSHOT)(version<=1.0.0.SNAPSHOT))" [caused by: Unable to resolve ukelonn-db-derby-test/1.0.0.SNAPSHOT: missing requirement [ukelonn-db-derby-test/1.0.0.SNAPSHOT] osgi.identity; osgi.identity=pax-jdbc; type=karaf.feature]
        at org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:235)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:158)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:216)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:263)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1176)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:1074)[6:org.apache.karaf.features.core:4.0.7]
        at java.util.concurrent.FutureTask.run(Unknown Source)[:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)[:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)[:1.8.0_121]
        at java.lang.Thread.run(Unknown Source)[:1.8.0_121]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a recent pax exam karaf provisioning example somewhere?

Steinar Bang
>>>>> Steinar Bang <[hidden email]>:

> The next problem seems to be missing feature requirements.  Is this
> because the pax exam test is running a minimal karaf installation? Do I
> need to "preload" some features?

I tried adding first just the standard feature repository, but that
didn't change the error message.

Then I tried adding the standard feature repository, and then load the
(presumably missing) pax-jdbc feature from that, but that didn't help
either, I got the same error message:
    @Configuration
    public Option[] config() {
        final MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf-minimal").type("zip").versionAsInProject();
        final MavenArtifactUrlReference karafStandrdRepo = maven().groupId("org.apache.karaf.features").artifactId("standard").versionAsInProject().type("xml").classifier("features");
        final MavenArtifactUrlReference ukelonnFeatureRepo = maven().groupId("no.priv.bang.ukelonn").artifactId("ukelonn.karaf").versionAsInProject().type("xml").classifier("features");
        return options(
            karafDistributionConfiguration().frameworkUrl(karafUrl).unpackDirectory(new File("target/exam")).useDeployFolder(false),
            configureConsole().ignoreLocalConsole().ignoreRemoteShell(),
            features(karafStandrdRepo, "pax-jdbc"),
            features(ukelonnFeatureRepo, "ukelonn-db-derby-test", "ukelonn"));
    }

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a recent pax exam karaf provisioning example somewhere?

Achim Nierbeck
Hi, 

the pax-jdbc feature isn't part of the std. feature set of Karaf, you have to add that dependency yourself. 
Best to add the feature repository in your own feature and declare a feature dependency to it. [1]

regards, Achim 


2017-04-15 9:40 GMT+02:00 Steinar Bang <[hidden email]>:
>>>>> Steinar Bang <[hidden email]>:

> The next problem seems to be missing feature requirements.  Is this
> because the pax exam test is running a minimal karaf installation? Do I
> need to "preload" some features?

I tried adding first just the standard feature repository, but that
didn't change the error message.

Then I tried adding the standard feature repository, and then load the
(presumably missing) pax-jdbc feature from that, but that didn't help
either, I got the same error message:
    @Configuration
    public Option[] config() {
        final MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf-minimal").type("zip").versionAsInProject();
        final MavenArtifactUrlReference karafStandrdRepo = maven().groupId("org.apache.karaf.features").artifactId("standard").versionAsInProject().type("xml").classifier("features");
        final MavenArtifactUrlReference ukelonnFeatureRepo = maven().groupId("no.priv.bang.ukelonn").artifactId("ukelonn.karaf").versionAsInProject().type("xml").classifier("features");
        return options(
            karafDistributionConfiguration().frameworkUrl(karafUrl).unpackDirectory(new File("target/exam")).useDeployFolder(false),
            configureConsole().ignoreLocalConsole().ignoreRemoteShell(),
            features(karafStandrdRepo, "pax-jdbc"),
            features(ukelonnFeatureRepo, "ukelonn-db-derby-test", "ukelonn"));
    }




--

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 

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a recent pax exam karaf provisioning example somewhere?

Steinar Bang
>>>>> Achim Nierbeck <[hidden email]>:

> the pax-jdbc feature isn't part of the std. feature set of Karaf, you have
> to add that dependency yourself.

Ok.

Out of curiosity: how is the pax jdbc found when I install the feature
on a regular karaf?

The procedure I use is the one here: https://github.com/steinarb/ukelonn/tree/using-vaadin#kjøring-på-apache-karaf-med-testdatabasen

Translation of the essentials from the Norwegian text of the README:
 1. Clone and build the webapp
 2. Download and upack karaf 4.0.9 (The README says 4.0.7, but I just
    tried karaf 4.0.9 and that worked fine. I'm in the progress of
    moving to 4.1.1 (which requires work))
 3. Start the unpacked karaf and install the feature repository built
    from the webapp
      feature:repo-add mvn:no.priv.bang.ukelonn/ukelonn.karaf/LATEST/xml/features
 4. Install the required features
      feature:install ukelonn-db-derby-test
      feature:install ukelonn

I just tried this with a clean karaf 4.0.9 download and unpack, so I can
verify that it works.

The "feature:install ukelonn-db-derby-test" pulls in the necessary
features.  In the feature template file I haven't specified any feature
repository:
 https://github.com/steinarb/ukelonn/blob/using-vaadin/ukelonn.bundle.test.db/src/main/feature/feature.xml

Here's what's pulled in by ukelonn-db-derby-test:
 karaf@root()> feature:install ukelonn-db-derby-test
 karaf@root()> bundle:list
 START LEVEL 100 , List Threshold: 50
 ID | State  | Lvl | Version               | Name
 -----------------------------------------------------------------------------------------------
 52 | Active |  80 | 10.11.1000001.1616546 | Apache Derby 10.11
 53 | Active |  80 | 1.0.0.SNAPSHOT        | Ukelonn webapp OSGi service definitions OSGi bundle
 54 | Active |  80 | 1.0.0.SNAPSHOT        | Ukelonn webapp derby test database OSGi bundle
 55 | Active |  80 | 1.5.0                 | OPS4J Base - Service Provider Access
 56 | Active |  80 | 1.0.1                 | OPS4J Pax JDBC Generic Driver Extender
 57 | Active |  80 | 1.0.1                 | OPS4J Pax JDBC Apache Derby Driver Adapter
 58 | Active |  80 | 1.0.0.201505202023    | org.osgi:org.osgi.service.jdbc

> Best to add the feature repository in your own feature and declare a
> feature dependency to it. [1]

Ok, will try.

But I'm still curoious why running karaf in the integration tests is
different to actually running in karaf..? :-)

> regards, Achim

> [1] - https://github.com/ANierbeck/Karaf-Vertx/blob/master/Vertx-Microservices/Vertx-Microservices-Features/src/main/feature/feature.xml#L21
> [2] - https://ops4j1.jira.com/wiki/display/PAXJDBC/Documentation

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a recent pax exam karaf provisioning example somewhere?

Steinar Bang
>>>>> Steinar Bang <[hidden email]>:

>> Best to add the feature repository in your own feature and declare a
>> feature dependency to it. [1]
>> [1] - https://github.com/ANierbeck/Karaf-Vertx/blob/master/Vertx-Microservices/Vertx-Microservices-Features/src/main/feature/feature.xml#L21
>> [2] - https://ops4j1.jira.com/wiki/display/PAXJDBC/Documentation

> Ok, will try.

> But I'm still curious why running karaf in the integration tests is
> different to actually running in karaf..? :-)

I added pax-jdbc feature repository to the feature template file of my
db feature, ie. https://github.com/steinarb/ukelonn/blob/using-vaadin/ukelonn.bundle.test.db/src/main/feature/feature.xml

The resulting feature file built by maven looks like this:
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="ukelonn.bundle.test.db">
     <repository>mvn:org.ops4j.pax.jdbc/pax-jdbc-features/0.9.0/xml/features</repository>
     <repository>mvn:no.priv.bang.ukelonn/ukelonn.api/1.0.0-SNAPSHOT/xml/features</repository>
     <feature name="ukelonn-db-derby-test" description="Ukelonn webapp derby test database OSGi bundle" version="1.0.0.SNAPSHOT">
         <feature prerequisite="false" dependency="false">pax-jdbc</feature>
         <feature prerequisite="false" dependency="false">pax-jdbc-derby</feature>
         <feature version="1.0.0.SNAPSHOT" prerequisite="false" dependency="false">ukelonn-api</feature>
         <bundle start-level="80">mvn:no.priv.bang.ukelonn/ukelonn.bundle.test.db/1.0.0-SNAPSHOT</bundle>
     </feature>
 </features>

However I still get the same error on the pax exam karaf startup:
2017-04-15 11:08:35,327 | ERROR | pool-6-thread-1  | BootFeaturesInstaller            | 6 - org.apache.karaf.features.core - 4.0.7 | Error installing boot features
org.osgi.service.resolver.ResolutionException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=ukelonn-db-derby-test; type=karaf.feature; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]"; filter:="(&(osgi.identity=ukelonn-db-derby-test)(type=karaf.feature)(version>=1.0.0.SNAPSHOT)(version<=1.0.0.SNAPSHOT))" [caused by: Unable to resolve ukelonn-db-derby-test/1.0.0.SNAPSHOT: missing requirement [ukelonn-db-derby-test/1.0.0.SNAPSHOT] osgi.identity; osgi.identity=pax-jdbc; type=karaf.feature]
        at org.apache.felix.resolver.ResolutionError.toException(ResolutionError.java:42)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:235)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:158)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:216)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:263)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1176)[6:org.apache.karaf.features.core:4.0.7]
        at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:1074)[6:org.apache.karaf.features.core:4.0.7]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_121]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_121]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]
[SUREFIRE] std/in stream corrupted
java.io.IOException: Command NOOP unexpectedly read Void data with length 4.
        at org.apache.maven.surefire.booter.MasterProcessCommand.decode(MasterProcessCommand.java:139)
        at org.apache.maven.surefire.booter.CommandReader$CommandRunnable.run(CommandReader.java:360)
        at java.lang.Thread.run(Thread.java:745)

Also there is a java process left running when the test completes with
error, so there is some cleanup missing from the test setup (I have to
kill that process to be allowed to run the test again. If not, windows
file locking prevents "mvn clean" from deleting the target/exam
directory structure).  

I'm studying the examples to try to figure out what I've missed.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a recent pax exam karaf provisioning example somewhere?

Steinar Bang
>>>>> Steinar Bang <[hidden email]>:

> Also there is a java process left running when the test completes with
> error, so there is some cleanup missing from the test setup (I have to
> kill that process to be allowed to run the test again. If not, windows
> file locking prevents "mvn clean" from deleting the target/exam
> directory structure).  

There is this output at the end of the "mvn clean install":
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project ukelonn.tests: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_121\jre\bin\java" -jar C:\Users\sbang\workspaces\ws06\ukelonn\ukelonn.tests\target\surefire\surefirebooter5197692333401719291.jar C:\Users\sbang\workspaces\ws06\ukelonn\ukelonn.tests\target\surefire\surefire8860295739440543272tmp C:\Users\sbang\workspaces\ws06\ukelonn\ukelonn.tests\target\surefire\surefire_05835872688929628334tmp"

Obviously maven thinks the process has terminated.  Just as obviously
there is still a java process running (that prevents delete of the
target\exam directory structure).

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a recent pax exam karaf provisioning example somewhere?

Steinar Bang
>>>>> Steinar Bang <[hidden email]>:

> There is this output at the end of the "mvn clean install":
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project ukelonn.tests: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
> [ERROR] Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_121\jre\bin\java" -jar C:\Users\sbang\workspaces\ws06\ukelonn\ukelonn.tests\target\surefire\surefirebooter5197692333401719291.jar C:\Users\sbang\workspaces\ws06\ukelonn\ukelonn.tests\target\surefire\surefire8860295739440543272tmp C:\Users\sbang\workspaces\ws06\ukelonn\ukelonn.tests\target\surefire\surefire_05835872688929628334tmp"

> Obviously maven thinks the process has terminated.  Just as obviously
> there is still a java process running (that prevents delete of the
> target\exam directory structure).

The documentation says "With the Forked Container, the system under test
runs in a separate Java virtual machine under remote control from the
test driver."
 https://ops4j1.jira.com/wiki/display/PAXEXAM4/Pax+Exam

How do I figure out whether I'm running a "forked container" or not?

Is the mentioned "forked VM" in the rror message that has terminated,
the VM actually running the tests? (ie. the single VM started in a
"non-forked container" (or whatever it is called)...?).

Or is the "forked VM" of the error message the front end that forks yet
another VM to do the job, and it's this second VM that is left running?
(ie. the "forked VM" of the error message is a VM started by maven
surefire, and this VM runs a "forked container" that starts yet another
VM where karaf is started and tests are run)

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a recent pax exam karaf provisioning example somewhere?

Achim Nierbeck
Hi, 

the karaf container is always a forked process. If you want to run it as non-forked you can use the following configuration:

runEmbedded(true)

this is especially useful if you want to debug your tests, but beware because of the nature of how the tests run, this can only be used with debugging and one test-method. 

regards, Achim 


2017-04-15 14:57 GMT+02:00 Steinar Bang <[hidden email]>:
>>>>> Steinar Bang <[hidden email]>:

> There is this output at the end of the "mvn clean install":
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project ukelonn.tests: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
> [ERROR] Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_121\jre\bin\java" -jar C:\Users\sbang\workspaces\ws06\ukelonn\ukelonn.tests\target\surefire\surefirebooter5197692333401719291.jar C:\Users\sbang\workspaces\ws06\ukelonn\ukelonn.tests\target\surefire\surefire8860295739440543272tmp C:\Users\sbang\workspaces\ws06\ukelonn\ukelonn.tests\target\surefire\surefire_05835872688929628334tmp"

> Obviously maven thinks the process has terminated.  Just as obviously
> there is still a java process running (that prevents delete of the
> target\exam directory structure).

The documentation says "With the Forked Container, the system under test
runs in a separate Java virtual machine under remote control from the
test driver."
 https://ops4j1.jira.com/wiki/display/PAXEXAM4/Pax+Exam

How do I figure out whether I'm running a "forked container" or not?

Is the mentioned "forked VM" in the rror message that has terminated,
the VM actually running the tests? (ie. the single VM started in a
"non-forked container" (or whatever it is called)...?).

Or is the "forked VM" of the error message the front end that forks yet
another VM to do the job, and it's this second VM that is left running?
(ie. the "forked VM" of the error message is a VM started by maven
surefire, and this VM runs a "forked container" that starts yet another
VM where karaf is started and tests are run)




--

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 

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a recent pax exam karaf provisioning example somewhere?

Achim Nierbeck
And it might be that this is an issue on your windows box, cause I rarely have this kind of behavior on a mac. 

regards, Achim 

2017-04-15 15:55 GMT+02:00 Achim Nierbeck <[hidden email]>:
Hi, 

the karaf container is always a forked process. If you want to run it as non-forked you can use the following configuration:

runEmbedded(true)

this is especially useful if you want to debug your tests, but beware because of the nature of how the tests run, this can only be used with debugging and one test-method. 

regards, Achim 


2017-04-15 14:57 GMT+02:00 Steinar Bang <[hidden email]>:
>>>>> Steinar Bang <[hidden email]>:

> There is this output at the end of the "mvn clean install":
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project ukelonn.tests: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
> [ERROR] Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_121\jre\bin\java" -jar C:\Users\sbang\workspaces\ws06\ukelonn\ukelonn.tests\target\surefire\surefirebooter5197692333401719291.jar C:\Users\sbang\workspaces\ws06\ukelonn\ukelonn.tests\target\surefire\surefire8860295739440543272tmp C:\Users\sbang\workspaces\ws06\ukelonn\ukelonn.tests\target\surefire\surefire_05835872688929628334tmp"

> Obviously maven thinks the process has terminated.  Just as obviously
> there is still a java process running (that prevents delete of the
> target\exam directory structure).

The documentation says "With the Forked Container, the system under test
runs in a separate Java virtual machine under remote control from the
test driver."
 https://ops4j1.jira.com/wiki/display/PAXEXAM4/Pax+Exam

How do I figure out whether I'm running a "forked container" or not?

Is the mentioned "forked VM" in the rror message that has terminated,
the VM actually running the tests? (ie. the single VM started in a
"non-forked container" (or whatever it is called)...?).

Or is the "forked VM" of the error message the front end that forks yet
another VM to do the job, and it's this second VM that is left running?
(ie. the "forked VM" of the error message is a VM started by maven
surefire, and this VM runs a "forked container" that starts yet another
VM where karaf is started and tests are run)




--

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 




--

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 

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a recent pax exam karaf provisioning example somewhere?

Steinar Bang
In reply to this post by Achim Nierbeck
>>>>> Achim Nierbeck <[hidden email]>:

> the karaf container is always a forked process. If you want to run it as
> non-forked you can use the following configuration:

> runEmbedded(true)

> this is especially useful if you want to debug your tests, but beware
> because of the nature of how the tests run, this can only be used with
> debugging and one test-method.

Right.

In the meantime I've found this thread
 http://karaf.922171.n3.nabble.com/Pax-exam-tests-fail-to-start-properly-with-Karaf-4-0-4-tp4044841p4044843.html

and have applied the same cure:
    <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-surefire-plugin</artifactId>
     <configuration>
      <forkCount>0</forkCount>
     </configuration>
    </plugin>

And that works... that is: it still doesn't start, but at least there
isn't a Java VM still running after the test has failed.

Does this the trigger the same behaviour as the runEmbedded(true)
configuration? Or is that a competely different mechanism?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a recent pax exam karaf provisioning example somewhere?

Achim Nierbeck
totally different ;) 

if you are brave, you may want to take a look at the pax-web integration tests with Karaf. [1]
Maybe there are enough hints for you to find out where exactly is your mismatch :) 

regards, Achim  


2017-04-15 16:00 GMT+02:00 Steinar Bang <[hidden email]>:
>>>>> Achim Nierbeck <[hidden email]>:

> the karaf container is always a forked process. If you want to run it as
> non-forked you can use the following configuration:

> runEmbedded(true)

> this is especially useful if you want to debug your tests, but beware
> because of the nature of how the tests run, this can only be used with
> debugging and one test-method.

Right.

In the meantime I've found this thread
 http://karaf.922171.n3.nabble.com/Pax-exam-tests-fail-to-start-properly-with-Karaf-4-0-4-tp4044841p4044843.html

and have applied the same cure:
    <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-surefire-plugin</artifactId>
     <configuration>
      <forkCount>0</forkCount>
     </configuration>
    </plugin>

And that works... that is: it still doesn't start, but at least there
isn't a Java VM still running after the test has failed.

Does this the trigger the same behaviour as the runEmbedded(true)
configuration? Or is that a competely different mechanism?




--

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 

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a recent pax exam karaf provisioning example somewhere?

Steinar Bang
In reply to this post by Achim Nierbeck
>>>>> Achim Nierbeck <[hidden email]>:

> And it might be that this is an issue on your windows box, cause I
> rarely have this kind of behavior on a mac.

Right. My production system is debian GNU/linux, and I also have a
debian dev box, so I could try there if I'm completely stumped.

On the other hand I prefer to have a build that behaves identically on
different platforms... so I think I will continue trying until it works.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a recent pax exam karaf provisioning example somewhere?

Steinar Bang
In reply to this post by Achim Nierbeck
>>>>> Achim Nierbeck <[hidden email]>:

> totally different ;)

Right.  The behaviour was different as well:
With
    public Option[] config() {
        final MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf-minimal").type("zip").versionAsInProject();
        final MavenArtifactUrlReference karafStandrdRepo = maven().groupId("org.apache.karaf.features").artifactId("standard").versionAsInProject().type("xml").classifier("features");
        final MavenArtifactUrlReference ukelonnFeatureRepo = maven().groupId("no.priv.bang.ukelonn").artifactId("ukelonn.karaf").versionAsInProject().type("xml").classifier("features");
        return options(
            karafDistributionConfiguration().frameworkUrl(karafUrl).unpackDirectory(new File("target/exam")).useDeployFolder(false).runEmbedded(true),
            configureConsole().ignoreLocalConsole().ignoreRemoteShell(),
            features(karafStandrdRepo, "pax-jdbc"),
            junitBundles(),
            features(ukelonnFeatureRepo, "ukelonn-db-derby-test", "ukelonn"));
    }

what I got from maven, was:
 Running no.priv.bang.ukelonn.tests.UkelonnServiceIntegrationTest
 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
 SLF4J: Defaulting to no-operation (NOP) logger implementation
 SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
 Exception in thread "KarafEmbeddedRunner" java.lang.RuntimeException: No Karaf main found
         at org.ops4j.pax.exam.karaf.container.internal.runner.KarafEmbeddedRunner$1.run(KarafEmbeddedRunner.java:85)
 Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 182.318 sec <<< FAILURE! - in no.priv.bang.ukelonn.tests.UkelonnServiceIntegrationTest
 no.priv.bang.ukelonn.tests.UkelonnServiceIntegrationTest  Time elapsed: 182.015 sec  <<< ERROR!
 java.lang.RuntimeException: Cannot get the remote bundle context
 Caused by: java.rmi.NotBoundException: bfa21964-9d13-4a55-b633-f0bc4368077a
 
 no.priv.bang.ukelonn.tests.UkelonnServiceIntegrationTest  Time elapsed: 182.318 sec  <<< ERROR!
 java.lang.RuntimeException: Container never came up
         at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:367)
         at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:274)
         at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
         at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:161)

so there is probably something missing from my setup.

For now, I will go back to the surefire config (it saves me the job of
manually killing the leftover java processes, and gets further before
it fails).

> if you are brave, you may want to take a look at the pax-web integration
> tests with Karaf. [1]
> Maybe there are enough hints for you to find out where exactly is your
> mismatch :)

> [1] - https://github.com/ops4j/org.ops4j.pax.web/tree/master/pax-web-itest/pax-web-itest-karaf/src/test/java/org/ops4j/pax/web/itest/karaf

Thanks for the tip! I will keep looking.
And post the reason when/if I find it (or find a workaround).

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is there a recent pax exam karaf provisioning example somewhere?

Steinar Bang
>>>>> You wrote:

> For now, I will go back to the surefire config (it saves me the job of
> manually killing the leftover java processes, and gets further before
> it fails).

Summary: The surefire "<forkCount>0</forkCount>" config didn't work, and the leftover Java VM is a problem with surefire 2.19 and later

With the surefire "<forkCount>0</forkCount>" config in place, the test
failed much earlier, before the karaf runtime was even ready to start:
 [WARNING] useSystemClassloader setting has no effect when not forking
 Running no.priv.bang.ukelonn.tests.UkelonnServiceIntegrationTest
 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
 SLF4J: Defaulting to no-operation (NOP) logger implementation
 SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
 Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.132 sec <<< FAILURE! - in no.priv.bang.ukelonn.tests.UkelonnServiceIntegrationTest
 no.priv.bang.ukelonn.tests.UkelonnServiceIntegrationTest  Time elapsed: 0.123 sec  <<< ERROR!
 java.lang.RuntimeException: Problem starting container
 Caused by: java.net.MalformedURLException: unknown protocol: mvn

 no.priv.bang.ukelonn.tests.UkelonnServiceIntegrationTest  Time elapsed: 0.132 sec  <<< ERROR!
 java.lang.NullPointerException
         at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:367)
         at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:274)
         at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
         at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:161)

The leftover Java VM is a surefire issue.  It is an issue both with
surefire 2.19.1 that I was running, and the current surefire 2.20.
 http://maven.40175.n5.nabble.com/surefire-forked-vm-failed-tp5858900p5859320.html

However, leftover VM isn't an issue with surefire 2.18, so I've
downgraded to surefire 2.18.

Now I'm back to the issue of why the pax-jdbc feature isn't found:
 1. It's found in a regular karaf instance
 2. It didn't help specifying the feature repository containing the
    feature pax-jdbc in my feature file

All and any ideas are welcome!

12
Loading...