Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
Starter 12
-
None
-
Sling-Starter 12-SNAPSHOT (commit addb8f7b) with JDK 11 and 13 on MacOS, JDK 11 on an x86_64 Linux
Description
We are having some trouble running our application on the current Sling Starter 12 snapshot since we are using ehache 3, which uses sun.misc.Unsafe internally. This works with Sling Starter 11, but since Sling Starter changed to the feature launcher, this class seems to have disappeared from the classpath: the class loading of ehcache classes fails with a java.lang.NoClassDefFoundError: sun/misc/Unsafe
I tried to add command line arguments
--add-modules=jdk.unsupported
and
--add-opens=jdk.unsupported/sun.misc=ALL-UNNAMED
to the launcher command line, as I've seen that suggested on the net for similar problems, but it didn't help.
In fact, this doesn't seem to be the problem: even without those flags the jdk.unsupported module does export sun.misc:
module
{ name: jdk.unsupported@11.0.6, [mandated java.base], exports: [com.sun.nio.file, sun.misc, sun.reflect], opens: [sun.misc, sun.reflect] }So it seems the module is loaded, but not used to load the class.
The easiest way to reproduce the problem is to add this to some JSP:
<%
Class clazz = sun.misc.Unsafe.class;
%>
In case that matters: I tried JDK 11 and 13 on MacOS, as well as JDK 11 on an x86_64 Linux.
This works on Sling Starter 11, but not the current 12 snapshot.
The workaround to add
-D org.osgi.framework.system.packages.extra=sun.misc
to the command line, which was thankfully suggested in the mailing list, does work. But I feel it is not a particularily clean solution. It also does something else than what happens on Sling Starter 11 : now the sun.misc package is listed in the exports list of the felix framework bundle
http://localhost:9090/system/console/bundles/0 . Not sure whether this is good or bad.
Attachments
Attachments
Issue Links
- relates to
-
SLING-9624 Get rid of custom "org.osgi.framework.system.packages"
- Closed