Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails on JDK 16 due to caffeine version #1824

Closed
agavrilov76 opened this issue Apr 2, 2021 · 3 comments · Fixed by #1825
Closed

Fails on JDK 16 due to caffeine version #1824

agavrilov76 opened this issue Apr 2, 2021 · 3 comments · Fixed by #1825

Comments

@agavrilov76
Copy link

agavrilov76 commented Apr 2, 2021

I got the following exception when I tried to run a sample modular program with JDK 16:

Exception in thread "main" java.lang.NoClassDefFoundError: sun/misc/Unsafe
	at com.github.benmanes.caffeine@2.8.0/com.github.benmanes.caffeine.base.UnsafeAccess.load(UnsafeAccess.java:68)
	at com.github.benmanes.caffeine@2.8.0/com.github.benmanes.caffeine.base.UnsafeAccess.<clinit>(UnsafeAccess.java:42)
	at com.github.benmanes.caffeine@2.8.0/com.github.benmanes.caffeine.cache.BLCHeader$DrainStatusRef.<clinit>(BoundedLocalCache.java:3912)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
	at com.github.benmanes.caffeine@2.8.0/com.github.benmanes.caffeine.cache.LocalCacheFactory.newBoundedLocalCache(LocalCacheFactory.java:98)
	at com.github.benmanes.caffeine@2.8.0/com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalManualCache.<init>(BoundedLocalCache.java:3392)
	at com.github.benmanes.caffeine@2.8.0/com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalLoadingCache.<init>(BoundedLocalCache.java:3716)
	at com.github.benmanes.caffeine@2.8.0/com.github.benmanes.caffeine.cache.Caffeine.build(Caffeine.java:1014)
	at org.jdbi.v3.core@3.18.1/org.jdbi.v3.core.statement.CachingSqlParser.<init>(CachingSqlParser.java:30)
	at org.jdbi.v3.core@3.18.1/org.jdbi.v3.core.statement.CachingSqlParser.<init>(CachingSqlParser.java:25)
	at org.jdbi.v3.core@3.18.1/org.jdbi.v3.core.statement.ColonPrefixSqlParser.<init>(ColonPrefixSqlParser.java:41)
	at org.jdbi.v3.core@3.18.1/org.jdbi.v3.core.statement.SqlStatements.<init>(SqlStatements.java:53)
	at org.jdbi.v3.core@3.18.1/org.jdbi.v3.core.config.ConfigRegistry.lambda$null$3(ConfigRegistry.java:100)
	at org.jdbi.v3.core@3.18.1/org.jdbi.v3.core.internal.exceptions.Unchecked.lambda$function$4(Unchecked.java:76)
	at org.jdbi.v3.core@3.18.1/org.jdbi.v3.core.config.ConfigRegistry.get(ConfigRegistry.java:78)
	at org.jdbi.v3.core@3.18.1/org.jdbi.v3.core.config.ConfigRegistry.<init>(ConfigRegistry.java:47)
	at org.jdbi.v3.core@3.18.1/org.jdbi.v3.core.Jdbi.<init>(Jdbi.java:58)
	at org.jdbi.v3.core@3.18.1/org.jdbi.v3.core.Jdbi.create(Jdbi.java:104)
	at org.jdbi.v3.core@3.18.1/org.jdbi.v3.core.Jdbi.create(Jdbi.java:88)
	at td.nextgen/td.Main.main(Main.java:55)
Caused by: java.lang.ClassNotFoundException: sun.misc.Unsafe
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
	... 24 more

Bumping the caffeine cache library version to 3.0.1 solves the problem. Reference: ben-manes/caffeine#273

@stevenschlansker
Copy link
Member

Thank you for reporting this!

@ben-manes
Copy link

Released 3.0.2 with removal of sun.misc.Unsafe.

@stevenschlansker
Copy link
Member

Thanks for the heads up: #1868

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants