[ https://issues.apache.org/jira/browse/SLING-9824?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Munteanu updated SLING-9824: ----------------------------------- Fix Version/s: Starter 12 > sun.misc.Unsafe accessible in Sling Starter 12 > ---------------------------------------------- > > Key: SLING-9824 > URL: https://issues.apache.org/jira/browse/SLING-9824 > Project: Sling > Issue Type: Bug > Components: Starter > Affects Versions: Starter 12 > Environment: Sling-Starter 12-SNAPSHOT (commit addb8f7b) with JDK 11 > and 13 on MacOS, JDK 11 on an x86_64 Linux > Reporter: Hans-Peter Stoerr > Priority: Minor > Fix For: Starter 12 > > > We are having some trouble running our application on [the current Sling > Starter 12 > snapshot|https://github.com/apache/sling-org-apache-sling-starter/tree/addb8f7ba16dfb2ab6cda1a70f98a461a7cacb7a] > 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|https://www.mail-archive.com/users@sling.apache.org/msg05423.html], 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. -- This message was sent by Atlassian Jira (v8.3.4#803005)