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

What's the difference between org.osgi.core-6.0.0.jar and felix and/or equinox?

I'm trying to figure out why my pax exam tests are failing on
openjdk-11, and am trying to trace the difference between regular karaf
startup on openjdk-11 (karaf starts and runs fine on openjdk-11) and pax
exam karaf startup on openjdk-11 (which fails for me).

I was trying to figure out what framework is used to boot karaf, and
couldn't see anything in karaf.log.

So I looked in the boot directory of karaf, but that only contains
org.osgi.core-6.0.0.jar.

What's the relationship between org.osgi.core-6.0.0.jar and the felix
and/or equinox framework?

Is org.osgi.core-6.0.0.jar a version of the felix framework?

Or does org.osgi.core-6.0.0.jar only contain interfaces used by all OSGi
6 frameworks?  (but if so: where does karaf find the framework it should
use to boot)

Could the pax exam fix be to exclude the equinox and felix frameworks
pulled into the classpath by transitive dependencies on the karaf JDBC
feature?

And/or should I add org.osgi.core-6.0.0.jar as a dependency to the pax
exam test, to pull it into the classpath?

Thanks!


- Steinar


Re: What's the difference between org.osgi.core-6.0.0.jar and felix and/or equinox?

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

> Is org.osgi.core-6.0.0.jar a version of the felix framework?

No.

> Or does org.osgi.core-6.0.0.jar only contain interfaces used by all OSGi
> 6 frameworks?

Yes.

> (but if so: where does karaf find the framework it should use to boot)

It's in etc/config.properties :
 karaf.framework.felix=mvn\:org.apache.felix/org.apache.felix.framework/5.6.12

> Could the pax exam fix be to exclude the equinox and felix frameworks
> pulled into the classpath by transitive dependencies on the karaf JDBC
> feature?

Excluding both frameworks just makes startup fail because karaf boot is
unable to find the class org.osgi.framework.BundleException

> And/or should I add org.osgi.core-6.0.0.jar as a dependency to the pax
> exam test, to pull it into the classpath?

No.  By itself it isn't enough, and when a framework is loaded it
doesn't seem to make any difference whether it is included or not.

And including the 5.6.12 framework, which is the same one karaf 4.2.5
boots with, causes the boot to fail when trying to load the first bundle
listed in etc/startup.properties:
Exception in thread "KarafEmbeddedRunner" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
	at org.ops4j.pax.exam.karaf.container.internal.runner.KarafEmbeddedRunner$1.run(KarafEmbeddedRunner.java:96)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.ops4j.pax.exam.karaf.container.internal.runner.KarafEmbeddedRunner$1.run(KarafEmbeddedRunner.java:86)
Caused by: java.lang.RuntimeException: Error installing bundle listed in startup.properties with url: mvn:org.apache.karaf.features/org.apache.karaf.features.extension/4.2.5 and startlevel: 1
	at org.apache.karaf.main.Main.installAndStartBundles(Main.java:530)
	at org.apache.karaf.main.Main.launch(Main.java:273)
	... 5 more
Caused by: org.osgi.framework.BundleException: Could not create bundle object.
	at org.apache.felix.framework.Felix.installBundle(Felix.java:3095)
	at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:167)
	at org.apache.karaf.main.Main.installAndStartBundles(Main.java:523)
	... 6 more
Caused by: java.lang.UnsupportedOperationException: Unable to add extension bundle.
	at org.apache.felix.framework.ExtensionManager.addExtensionBundle(ExtensionManager.java:439)
	at org.apache.felix.framework.Felix.installBundle(Felix.java:3061)
	... 8 more


Re: What's the difference between org.osgi.core-6.0.0.jar and felix and/or equinox?

Posted by Achim Nierbeck <bc...@googlemail.com.INVALID>.
Hi,

just had a very interesting issue which might be related.
While working on my Karaf Vertx[1] project, I'm having the following
issues:
The integration tests with my custom Karaf distribution work nicely when
run with eclipse (running OpenJDK 11)
on the other hand those tests fail for me when running via maven.
I'm still trying to figuring out why though ...

regards, Achim


[1] - https://github.com/ANierbeck/Karaf-Vertx

Am So., 23. Juni 2019 um 17:19 Uhr schrieb Jean-Baptiste Onofré <
jb@nanthrax.net>:

> Sure !
>
> Just ping me anytime.
>
> By the way, for the other on the mailing list, I will be off next
> Thursday and Friday.
>
> Regards
> JB
>
> On 23/06/2019 17:16, Steinar Bang wrote:
> >>>>>> Jean-Baptiste Onofré <jb...@nanthrax.net>:
> >
> >> To be honest, I don't understand your issue: itest just works fine in
> >> Karaf (in my box, in Jenkins).
> >
> > It could be something in my setup.
> >
> > As mentioned in a different thread on the ops4j list, karaf master is
> > also failing in itest on "mvn clean install" on my development system.
> >
> > But I'm scratching my head trying to figure out what this is, because
> > the symptoms/error messages are different on the karaf itest than what I
> > see in my own pax exam tests.
> >
> >> So, in order for you to move forward, I'm proposing my help to fix your
> >> issue (at least trying to reproduce). Please contact me directly, we
> >> will work together on your issue.
> >
> > That's a kind offer I may take you up on. :-)
> >
> > But first I will go back to the karaf itests and try to get them to
> > build on my system or at least figure out why the fail.  I need to
> > ensure myself that I'm not fooling myself, before I start wasting the
> > time of others...:-)
> >
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>


-- 

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

Re: What's the difference between org.osgi.core-6.0.0.jar and felix and/or equinox?

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Sure !

Just ping me anytime.

By the way, for the other on the mailing list, I will be off next
Thursday and Friday.

Regards
JB

On 23/06/2019 17:16, Steinar Bang wrote:
>>>>>> Jean-Baptiste Onofré <jb...@nanthrax.net>:
> 
>> To be honest, I don't understand your issue: itest just works fine in
>> Karaf (in my box, in Jenkins).
> 
> It could be something in my setup.  
> 
> As mentioned in a different thread on the ops4j list, karaf master is
> also failing in itest on "mvn clean install" on my development system.
> 
> But I'm scratching my head trying to figure out what this is, because
> the symptoms/error messages are different on the karaf itest than what I
> see in my own pax exam tests.
> 
>> So, in order for you to move forward, I'm proposing my help to fix your
>> issue (at least trying to reproduce). Please contact me directly, we
>> will work together on your issue.
> 
> That's a kind offer I may take you up on. :-)
> 
> But first I will go back to the karaf itests and try to get them to
> build on my system or at least figure out why the fail.  I need to
> ensure myself that I'm not fooling myself, before I start wasting the
> time of others...:-)
> 

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

Re: karaf iTest results on my machine (Was: What's the difference between org.osgi.core-6.0.0.jar and felix and/or equinox?)

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

You can relaunch the failing tests, it's probably flacky one (I will
improve them).

Anyway, it looks good, so as said, the itests works with JDK 11.0.3.

Regards
JB

On 23/06/2019 21:32, Steinar Bang wrote:
>>>>>> Steinar Bang <sb...@dod.no>:
> 
>> As mentioned in a different thread on the ops4j list, karaf master is
>> also failing in itest on "mvn clean install" on my development system.
> [snip!]
>> But first I will go back to the karaf itests and try to get them to
>> build on my system or at least figure out why the fail.  I need to
>> ensure myself that I'm not fooling myself, before I start wasting the
>> time of others...:-)
> 
> Ok, now I done a fresh pull of karaf master, followed by a clean and a
> build, ie.
>  git pull
>  mvn clean
>  mvn install
> 
> OS is debian 9.9 "stretch" (newest stable)
> CPU architecture is amd64
> 
> java -version, is:
> openjdk version "11.0.3" 2019-04-16
> OpenJDK Runtime Environment (build 11.0.3+7-Debian-1bpo92)
> OpenJDK 64-Bit Server VM (build 11.0.3+7-Debian-1bpo92, mixed mode, sharing)
> 
> mvn -version, is:
> Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T20:41:47+02:00)
> Maven home: /usr/local/apache-maven
> Java version: 11.0.3, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11-openjdk-amd64
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux", version: "4.9.0-9-amd64", arch: "amd64", family: "unix"
> 
> sb@lorenzo:~/workspaces/karaf/karaf$ env | grep LC
> LC_COLLATE=POSIX
> sb@lorenzo:~/workspaces/karaf/karaf$ env | grep LOC
> sb@lorenzo:~/workspaces/karaf/karaf$
> 
> 
> Most iTests work, but I have 3 tests failing with "error" and one
> failing with failure.
> 
> The three failing with error, are:
> org.apache.karaf.itests.FelixHttpTest.txt:4:Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 16.438 s <<< FAILURE! - in org.apache.karaf.itests.FelixHttpTest
> org.apache.karaf.itests.JmsTest.txt:4:Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 29.595 s <<< FAILURE! - in org.apache.karaf.itests.JmsTest
> org.apache.karaf.itests.examples.RestExampleTest.txt:4:Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 24.989 s <<< FAILURE! - in org.apache.karaf.itests.examples.RestExampleTest
> 
> The one failing with failure, is:
> org.apache.karaf.itests.examples.JpaExampleTest.txt:4:Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 50.777 s <<< FAILURE! - in org.apache.karaf.itests.examples.JpaExampleTest
> 
> There is no particular pattern I can identify from the errors:
> org.apache.karaf.itests.FelixHttpTest.txt:
> -------------------------------------------------------------------------------
> Test set: org.apache.karaf.itests.FelixHttpTest
> -------------------------------------------------------------------------------
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 16.438 s <<< FAILURE! - in org.apache.karaf.itests.FelixHttpTest
> testHttpService(org.apache.karaf.itests.FelixHttpTest)  Time elapsed: 10.586 s  <<< ERROR!
> java.io.FileNotFoundException: http://localhost:8181/servlet-example
> 	at org.apache.karaf.itests.FelixHttpTest.testHttpService(FelixHttpTest.java:51)
> 
> org.apache.karaf.itests.JmsTest.txt:
> -------------------------------------------------------------------------------
> Test set: org.apache.karaf.itests.JmsTest
> -------------------------------------------------------------------------------
> Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 29.595 s <<< FAILURE! - in org.apache.karaf.itests.JmsTest
> testMBean(org.apache.karaf.itests.JmsTest)  Time elapsed: 16.975 s  <<< ERROR!
> javax.management.MBeanException: No JMS connection factory found for jms/testMBean
> 	at org.apache.karaf.itests.JmsTest.testMBean(JmsTest.java:124)
> 
> org.apache.karaf.itests.examples.RestExampleTest.txt:
> -------------------------------------------------------------------------------
> Test set: org.apache.karaf.itests.examples.RestExampleTest
> -------------------------------------------------------------------------------
> Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 24.989 s <<< FAILURE! - in org.apache.karaf.itests.examples.RestExampleTest
> testWithCxfClient(org.apache.karaf.itests.examples.RestExampleTest)  Time elapsed: 7.258 s  <<< ERROR!
> org.ops4j.pax.exam.WrappedTestContainerException: [org.apache.karaf.itests.examples.RestExampleTest: rerun this test pls]
> 
> The single failure looks like this:
> -------------------------------------------------------------------------------
> Test set: org.apache.karaf.itests.examples.JpaExampleTest
> -------------------------------------------------------------------------------
> Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 50.777 s <<< FAILURE! - in org.apache.karaf.itests.examples.JpaExampleTest
> test(org.apache.karaf.itests.examples.JpaExampleTest)  Time elapsed: 42.868 s  <<< FAILURE!
> java.lang.AssertionError: 
> Should contain 'AF520' but was : ID │ Flight │ Customer
> ───┼────────┼─────────
> 
> 	at org.apache.karaf.itests.examples.JpaExampleTest.testCommand(JpaExampleTest.java:74)
> 	at org.apache.karaf.itests.examples.JpaExampleTest.test(JpaExampleTest.java:49)
> 

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

Re: karaf iTest results on my machine

Posted by Steinar Bang <sb...@dod.no>.
>>>>> Steinar Bang <sb...@dod.no>:
> Most iTests work, but I have 3 tests failing with "error" and one
> failing with failure.

> The three failing with error, are:
> org.apache.karaf.itests.FelixHttpTest.txt:4:Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 16.438 s <<< FAILURE! - in org.apache.karaf.itests.FelixHttpTest
> org.apache.karaf.itests.JmsTest.txt:4:Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 29.595 s <<< FAILURE! - in org.apache.karaf.itests.JmsTest
> org.apache.karaf.itests.examples.RestExampleTest.txt:4:Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 24.989 s <<< FAILURE! - in org.apache.karaf.itests.examples.RestExampleTest

> The one failing with failure, is:
> org.apache.karaf.itests.examples.JpaExampleTest.txt:4:Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 50.777 s <<< FAILURE! - in org.apache.karaf.itests.examples.JpaExampleTest

The same tests fails in the same way on my system when building with openjdk-8.
Ie. the karaf build issues on my system aren't openjdk-11 related.


karaf iTest results on my machine (Was: What's the difference between org.osgi.core-6.0.0.jar and felix and/or equinox?)

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

> As mentioned in a different thread on the ops4j list, karaf master is
> also failing in itest on "mvn clean install" on my development system.
[snip!]
> But first I will go back to the karaf itests and try to get them to
> build on my system or at least figure out why the fail.  I need to
> ensure myself that I'm not fooling myself, before I start wasting the
> time of others...:-)

Ok, now I done a fresh pull of karaf master, followed by a clean and a
build, ie.
 git pull
 mvn clean
 mvn install

OS is debian 9.9 "stretch" (newest stable)
CPU architecture is amd64

java -version, is:
openjdk version "11.0.3" 2019-04-16
OpenJDK Runtime Environment (build 11.0.3+7-Debian-1bpo92)
OpenJDK 64-Bit Server VM (build 11.0.3+7-Debian-1bpo92, mixed mode, sharing)

mvn -version, is:
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T20:41:47+02:00)
Maven home: /usr/local/apache-maven
Java version: 11.0.3, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.9.0-9-amd64", arch: "amd64", family: "unix"

sb@lorenzo:~/workspaces/karaf/karaf$ env | grep LC
LC_COLLATE=POSIX
sb@lorenzo:~/workspaces/karaf/karaf$ env | grep LOC
sb@lorenzo:~/workspaces/karaf/karaf$


Most iTests work, but I have 3 tests failing with "error" and one
failing with failure.

The three failing with error, are:
org.apache.karaf.itests.FelixHttpTest.txt:4:Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 16.438 s <<< FAILURE! - in org.apache.karaf.itests.FelixHttpTest
org.apache.karaf.itests.JmsTest.txt:4:Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 29.595 s <<< FAILURE! - in org.apache.karaf.itests.JmsTest
org.apache.karaf.itests.examples.RestExampleTest.txt:4:Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 24.989 s <<< FAILURE! - in org.apache.karaf.itests.examples.RestExampleTest

The one failing with failure, is:
org.apache.karaf.itests.examples.JpaExampleTest.txt:4:Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 50.777 s <<< FAILURE! - in org.apache.karaf.itests.examples.JpaExampleTest

There is no particular pattern I can identify from the errors:
org.apache.karaf.itests.FelixHttpTest.txt:
-------------------------------------------------------------------------------
Test set: org.apache.karaf.itests.FelixHttpTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 16.438 s <<< FAILURE! - in org.apache.karaf.itests.FelixHttpTest
testHttpService(org.apache.karaf.itests.FelixHttpTest)  Time elapsed: 10.586 s  <<< ERROR!
java.io.FileNotFoundException: http://localhost:8181/servlet-example
	at org.apache.karaf.itests.FelixHttpTest.testHttpService(FelixHttpTest.java:51)

org.apache.karaf.itests.JmsTest.txt:
-------------------------------------------------------------------------------
Test set: org.apache.karaf.itests.JmsTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 29.595 s <<< FAILURE! - in org.apache.karaf.itests.JmsTest
testMBean(org.apache.karaf.itests.JmsTest)  Time elapsed: 16.975 s  <<< ERROR!
javax.management.MBeanException: No JMS connection factory found for jms/testMBean
	at org.apache.karaf.itests.JmsTest.testMBean(JmsTest.java:124)

org.apache.karaf.itests.examples.RestExampleTest.txt:
-------------------------------------------------------------------------------
Test set: org.apache.karaf.itests.examples.RestExampleTest
-------------------------------------------------------------------------------
Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 24.989 s <<< FAILURE! - in org.apache.karaf.itests.examples.RestExampleTest
testWithCxfClient(org.apache.karaf.itests.examples.RestExampleTest)  Time elapsed: 7.258 s  <<< ERROR!
org.ops4j.pax.exam.WrappedTestContainerException: [org.apache.karaf.itests.examples.RestExampleTest: rerun this test pls]

The single failure looks like this:
-------------------------------------------------------------------------------
Test set: org.apache.karaf.itests.examples.JpaExampleTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 50.777 s <<< FAILURE! - in org.apache.karaf.itests.examples.JpaExampleTest
test(org.apache.karaf.itests.examples.JpaExampleTest)  Time elapsed: 42.868 s  <<< FAILURE!
java.lang.AssertionError: 
Should contain 'AF520' but was : ID │ Flight │ Customer
───┼────────┼─────────

	at org.apache.karaf.itests.examples.JpaExampleTest.testCommand(JpaExampleTest.java:74)
	at org.apache.karaf.itests.examples.JpaExampleTest.test(JpaExampleTest.java:49)


Re: What's the difference between org.osgi.core-6.0.0.jar and felix and/or equinox?

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

> To be honest, I don't understand your issue: itest just works fine in
> Karaf (in my box, in Jenkins).

It could be something in my setup.  

As mentioned in a different thread on the ops4j list, karaf master is
also failing in itest on "mvn clean install" on my development system.

But I'm scratching my head trying to figure out what this is, because
the symptoms/error messages are different on the karaf itest than what I
see in my own pax exam tests.

> So, in order for you to move forward, I'm proposing my help to fix your
> issue (at least trying to reproduce). Please contact me directly, we
> will work together on your issue.

That's a kind offer I may take you up on. :-)

But first I will go back to the karaf itests and try to get them to
build on my system or at least figure out why the fail.  I need to
ensure myself that I'm not fooling myself, before I start wasting the
time of others...:-)


Re: What's the difference between org.osgi.core-6.0.0.jar and felix and/or equinox?

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

org.osgi.core is the spec, so it's "embedded" and provided by the
framework (felix or equinox).

In your code, you don't want to depend from the framework, but only from
the spec.

So, you can have org.osgi.core dependency in your test (scope provided)
in you use for instance BundleContext. In Karaf, we embed the spec
because it's used internally before starting the framework (remember
that Karaf is able to "abstract" the framework).

To be honest, I don't understand your issue: itest just works fine in
Karaf (in my box, in Jenkins).

So, in order for you to move forward, I'm proposing my help to fix your
issue (at least trying to reproduce). Please contact me directly, we
will work together on your issue.

Regards
JB

On 23/06/2019 16:17, Steinar Bang wrote:
> I'm trying to figure out why my pax exam tests are failing on
> openjdk-11, and am trying to trace the difference between regular karaf
> startup on openjdk-11 (karaf starts and runs fine on openjdk-11) and pax
> exam karaf startup on openjdk-11 (which fails for me).
> 
> I was trying to figure out what framework is used to boot karaf, and
> couldn't see anything in karaf.log.
> 
> So I looked in the boot directory of karaf, but that only contains
> org.osgi.core-6.0.0.jar.
> 
> What's the relationship between org.osgi.core-6.0.0.jar and the felix
> and/or equinox framework?
> 
> Is org.osgi.core-6.0.0.jar a version of the felix framework?
> 
> Or does org.osgi.core-6.0.0.jar only contain interfaces used by all OSGi
> 6 frameworks?  (but if so: where does karaf find the framework it should
> use to boot)
> 
> Could the pax exam fix be to exclude the equinox and felix frameworks
> pulled into the classpath by transitive dependencies on the karaf JDBC
> feature?
> 
> And/or should I add org.osgi.core-6.0.0.jar as a dependency to the pax
> exam test, to pull it into the classpath?
> 
> Thanks!
> 
> 
> - Steinar
> 

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