You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Steinar Bang <sb...@dod.no> on 2017/04/17 06:23:56 UTC

"No Karaf main found" when using runEmbedded(true) on pax exam test (Was: Is there a recent pax exam karaf provisioning example somewhere?)

>>>>> Steinar Bang <sb...@dod.no>:

>  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

Since I would like to be able to debug into the pax exam test, I tried
running the karaf container embedded again.

But I still got the "No karaf main found" error message.

I googled the error message and found this pax exam issue:
 https://ops4j1.jira.com/browse/PAXEXAM-742

PAXEXAM-742 is fixed in pax exam 4.7.0.

I am currently running pax exam 4.9.1 and karaf 4.0.9 (got the same
error on karaf 4.0.7).

Could it be that the error has reappeared in pax exam?

Or am doing something wrong in the setup or have something missing from
the setup?

Here's the config:
    @Configuration
    public Option[] config() {
        final MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf-minimal").type("zip").versionAsInProject();
        final MavenArtifactUrlReference paxJdbcRepo = maven().groupId("org.ops4j.pax.jdbc").artifactId("pax-jdbc-features").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(),
            junitBundles(),
            features(paxJdbcRepo),
            features(ukelonnFeatureRepo, "ukelonn-db-derby-test", "ukelonn"));
    }


Re: "No Karaf main found" when using runEmbedded(true) on pax exam test

Posted by Steinar Bang <sb...@dod.no>.
>>>>> Jean-Baptiste Onofr <jb...@nanthrax.net>:

> I will update the doc/latest release.

Ok. Good! :-)

And I can verify that upgrading pax exam from 4.9.1 to 4.10.0 worked for
me, and that I am now successfully running the pax exam karaf container
in embedded mode on windows.

My version numbers are:
 pax exam version 4.10.0
 karaf version 4.0.9

(The reason for running in embedded mode was to make it possible to debug
the tests.)





Re: "No Karaf main found" when using runEmbedded(true) on pax exam test

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

I will update the doc/latest release.

Regards
JB

On 04/17/2017 09:03 AM, Steinar Bang wrote:
>>>>>> Steinar Bang <sb...@dod.no>:
>
>>> I googled the error message and found this pax exam issue:
>>> https://ops4j1.jira.com/browse/PAXEXAM-742
>
>>> PAXEXAM-742 is fixed in pax exam 4.7.0.
>
>>> I am currently running pax exam 4.9.1 and karaf 4.0.9 (got the same
>>> error on karaf 4.0.7).
>
>>> Could it be that the error has reappeared in pax exam?
>
>>> Or am doing something wrong in the setup or have something missing from
>>> the setup?
>
>> I know why: it's because I'm on windows.
>
>> It's this test in KarafEmbeddedRunner:
>>                     else {
>>                         if (file.getPath().contains("/boot")) {
>>                             // karaf 4.x
>>                             mainBundles.add(file);
>>                         }
>
>> My file here is has "\boot", rather than "/boot":
>> C:\Users\sbang\workspaces\ws06\ukelonn\ukelonn.tests\target\exam\6086a15a-1ba8-45c4-856d-28e0e7693337\lib\boot\org.apache.karaf.diagnostic.boot-4.0.9.jar
>
>> I will try to make a fix and create a pull request.
>
> No need.  This is already fixed in git:
>  https://github.com/ops4j/org.ops4j.pax.exam2/commit/470aa720f314ddbd4cff4bfe39fee835b1cba598
>
> The pax exam documentation mentions 4.9.1 as the newest
>  https://ops4j1.jira.com/wiki/display/PAXEXAM4/Pax+Exam
>
> But it looks like 4.10 has been released to maven central, and it looks
> like 4.10 might contain the fix.  I will try that.
>

-- 
Jean-Baptiste Onofr
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: "No Karaf main found" when using runEmbedded(true) on pax exam test

Posted by Steinar Bang <sb...@dod.no>.
>>>>> Steinar Bang <sb...@dod.no>:

>> I googled the error message and found this pax exam issue:
>> https://ops4j1.jira.com/browse/PAXEXAM-742

>> PAXEXAM-742 is fixed in pax exam 4.7.0.

>> I am currently running pax exam 4.9.1 and karaf 4.0.9 (got the same
>> error on karaf 4.0.7).

>> Could it be that the error has reappeared in pax exam?

>> Or am doing something wrong in the setup or have something missing from
>> the setup?

> I know why: it's because I'm on windows.

> It's this test in KarafEmbeddedRunner:
>                     else {
>                         if (file.getPath().contains("/boot")) {
>                             // karaf 4.x
>                             mainBundles.add(file);
>                         } 

> My file here is has "\boot", rather than "/boot":
> C:\Users\sbang\workspaces\ws06\ukelonn\ukelonn.tests\target\exam\6086a15a-1ba8-45c4-856d-28e0e7693337\lib\boot\org.apache.karaf.diagnostic.boot-4.0.9.jar

> I will try to make a fix and create a pull request.

No need.  This is already fixed in git:
 https://github.com/ops4j/org.ops4j.pax.exam2/commit/470aa720f314ddbd4cff4bfe39fee835b1cba598

The pax exam documentation mentions 4.9.1 as the newest
 https://ops4j1.jira.com/wiki/display/PAXEXAM4/Pax+Exam

But it looks like 4.10 has been released to maven central, and it looks
like 4.10 might contain the fix.  I will try that.


Re: "No Karaf main found" when using runEmbedded(true) on pax exam test

Posted by Steinar Bang <sb...@dod.no>.
>>>>> Steinar Bang <sb...@dod.no>:
> I googled the error message and found this pax exam issue:
>  https://ops4j1.jira.com/browse/PAXEXAM-742

> PAXEXAM-742 is fixed in pax exam 4.7.0.

> I am currently running pax exam 4.9.1 and karaf 4.0.9 (got the same
> error on karaf 4.0.7).

> Could it be that the error has reappeared in pax exam?

> Or am doing something wrong in the setup or have something missing from
> the setup?

I know why: it's because I'm on windows.

It's this test in KarafEmbeddedRunner:
                    else {
                        if (file.getPath().contains("/boot")) {
                            // karaf 4.x
                            mainBundles.add(file);
                        } 

My file here is has "\boot", rather than "/boot":
C:\Users\sbang\workspaces\ws06\ukelonn\ukelonn.tests\target\exam\6086a15a-1ba8-45c4-856d-28e0e7693337\lib\boot\org.apache.karaf.diagnostic.boot-4.0.9.jar

I will try to make a fix and create a pull request.

Should I create a Jira issue first?  Eg. "Pax exam karaf with embedded
karaf doesn't work on windows"?

Is the self registration up and running in Jira?