>>>>> Steinar Bang <[email protected]>: >>>>> Freeman Fang >>>>> <freeman.fang-re5jqeeqqe8avxtiumwx3w-xmd5yjdbdmrexy1tmh2...@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/*")); } -- -- ------------------ OPS4J - http://www.ops4j.org - [email protected] --- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ops4j/86o93gjrqx.fsf%40dod.no. For more options, visit https://groups.google.com/d/optout.
