Problems running pax exam with openjdk-8

746 views
Skip to first unread message

Steinar Bang

unread,
Jun 1, 2019, 4:55:13 PM6/1/19
to op...@googlegroups.com
This pax exam test, using the karaf runner, with karaf 4.2.5, runs with openjdk-8 but fails with openjdk-11:
https://github.com/steinarb/scratch/blob/authservice/use-java-11/authservice.tests/src/test/java/no/priv/bang/authservice/tests/AuthserviceIntegrationTest.java#L25

Will pax exam work with openjdk-11? Should switching JDK have worked
out of the box? Or will the test code or dependencies need to be
modified?

Here's the error message from the failing build:
[INFO] --- maven-surefire-plugin:2.20:test (default-test) @ authservice.tests ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running no.priv.bang.authservice.tests.AuthserviceIntegrationTest
[org.ops4j.pax.exam.spi.DefaultExamSystem] : Pax Exam System (Version: 4.13.1) created.
[org.ops4j.store.intern.TemporaryStore] : Storage Area is /tmp/1559417194161-0
[org.ops4j.pax.exam.junit.impl.ProbeRunner] : creating PaxExam runner for class no.priv.bang.authservice.tests.AuthserviceIntegrationTest
[org.ops4j.pax.exam.spi.PaxExamRuntime] : Found TestContainerFactory: org.ops4j.pax.exam.karaf.container.internal.KarafTestContainerFactory
[org.ops4j.pax.exam.spi.DefaultExamSystem] : creating default probe
[org.ops4j.pax.exam.spi.reactors.ReactorManager] : No User defined probe hook found
[org.ops4j.pax.exam.spi.intern.DefaultTestAddress] : NEW ADDRESS= PaxExam-014331d4-de30-4465-8f96-892a167e3d09 parent=null root=[TestAddress:PaxExam-014331d4-de30-4465-8f96-892a167e3d09 root:PaxExam-014331d4-de30-4465-8f96-892a167e3d09] args=[Ljava.lang.Object;@276438c9
[org.ops4j.pax.exam.spi.DefaultExamReactor] : Staging reactor with probes: 1 using strategy: org.ops4j.pax.exam.spi.reactors.PerClass@7181ae3f
[org.ops4j.store.intern.TemporaryStore] : Storage Area is /tmp/1559417194161-0
[org.ops4j.pax.exam.spi.intern.DefaultTestAddress] : NEW ADDRESS= PaxExam-e162e3b7-1659-436b-9231-95d124345ca1 parent=[TestAddress:PaxExam-014331d4-de30-4465-8f96-892a167e3d09 root:PaxExam-014331d4-de30-4465-8f96-892a167e3d09] root=[TestAddress:PaxExam-014331d4-de30-4465-8f96-892a167e3d09 root:PaxExam-014331d4-de30-4465-8f96-892a167e3d09] args=[Ljava.lang.Object;@2d127a61
[org.ops4j.pax.exam.junit.impl.ProbeRunner] : running test class no.priv.bang.authservice.tests.AuthserviceIntegrationTest
[org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer] : Creating RMI registry server on 127.0.0.1:21000
[org.ops4j.store.intern.TemporaryStore] : Storage Area is /tmp/1559417194161-0
[org.ops4j.pax.url.mvn.internal.Connection] : Resolving [mvn:org.apache.karaf/apache-karaf-minimal/4.2.5/zip]
[shaded.org.eclipse.aether.internal.impl.DefaultLocalRepositoryProvider] : Using manager SimpleLocalRepositoryManager with priority 0.0 for /home/sb/.m2/repository Ignored FQCN: shaded.org.eclipse.aether.internal.impl.slf4j.Slf4jLoggerFactory$Slf4jLoggerEx
[org.ops4j.pax.url.mvn.internal.AetherBasedResolver] : Resolved (org.apache.karaf:apache-karaf-minimal:zip:4.2.5) as /home/sb/.m2/repository/org/apache/karaf/apache-karaf-minimal/4.2.5/apache-karaf-minimal-4.2.5.zip
[org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer] : Found 0 options when requesting OverrideJUnitBundlesOption.class
[shaded.org.apache.http.impl.conn.PoolingHttpClientConnectionManager] : Connection manager is shutting down Ignored FQCN: shaded.org.apache.commons.logging.impl.SLF4JLocationAwareLog
[shaded.org.apache.http.impl.conn.PoolingHttpClientConnectionManager] : Connection manager shut down Ignored FQCN: shaded.org.apache.commons.logging.impl.SLF4JLocationAwareLog
[org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer] : Test Container started in 2 millis
[org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer] : Wait for test container to finish its initialization [ RelativeTimeout value = 720000 ]
[org.ops4j.pax.exam.rbc.client.RemoteBundleContextClient] : Waiting for remote bundle context.. on 21000 name: 274d833b-3fe3-4120-846b-e093d33a7543 timout: [ RelativeTimeout value = 720000 ]
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.NullPointerException
at org.eclipse.osgi.storage.FrameworkExtensionInstaller.addExtensionContent0(FrameworkExtensionInstaller.java:99)
at org.eclipse.osgi.storage.FrameworkExtensionInstaller.addExtensionContent(FrameworkExtensionInstaller.java:79)
at org.eclipse.osgi.storage.Storage.installExtensions(Storage.java:194)
at org.eclipse.osgi.storage.Storage.createStorage(Storage.java:92)
at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(EquinoxContainer.java:66)
at org.eclipse.osgi.launch.Equinox.<init>(Equinox.java:31)
at org.eclipse.osgi.launch.EquinoxFactory.newFramework(EquinoxFactory.java:24)
at org.apache.karaf.main.Main.launch(Main.java:256)
... 5 more
[org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer] : Shutting down the test container (Pax Runner)
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 720.63 s <<< FAILURE! - in no.priv.bang.authservice.tests.AuthserviceIntegrationTest
[ERROR] no.priv.bang.authservice.tests.AuthserviceIntegrationTest Time elapsed: 720.629 s <<< ERROR!
java.lang.RuntimeException: Cannot get the remote bundle context
Caused by: java.rmi.NotBoundException: 274d833b-3fe3-4120-846b-e093d33a7543

[ERROR] no.priv.bang.authservice.tests.AuthserviceIntegrationTest Time elapsed: 720.63 s <<< ERROR!
java.lang.RuntimeException: Container never came up
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:272)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:236)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)

[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] AuthserviceIntegrationTest.no.priv.bang.authservice.tests.AuthserviceIntegrationTest » Runtime
[ERROR] JUnit4Provider.invoke:159->executeTestSet:236->executeWithRerun:272->execute:365 » Runtime
[INFO]
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0

Freeman Fang

unread,
Jun 1, 2019, 6:41:39 PM6/1/19
to op...@googlegroups.com
Hi,

You need to add some VMOption by yourself, something like

new VMOption("--add-reads=java.xml=java.logging"),
                new VMOption("--add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
                new VMOption("--patch-module"),
                new VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-"
                    + System.getProperty("karaf.version") + ".jar"),
                new VMOption("--patch-module"), new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-"
                    + System.getProperty("karaf.version") + ".jar"),
                new VMOption("--add-opens"),
                new VMOption("java.base/java.security=ALL-UNNAMED"),
                new VMOption("--add-opens"),
                new VMOption("java.base/java.net=ALL-UNNAMED"),
                new VMOption("--add-opens"),
                new VMOption("java.base/java.lang=ALL-UNNAMED"),
                new VMOption("--add-opens"),
                new VMOption("java.base/java.util=ALL-UNNAMED"),
                new VMOption("--add-opens"),
                new VMOption("java.naming/javax.naming.spi=ALL-UNNAMED"),
                new VMOption("--add-opens"),
                new VMOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"),
                new VMOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"),
                new VMOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"),
                new VMOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"),
                new VMOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"),
                new VMOption("-classpath"),
                new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*”)

You can take a look at [1] to get more details about how we do it in Karaf.

-------------
Freeman(Yue) Fang

Red Hat, Inc. 





--
--
------------------
OPS4J - http://www.ops4j.org - op...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/86woi5jaa9.fsf%40dod.no.
For more options, visit https://groups.google.com/d/optout.

Steinar Bang

unread,
Jun 2, 2019, 2:32:40 AM6/2/19
to op...@googlegroups.com
(hm... my mind crosswired and wrote the wrong subject, but it looks like
the meaning got though anyway... subject corrected)

>>>>> Freeman Fang <freeman.fang-Re5J...@public.gmane.org>:

> You need to add some VMOption by yourself, something like
[snip!]
> You can take a look at [1] to get more details about how we do it in Karaf.

> [1]https://github.com/apache/karaf/blob/master/itests/common/src/main/java/org/apache/karaf/itests/KarafTestSupport.java

I'll give it a look and report back how it worked out. Thanks!

(the pax exam tests were the last thing keeping me on openjdk-11,
everything else seems to be working, up to and including running my
applications in karaf. Debian has dropped openjdk-8 from their current
testing, meaning it will be gone from the next stable, and this
energized me into finally making the transition to "new-style Java")

Steinar Bang

unread,
Jun 2, 2019, 4:50:17 AM6/2/19
to op...@googlegroups.com
>>>>> Steinar Bang <sb-1rLz...@public.gmane.org>:
>>>>> Freeman Fang <freeman.fang-Re5JQEeQqe8Avxti...@public.gmane.org>:

>> You need to add some VMOption by yourself, something like
> [snip!]
>> You can take a look at [1] to get more details about how we do it in Karaf.

>> [1]https://github.com/apache/karaf/blob/master/itests/common/src/main/java/org/apache/karaf/itests/KarafTestSupport.java

> I'll give it a look and report back how it worked out. Thanks!

I've added the VMOptions to the startup but I still get the same stack
trace, ie. a NullPointerException thrown from here:
public class FrameworkExtensionInstaller {
...
void addExtensionContent0(Collection<ModuleRevision> revisions, Module systemModule) throws BundleException {
if (CL == null || ADD_FWK_URL_METHOD == null) {
// use the first revision as the blame
ModuleRevision revision = revisions.isEmpty() ? null : revisions.iterator().next();
==> throw new BundleException("Cannot support framework extension bundles without a public addURL(URL) method on the framework class loader: " + revision.getBundle()); //$NON-NLS-1$
}

The exception happens in the throw, and the only thing I can see causing
the NPE, is that revisions isn't empty, but contains at least one null
element.

The stack trace, is:
[shaded.org.apache.http.impl.conn.PoolingHttpClientConnectionManager] : Connection manager shut down Ignored FQCN: shaded.org.apache.commons.logging.impl.SLF4JLocationAwareLog
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.NullPointerException
at org.eclipse.osgi.storage.FrameworkExtensionInstaller.addExtensionContent0(FrameworkExtensionInstaller.java:99)
at org.eclipse.osgi.storage.FrameworkExtensionInstaller.addExtensionContent(FrameworkExtensionInstaller.java:79)
at org.eclipse.osgi.storage.Storage.installExtensions(Storage.java:194)
at org.eclipse.osgi.storage.Storage.createStorage(Storage.java:92)
at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(EquinoxContainer.java:66)
at org.eclipse.osgi.launch.Equinox.<init>(Equinox.java:31)
at org.eclipse.osgi.launch.EquinoxFactory.newFramework(EquinoxFactory.java:24)
at org.apache.karaf.main.Main.launch(Main.java:256)
... 5 more


My current options setup code looks like this (and I've debugged and
verified that I'm adding the vmoptions when running under openjdk-11):

@Configuration
public Option[] config() {
final String jmxPort = freePortAsString();
final String httpPort = freePortAsString();
final String httpsPort = freePortAsString();
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 authserviceFeatureRepo = maven().groupId("no.priv.bang.authservice").artifactId("authservice").version("LATEST").type("xml").classifier("features");
Option[] commonOptions = options(
karafDistributionConfiguration().frameworkUrl(karafUrl).unpackDirectory(new File("target/exam")).useDeployFolder(false).runEmbedded(true),
configureConsole().ignoreLocalConsole().ignoreRemoteShell(),
systemTimeout(720000),
keepRuntimeFolder(),
logLevel(LogLevel.DEBUG),
editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiRegistryPort", RMI_REG_PORT),
editConfigurationFilePut("etc/org.apache.karaf.management.cfg", "rmiServerPort", RMI_SERVER_PORT),
editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", httpPort),
editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port.secure", httpsPort),
replaceConfigurationFile("etc/org.ops4j.pax.logging.cfg", getConfigFile("/etc/org.ops4j.pax.logging.cfg")),
systemProperty("org.ops4j.pax.logging.DefaultSer‌​viceLog.level").value("DEBUG"),
vmOptions("-Dtest-jmx-port=" + jmxPort),
junitBundles(),
features(paxJdbcRepo),
features(authserviceFeatureRepo, "user-admin-with-derby"));
if (JavaVersionUtil.getMajorVersion() < 9) {
return commonOptions;
}

Option[] java11VmOptions = createJava11VmOptions();
return combine(commonOptions, java11VmOptions);
}

private Option[] createJava11VmOptions() {
return options(
vmOption("--add-reads=java.xml=java.logging"),
vmOption("--add-exports=java.base/org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
vmOption("--patch-module"), vmOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-" + System.getProperty("karaf.version") + ".jar"),
vmOption("--patch-module"), vmOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml" + System.getProperty("karaf.version") + ".jar"),
vmOption("--add-opens"), vmOption("java.base/java.security=ALL-UNNAMED"),
vmOption("--add-opens"), vmOption("java.base/java.net=ALL-UNNAMED"),
vmOption("--add-opens"), vmOption("java.base/java.lang=ALL-UNNAMED"),
vmOption("--add-opens"), vmOption("java.base/java.util=ALL-UNNAMED"),
vmOption("--add-opens"), vmOption("java.naming/javax.naming.spi=ALL-UNNAMED"),
vmOption("--add-opens"), vmOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"),
vmOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"),
vmOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"),
vmOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"),
vmOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"),
vmOption("-classpath"), vmOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*"));
}

Steinar Bang

unread,
Jun 2, 2019, 11:07:38 AM6/2/19
to op...@googlegroups.com
>>>>> Steinar Bang <sb-1rLz...@public.gmane.org>:

> I've added the VMOptions to the startup but I still get the same stack
> trace, ie. a NullPointerException thrown from here:
> public class FrameworkExtensionInstaller {
> ...
> void addExtensionContent0(Collection<ModuleRevision> revisions, Module systemModule) throws BundleException {
> if (CL == null || ADD_FWK_URL_METHOD == null) {
> // use the first revision as the blame
> ModuleRevision revision = revisions.isEmpty() ? null : revisions.iterator().next();
> ==> throw new BundleException("Cannot support framework extension bundles without a public addURL(URL) method on the framework class loader: " + revision.getBundle()); //$NON-NLS-1$
> }

> The exception happens in the throw, and the only thing I can see causing
> the NPE, is that revisions isn't empty, but contains at least one null
> element.

Er no... the collection revision is empty so revision becomes null and
fails in revision.getBundle() in the throw.

I made the following JIRA for the problem:
https://ops4j1.jira.com/browse/PAXEXAM-927

Steinar Bang

unread,
Jun 2, 2019, 12:10:42 PM6/2/19
to op...@googlegroups.com
>>>>> Steinar Bang <sb-1rLz...@public.gmane.org>:

>>>>> Steinar Bang <sb-1rLz5CwDoL8-XMD...@public.gmane.org>:
>> I've added the VMOptions to the startup but I still get the same stack
>> trace, ie. a NullPointerException thrown from here:
>> public class FrameworkExtensionInstaller {
>> ...
>> void addExtensionContent0(Collection<ModuleRevision> revisions, Module systemModule) throws BundleException {
>> if (CL == null || ADD_FWK_URL_METHOD == null) {
>> // use the first revision as the blame
>> ModuleRevision revision = revisions.isEmpty() ? null : revisions.iterator().next();
>> ==> throw new BundleException("Cannot support framework extension bundles without a public addURL(URL) method on the framework class loader: " + revision.getBundle()); //$NON-NLS-1$
>> }

>> The exception happens in the throw, and the only thing I can see causing
>> the NPE, is that revisions isn't empty, but contains at least one null
>> element.

> Er no... the collection revision is empty so revision becomes null and
> fails in revision.getBundle() in the throw.

And the reason it tries to throw an exception tin the first place, is
that ADD_FWK_URL_METHOD is because the "addUrl" method is missing from
the URL class.

Steinar Bang

unread,
Jun 2, 2019, 12:59:45 PM6/2/19
to op...@googlegroups.com
>>>>> Steinar Bang <sb-1rLz...@public.gmane.org>:

> And the reason it tries to throw an exception tin the first place, is
> that ADD_FWK_URL_METHOD is because the "addUrl" method is missing from
> the URL class.

From the google searches I've made addUrl() hasn't appeared on the list
of removed stuff in java >= 9.

Steinar Bang

unread,
Jun 2, 2019, 1:04:03 PM6/2/19
to op...@googlegroups.com
And it looks like there was no URL.addUrl() method in the URL class of
java-8:
https://docs.oracle.com/javase/8/docs/api/java/net/URL.html

Steinar Bang

unread,
Jun 6, 2019, 4:35:24 PM6/6/19
to op...@googlegroups.com
>>>>> Steinar Bang <sb-1rLz...@public.gmane.org>:

>>>>> Steinar Bang <sb-1rLz5CwDoL8-XMD...@public.gmane.org>:
>>> And the reason it tries to throw an exception tin the first place, is
>>> that ADD_FWK_URL_METHOD is because the "addUrl" method is missing from
>>> the URL class.

>> From the google searches I've made addUrl() hasn't appeared on the list
>> of removed stuff in java >= 9.

> And it looks like there was no URL.addUrl() method in the URL class of
> java-8:
> https://docs.oracle.com/javase/8/docs/api/java/net/URL.html

Not sure if this is a karaf bug or a pax exam bug, but it is a bug when
running under java 11.

The method the code setting up ADD_FWK_URL_METHOD is looking for, isn't
a method on URL.

The code looks for, and doesn't find, the method
sun.misc.Launcher.AppClassLoader#addUrl(java.net.URL)

So I googled for AppClassLoader and java 11 and found this:
https://blog.codefx.org/java/java-11-migration-guide/#symptoms-2

With Java-11 AppClassLoader no longer is a URLClassLoader, and therefore
(presumably) no longer has an addUrl() method and that's why the pax
exam boot of OSGi fails.

Freeman Fang

unread,
Jun 6, 2019, 5:22:57 PM6/6/19
to op...@googlegroups.com
Hi Steinar,

Good catch, and this is a known issue in 

And this issue has already been fixed.

To run your test with JDK11+eclipse, I think you should use

<dependency>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>org.eclipse.osgi</artifactId>
                <version>3.13.0.v20180226-1711</version>
            </dependency>
Which contains the fix.

-------------
Freeman(Yue) Fang

Red Hat, Inc. 





--
--
------------------
OPS4J - http://www.ops4j.org - op...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/86pnnqh2pj.fsf%40dod.no.

Steinar Bang

unread,
Jun 7, 2019, 4:17:46 PM6/7/19
to op...@googlegroups.com
>>>>> Freeman Fang <freeman.fang-Re5J...@public.gmane.org>:

> Hi Steinar,
> Good catch, and this is a known issue in
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=515286 <https://bugs.eclipse.org/bugs/show_bug.cgi?id=515286>

> And this issue has already been fixed.

Thanks for the info! Good to hear! :-)

> To run your test with JDK11+eclipse, I think you should use

> <dependency>
> <groupId>org.eclipse.tycho</groupId>
> <artifactId>org.eclipse.osgi</artifactId>
> <version>3.13.0.v20180226-1711</version>
> </dependency>
> Which contains the fix.

No luck, unfortunately.

I get a different stack trace, but it still fails:

[org.ops4j.pax.exam.rbc.client.RemoteBundleContextClient] : Waiting for remote bundle context.. on 21000 name: 8b9e87d5-afb6-440e-8231-83de5e653557 timout: [ RelativeTimeout value = 720000 ]
Jun 07, 2019 10:15:23 PM org.apache.karaf.main.Main launch
INFO: Installing and starting initial bundles
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:3078)
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 to FrameworkClassLoader - Maybe not an URLClassLoader?
at org.apache.felix.framework.ExtensionManager.addExtensionBundle(ExtensionManager.java:453)
at org.apache.felix.framework.Felix.installBundle(Felix.java:3044)
... 8 more

Freeman Fang

unread,
Jun 7, 2019, 4:27:47 PM6/7/19
to op...@googlegroups.com
Hi,

If you can send a reproducer project which I can build and run to reproduce this problem, I will take a close look.

Cheers

-------------
Freeman(Yue) Fang

Red Hat, Inc. 





--
--
------------------
OPS4J - http://www.ops4j.org - op...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/86imthgnfa.fsf%40dod.no.

Steinar Bang

unread,
Jun 7, 2019, 5:19:24 PM6/7/19
to op...@googlegroups.com
>>>>> Freeman Fang <freeman.fang-Re5J...@public.gmane.org>:

> Hi,
> If you can send a reproducer project which I can build and run to reproduce this problem, I will take a close look.

git clone https://github.com/steinarb/authservice.git
cd authservice
git checkout work/use-java-11
mvn clean install

If your Java is java-11, then the maven build will fail in the
authservice.tests project, that contains the pax exam test.

Thanks!

Steinar Bang

unread,
Jun 8, 2019, 2:51:05 AM6/8/19
to op...@googlegroups.com
>> Hi,
>> If you can send a reproducer project which I can build and run to reproduce this problem, I will take a close look.

> git clone https://github.com/steinarb/authservice.git
> cd authservice
> git checkout work/use-java-11
> mvn clean install

> If your Java is java-11, then the maven build will fail in the
> authservice.tests project, that contains the pax exam test.

Side note: I did not intentionally use the eclipse OSGi framework for
the pax exam test.

I pulled in the pax-exam-container-karaf which does not pull in an OSGi
framework, and then needed to make a reference to the pax jdbc karaf
feature, which *does* have a (unintentional?) maven transitive
dependency to the eclipse OSGi framework, and then things started
working, and I didn't investigate anymore.

Steinar Bang

unread,
Jun 8, 2019, 3:01:01 AM6/8/19
to op...@googlegroups.com
>>>>> Steinar Bang <sb-1rLz...@public.gmane.org>:

> Side note: I did not intentionally use the eclipse OSGi framework for
> the pax exam test.

> I pulled in the pax-exam-container-karaf which does not pull in an OSGi
> framework, and then needed to make a reference to the pax jdbc karaf
> feature, which *does* have a (unintentional?) maven transitive
> dependency to the eclipse OSGi framework, and then things started
> working, and I didn't investigate anymore.

So I tried using the same osgi framework I'm using for regular karaf
usage
<dependency>
<groupId>org.ops4j.pax.jdbc</groupId>
<artifactId>pax-jdbc-features</artifactId>
<version>${pax.jdbc.version}</version>
<type>xml</type>
<classifier>features</classifier>
<exclusions>
<exclusion>
<groupId>org.apache.karaf</groupId>
<artifactId>org.apache.karaf.client</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.tycho</groupId>
<artifactId>org.eclipse.osgi</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
</dependency>


But I just got a similar stack trace, but with "felix" instead of "eclipse" in the package names:

Jun 08, 2019 8:57:10 AM org.apache.karaf.main.Main launch

Steinar Bang

unread,
Jun 8, 2019, 3:26:09 AM6/8/19
to op...@googlegroups.com
>>>>> Steinar Bang <sb-1rLz...@public.gmane.org>:

>>>>> Steinar Bang <sb-1rLz5CwDoL8-XMD...@public.gmane.org>:
>> Side note: I did not intentionally use the eclipse OSGi framework for
>> the pax exam test.

>> I pulled in the pax-exam-container-karaf which does not pull in an OSGi
>> framework, and then needed to make a reference to the pax jdbc karaf
>> feature, which *does* have a (unintentional?) maven transitive
>> dependency to the eclipse OSGi framework, and then things started
>> working, and I didn't investigate anymore.

> So I tried using the same osgi framework I'm using for regular karaf
> usage
[snip!]
> But I just got a similar stack trace, but with "felix" instead of "eclipse" in the package names:

I noticed that the osgi.core version 6.0.0 artifact I have been using, was pretty old (July 2014):
https://mvnrepository.com/artifact/org.osgi/org.osgi.core

So I looked for OSGi 7 and found this:
https://mvnrepository.com/artifact/org.osgi/osgi.core

The version 6.0.0 osgi.core artifact is from January 2015.
The version 7.0.0 osgi.core artifact is from April 2018.

I've tried with both of them, but got the same stack trace (or very
similar stack trace) as the org.osgi.core 6.0.0 framework (the one below
is from osgi.core 7.0.0):
Jun 08, 2019 9:17:26 AM org.apache.karaf.main.Main launch
INFO: Installing and starting initial bundles
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:3078)
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 to FrameworkClassLoader - Maybe not an URLClassLoader?
at org.apache.felix.framework.ExtensionManager.addExtensionBundle(ExtensionManager.java:453)
at org.apache.felix.framework.Felix.installBundle(Felix.java:3044)
... 8 more

So this Java-11 change is possibly something that affects all OSGi frameworks...?

Steinar Bang

unread,
Jun 8, 2019, 3:46:15 AM6/8/19
to op...@googlegroups.com
>>>>> Steinar Bang <sb-1rLz...@public.gmane.org>:

> I noticed that the osgi.core version 6.0.0 artifact I have been using, was pretty old (July 2014):
> https://mvnrepository.com/artifact/org.osgi/org.osgi.core

> So I looked for OSGi 7 and found this:
> https://mvnrepository.com/artifact/org.osgi/osgi.core

> The version 6.0.0 osgi.core artifact is from January 2015.
> The version 7.0.0 osgi.core artifact is from April 2018.

> I've tried with both of them, but got the same stack trace (or very
> similar stack trace) as the org.osgi.core 6.0.0 framework (the one below
> is from osgi.core 7.0.0):
[snip!]
> So this Java-11 change is possibly something that affects all OSGi frameworks...?

I've googled a bit more and found this in the release notes of the
recently (May 2019) released felix framework 6.0.3:
* [FELIX-5720] - Use PlatformClassLoader as boot classloader on java9

https://svn.apache.org/repos/asf/felix/releases/org.apache.felix.framework-6.0.3/doc/changelog.txt
https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.framework/6.0.3

The Pax Exam test still failed, but the stack trace is different (no
mention of the URLClassLoader):
Jun 08, 2019 9:37:07 AM org.apache.karaf.main.Main launch
INFO: Installing and starting initial bundles
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:3312)
at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:147)
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:430)
at org.apache.felix.framework.Felix.installBundle(Felix.java:3279)
... 8 more

Freeman Fang

unread,
Jun 10, 2019, 5:16:43 PM6/10/19
to op...@googlegroups.com
Hi,

Please see the attached patch file, with it, that test can pass with jdk11.

Cheers
jdk11.patch

Steinar Bang

unread,
Jun 14, 2019, 3:15:47 PM6/14/19
to op...@googlegroups.com
>>>>> Freeman Fang <freeman.fang-Re5J...@public.gmane.org>:

> Hi,
> Please see the attached patch file, with it, that test can pass with jdk11.

Thanks! No luck on my side, unfortunately...:-(

It still fails with the error messages below (However, I had to apply
everything except the top pom manually, and I may have done something
wrong...?
https://github.com/steinarb/scratch/commit/0e3f91871eadff73414879a165e3675a43143088)

I tried bumping felix framework to 6.0.3 but I still got the error
below.

...
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ authservice.tests ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running no.priv.bang.authservice.tests.AuthserviceIntegrationTest
[org.ops4j.pax.exam.spi.DefaultExamSystem] : Pax Exam System (Version: 4.13.1) created.
[org.ops4j.store.intern.TemporaryStore] : Storage Area is /tmp/1560536800700-0
[org.ops4j.pax.exam.junit.impl.ProbeRunner] : creating PaxExam runner for class no.priv.bang.authservice.tests.AuthserviceIntegrationTest
[org.ops4j.pax.exam.spi.PaxExamRuntime] : Found TestContainerFactory: org.ops4j.pax.exam.karaf.container.internal.KarafTestContainerFactory
[org.ops4j.pax.exam.spi.DefaultExamSystem] : creating default probe
[org.ops4j.pax.exam.spi.reactors.ReactorManager] : No User defined probe hook found
[org.ops4j.pax.exam.spi.intern.DefaultTestAddress] : NEW ADDRESS= PaxExam-2efc4605-9051-47a5-bc0e-3c5676cb3145 parent=null root=[TestAddress:PaxExam-2efc4605-9051-47a5-bc0e-3c5676cb3145 root:PaxExam-2efc4605-9051-47a5-bc0e-3c5676cb3145] args=[Ljava.lang.Object;@71a794e5
[org.ops4j.pax.exam.spi.DefaultExamReactor] : Staging reactor with probes: 1 using strategy: org.ops4j.pax.exam.spi.reactors.PerClass@b59d31
[org.ops4j.store.intern.TemporaryStore] : Storage Area is /tmp/1560536800700-0
[org.ops4j.pax.exam.spi.intern.DefaultTestAddress] : NEW ADDRESS= PaxExam-dd25136e-4bdb-497a-ae3c-52e91e1c33e8 parent=[TestAddress:PaxExam-2efc4605-9051-47a5-bc0e-3c5676cb3145 root:PaxExam-2efc4605-9051-47a5-bc0e-3c5676cb3145] root=[TestAddress:PaxExam-2efc4605-9051-47a5-bc0e-3c5676cb3145 root:PaxExam-2efc4605-9051-47a5-bc0e-3c5676cb3145] args=[Ljava.lang.Object;@12405818
[org.ops4j.pax.exam.junit.impl.ProbeRunner] : running test class no.priv.bang.authservice.tests.AuthserviceIntegrationTest
[org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer] : Creating RMI registry server on 127.0.0.1:21000
[org.ops4j.store.intern.TemporaryStore] : Storage Area is /tmp/1560536800700-0
[org.ops4j.pax.url.mvn.internal.Connection] : Resolving [mvn:org.apache.karaf/apache-karaf/4.2.5/zip]
[shaded.org.eclipse.aether.internal.impl.DefaultLocalRepositoryProvider] : Using manager SimpleLocalRepositoryManager with priority 0.0 for /home/sb/.m2/repository Ignored FQCN: shaded.org.eclipse.aether.internal.impl.slf4j.Slf4jLoggerFactory$Slf4jLoggerEx
[org.ops4j.pax.url.mvn.internal.AetherBasedResolver] : Resolved (org.apache.karaf:apache-karaf:zip:4.2.5) as /home/sb/.m2/repository/org/apache/karaf/apache-karaf/4.2.5/apache-karaf-4.2.5.zip
[shaded.org.apache.http.impl.conn.PoolingHttpClientConnectionManager] : Connection manager is shutting down Ignored FQCN: shaded.org.apache.commons.logging.impl.SLF4JLocationAwareLog
[shaded.org.apache.http.impl.conn.PoolingHttpClientConnectionManager] : Connection manager shut down Ignored FQCN: shaded.org.apache.commons.logging.impl.SLF4JLocationAwareLog
[org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer] : Found 0 options when requesting OverrideJUnitBundlesOption.class
[org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer] : Test Container started in 1 millis
[org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer] : Wait for test container to finish its initialization [ RelativeTimeout value = 120000 ]
[org.ops4j.pax.exam.rbc.client.RemoteBundleContextClient] : Waiting for remote bundle context.. on 21000 name: 77cb317d-cfc4-4e90-ba44-40c39fc860e7 timout: [ RelativeTimeout value = 120000 ]
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.felix.framework.ext.ClassPathExtenderFactory$DefaultClassLoaderExtender (file:/home/sb/workspaces/ws03/authservice/authservice.tests/target/exam/8330247c-009b-4577-98a0-e1d506c2cc2b/system/org/apache/felix/org.apache.felix.framework/5.6.12/org.apache.felix.framework-5.6.12.jar) to method java.net.URLClassLoader.addURL(java.net.URL)
WARNING: Please consider reporting this to the maintainers of org.apache.felix.framework.ext.ClassPathExtenderFactory$DefaultClassLoaderExtender
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer] : Shutting down the test container (Pax Runner)
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 120.762 s <<< FAILURE! - in no.priv.bang.authservice.tests.AuthserviceIntegrationTest
[ERROR] no.priv.bang.authservice.tests.AuthserviceIntegrationTest Time elapsed: 120.755 s <<< ERROR!
java.lang.RuntimeException: Cannot get the remote bundle context
Caused by: java.rmi.NotBoundException: 77cb317d-cfc4-4e90-ba44-40c39fc860e7

[ERROR] no.priv.bang.authservice.tests.AuthserviceIntegrationTest Time elapsed: 120.761 s <<< ERROR!
java.lang.RuntimeException: Container never came up
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)

[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] AuthserviceIntegrationTest.no.priv.bang.authservice.tests.AuthserviceIntegrationTest » Runtime
[ERROR] JUnit4Provider.invoke:159->executeTestSet:238->executeWithRerun:273->execute:365 » Runtime
[INFO]
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:33 min
[INFO] Finished at: 2019-06-14T20:29:11+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.0:test (default-test) on project authservice.tests: There are test failures.
[ERROR]

Steinar Bang

unread,
Jun 15, 2019, 7:52:02 AM6/15/19
to op...@googlegroups.com
I've pushed my current jdk11/pax exam experiments to this branch
https://github.com/steinarb/scratch/tree/authservice/use-java-11

Freeman Fang's changes are in
https://github.com/steinarb/scratch/tree/authservice/fix-jdk-11-pax-exam

One thing I noticed with "mvn dependency:tree" was that the JDBC pax
karaf feature org.ops4j.pax.jdbc:pax-jdbc-features:xml:features:1.3.1
pulled in both eclipse equinox and the felix OSGi framework:
[INFO] +- org.ops4j.pax.jdbc:pax-jdbc-features:xml:features:1.3.1:compile
[INFO] | +- org.apache.karaf.features:framework:kar:4.1.1:compile
[INFO] | | +- org.apache.karaf.features:base:jar:4.1.1:runtime
[INFO] | | +- org.apache.karaf:org.apache.karaf.main:jar:4.1.1:runtime
[INFO] | | | +- org.apache.karaf:org.apache.karaf.util:jar:4.1.1:runtime
[INFO] | | | | \- org.apache.felix:org.apache.felix.utils:jar:1.9.0:runtime
[INFO] | | | +- net.java.dev.jna:jna:jar:4.3.0:runtime
[INFO] | | | \- net.java.dev.jna:jna-platform:jar:4.3.0:runtime
[INFO] | | +- org.apache.karaf:org.apache.karaf.exception:jar:4.1.1:runtime
[INFO] | | +- org.apache.karaf.jaas:org.apache.karaf.jaas.boot:jar:4.1.1:runtime
[INFO] | | +- org.apache.karaf.diagnostic:org.apache.karaf.diagnostic.boot:jar:4.1.1:runtime
[INFO] | | +- org.eclipse.tycho:org.eclipse.osgi:jar:3.11.2.v20161107-1947:runtime <-- eclipse OSGi
[INFO] | | +- org.apache.felix:org.apache.felix.framework:jar:5.6.2:runtime <-- felix framework 5.6.2
[INFO] | | +- org.jline:jline:jar:3.2.0:compile
[INFO] | | +- org.ops4j.pax.logging:pax-logging-api:jar:1.9.1:compile
[INFO] | | +- org.ops4j.pax.logging:pax-logging-log4j2:jar:1.9.1:compile
[INFO] | | +- org.apache.felix:org.apache.felix.fileinstall:jar:3.5.8:compile
[INFO] | | +- org.apache.karaf.features:org.apache.karaf.features.extension:jar:4.1.1:compile
[INFO] | | \- org.apache.karaf.features:org.apache.karaf.features.core:jar:4.1.1:compile


So I suppressed both OSGi frameworks from the pax-jdbc-features
dependency and tried first a new eclipse equinox version and then felix
framework 6.0.3.

Both gave me errors on framework initialization but the errors were
different.

When using eclipse equinox 3.13.0.v20180226-1711 I got the following
stack trace (looks like it's getting the OSGi type definitions from a
different bundle...?):
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.SecurityException: class "org.osgi.service.log.LogLevel"'s signer information does not match signer information of other classes in the same package
at java.base/java.lang.ClassLoader.checkCerts(ClassLoader.java:1150)
at java.base/java.lang.ClassLoader.preDefineClass(ClassLoader.java:905)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1014)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at org.eclipse.osgi.internal.log.EquinoxLogServices.<init>(EquinoxLogServices.java:87)
at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(EquinoxContainer.java:65)
at org.eclipse.osgi.launch.Equinox.<init>(Equinox.java:31)
at org.eclipse.osgi.launch.EquinoxFactory.newFramework(EquinoxFactory.java:24)
at org.apache.karaf.main.Main.launch(Main.java:256)
... 5 more

When using felix framework 6.0.3, I got the following stack trace:

Jean-Baptiste Onofré

unread,
Jun 15, 2019, 5:08:39 PM6/15/19
to OPS4J
You can't use Felix framework 6 as it's OSGi R7.

I will take a look on your branch. I can confirm that karaf itests, including pax jdbc work in itest.

Regards
JB

--
--
------------------
OPS4J - http://www.ops4j.org - op...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/86pnnfoylc.fsf%40dod.no.

Steinar Bang

unread,
Jun 16, 2019, 2:14:22 AM6/16/19
to op...@googlegroups.com
>>>>> Jean-Baptiste Onofré <jeanbaptiste.onofre-R...@public.gmane.org>:

> You can't use Felix framework 6 as it's OSGi R7.

I switched to 5.6.12 which is the one that karaf master currently uses,
but got the same failure as with 6.0.3 ("Error installing bundle listed
in startup.properties...").

Stack trace included below.

> I will take a look on your branch. I can confirm that karaf itests,
> including pax jdbc work in itest.

Thanks!

I've tried building karaf (both the master branch and the jdk12 branch)
on my development system, and I get test errors, so it could be
something with my setup...?

My setup:
debian 9.9 "stretch" (ie. current stable), amd64
openjdk-11:amd64 11.0.3+1-1~bpo9+2 (installed with apt-get)
maven 3.6.0 (installed from tar-ball)

Stack trace from pax exam startup failure:
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

Jean-Baptiste Onofré

unread,
Jun 16, 2019, 6:47:48 AM6/16/19
to OPS4J
Did you try with a clean maven repo ?

It's certainly an environment issue as both Jenkins at Apache and my machine are ok.

By the way, both machines use jdk 11.0.3 (Oracle).

Regards
JB

--
--
------------------
OPS4J - http://www.ops4j.org - op...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/86d0jeoy9g.fsf%40dod.no.

Steinar Bang

unread,
Jun 16, 2019, 2:48:30 PM6/16/19
to op...@googlegroups.com
>>>>> Jean-Baptiste Onofré <jeanbaptiste.onofre-R...@public.gmane.org>:

> Did you try with a clean maven repo ?

Yes.
rm -rf ~/.m2/repository
cd ~/workspaces/karaf/karaf
git checkout master
mvn clean install

Fails in this integration test:
...
[INFO] Running org.apache.karaf.itests.EquinoxTest
2019-06-16 19:20:40,563 | INFO | j.pax.exam.spi.DefaultExamSystem 127 | Pax Exam System (Version: 4.13.1) created.
2019-06-16 19:20:40,596 | INFO | .pax.exam.junit.impl.ProbeRunner 74 | creating PaxExam runner for class org.apache.karaf.itests.EquinoxTest
Port 1099 not available, trying next one
Port 44444 not available, trying next one
Port 8101 not available, trying next one
2019-06-16 19:20:40,625 | INFO | .pax.exam.junit.impl.ProbeRunner 94 | running test class org.apache.karaf.itests.EquinoxTest
2019-06-16 19:20:40,626 | INFO | iner.internal.KarafTestContainer 142 | Creating RMI registry server on 127.0.0.1:21000
2019-06-16 19:20:41,124 | INFO | iner.internal.KarafTestContainer 205 | Found 0 options when requesting OverrideJUnitBundlesOption.class
2019-06-16 19:20:41,147 | INFO | iner.internal.KarafTestContainer 258 | Wait for test container to finish its initialization [ RelativeTimeout value = 180000 ]
2019-06-16 19:20:41,148 | INFO | rn.RemoteBundleContextClientImpl 240 | Waiting for remote bundle context.. on 21000 name: dcc2fec6-4390-42c0-8255-7f7d24469da8 timout: [ RelativeTimeout value = 180000 ]
WARNING: package org.apache.karaf.specs.locator not in java.base
Error starting karaf activator org.apache.karaf.specs.activator.Activator: org/apache/karaf/specs/locator/OsgiLocator

EquinoxTest: simpleTest
info
2019-06-16 19:21:16,853 | INFO | exam.spi.reactors.ReactorManager 444 | suite finished
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 36.407 s - in org.apache.karaf.itests.EquinoxTest
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] RestExampleTest.testWithCxfClient » WrappedTestContainer [org.apache.karaf.ite...
[INFO]
[ERROR] Tests run: 284, Failures: 0, Errors: 1, Skipped: 5

> It's certainly an environment issue as both Jenkins at Apache and my
> machine are ok.

Could you share some details about your build environments? OS? maven
version? Java version?

> By the way, both machines use jdk 11.0.3 (Oracle).

Hm... that could be the difference.

But I would still like to get things working with openjdk.

Freeman Fang

unread,
Jun 16, 2019, 4:48:47 PM6/16/19
to op...@googlegroups.com
FYI, I’m using OpenJDK11, Karaf tests work for me with OpenJDK11

Btw, my env is

Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T14:41:47-04:00)
Maven home: /Users/ffang/kit/apache-maven-3.6.0
Java version: 11, vendor: Oracle Corporation, runtime: /Users/ffang/kit/jdk-11.jdk/Contents/Home
Default locale: en_CA, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.5", arch: "x86_64", family: "mac"
-------------
Freeman(Yue) Fang

Red Hat, Inc. 





--
--
------------------
OPS4J - http://www.ops4j.org - op...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/86sgs9nz7t.fsf%40dod.no.

Freeman Fang

unread,
Jun 16, 2019, 5:07:03 PM6/16/19
to op...@googlegroups.com
More details for java version

java -version
openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)

Steinar Bang

unread,
Jun 17, 2019, 4:21:29 PM6/17/19
to op...@googlegroups.com
>>>>> Freeman Fang <freeman.fang-Re5J...@public.gmane.org>:

> FYI, I’m using OpenJDK11, Karaf tests work for me with OpenJDK11
> Btw, my env is

> Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T14:41:47-04:00)
> Maven home: /Users/ffang/kit/apache-maven-3.6.0
> Java version: 11, vendor: Oracle Corporation, runtime: /Users/ffang/kit/jdk-11.jdk/Contents/Home
> Default locale: en_CA, platform encoding: UTF-8
> OS name: "mac os x", version: "10.10.5", arch: "x86_64", family: "mac"
> More details for java version

> java -version
> openjdk version "11" 2018-09-25
> OpenJDK Runtime Environment 18.9 (build 11+28)
> OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)

That's very similar to my setup:
1. same maven version (3.6.0)
2. slightly older (I think) openjdk-11 than what I have:
sb@lorenzo:~$ java -version
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)
3. same processor architecture
4. different os, but both are unix'is systems, and file and socket
operations and semantics should be similare, virtual management
semantics should be similar, so I doubt that make any difference

Hm... I basically have no idea what's missing in my setup...:-)

Steinar Bang

unread,
Jun 17, 2019, 4:39:55 PM6/17/19
to op...@googlegroups.com
>>>>> Steinar Bang <sb-1rLz...@public.gmane.org>:
This is the stack trace from the karaf.log of the pax exam karaf/itest/
on my machine:
019-06-16T19:17:26,700 | ERROR | features-3-thread-1 | Felix | - - | Bundle org.apache.felix.framework [0] EventDispatcher: Error during dispatch. (java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator)
java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator
at org.apache.karaf.specs.activator.Activator.register(Activator.java:125) ~[?:?]
at org.apache.karaf.specs.activator.Activator.bundleChanged(Activator.java:97) ~[?:?]
at org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915) ~[?:?]
at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834) ~[?:?]
at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516) ~[?:?]
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) ~[?:?]
at org.apache.felix.framework.StatefulResolver.fireResolvedEvents(StatefulResolver.java:1289) ~[?:?]
at org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:512) ~[?:?]
at org.apache.felix.framework.Felix.resolveBundles(Felix.java:4108) ~[?:?]
at org.apache.felix.framework.FrameworkWiringImpl.resolveBundles(FrameworkWiringImpl.java:133) ~[?:?]
at org.apache.karaf.features.internal.service.BundleInstallSupportImpl.resolveBundles(BundleInstallSupportImpl.java:244) ~[?:?]
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.resolveBundles(FeaturesServiceImpl.java:1168) ~[?:?]
at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:1021) ~[?:?]
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1062) ~[?:?]
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:998) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
2019-06-16T19:17:26,704 | ERROR | FelixDispatchQueue | framework | 0 - org.apache.felix.framework - 5.6.12 | FrameworkEvent ERROR - org.apache.felix.framework

Freeman Fang

unread,
Jun 17, 2019, 4:47:41 PM6/17/19
to op...@googlegroups.com
You run into this error when building latest karaf master branch with JDK11?

-------------
Freeman(Yue) Fang

Red Hat, Inc. 





--
--
------------------
OPS4J - http://www.ops4j.org - op...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ops4j+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/86blywndyi.fsf%40dod.no.

Steinar Bang

unread,
Jun 18, 2019, 11:34:58 AM6/18/19
to op...@googlegroups.com
>>>>> Freeman Fang <freeman.fang-Re5J...@public.gmane.org>:

> You run into this error when building latest karaf master branch with JDK11?

Yes.
Reply all
Reply to author
Forward
0 new messages