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

Corretto 11 compatibility with Caffeine #473

Closed
dearnani opened this issue Nov 12, 2020 · 5 comments
Closed

Corretto 11 compatibility with Caffeine #473

dearnani opened this issue Nov 12, 2020 · 5 comments

Comments

@dearnani
Copy link

We upgraded the version to corretto11 docker image to have the run time environment,

The API is trying to use -- Caffeine.newBuilder().expireAfterWrite method and it is throwing an issuue with below stacktrace, later added module jdk.unsupported given further stack below --

at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:92)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.base/java.lang.Class.getDeclaredFields0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3061)
at java.base/java.lang.Class.getDeclaredField(Class.java:2409)
at com.github.benmanes.caffeine.base.UnsafeAccess.objectFieldOffset(UnsafeAccess.java:57)
at com.github.benmanes.caffeine.cache.SSMS.(Unknown Source)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at com.github.benmanes.caffeine.cache.LocalCacheFactory.newBoundedLocalCache(Unknown Source)
at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalManualCache.(BoundedLocalCache.java:3043)
at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalManualCache.(BoundedLocalCache.java:3039)
at com.github.benmanes.caffeine.cache.Caffeine.build(Caffeine.java:926)

Added modules -- jdk.unsupported for the above, now it has the following exception.

java.lang.IllegalStateException: com.github.benmanes.caffeine.cache.SSMSW : Error Type : SERVER : StackTrace : java.lang.IllegalStateException: com.github.benmanes.caffeine.cache.SSMSW
at com.github.benmanes.caffeine.cache.LocalCacheFactory.newBoundedLocalCache(LocalCacheFactory.java:95)
at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalManualCache.(BoundedLocalCache.java:3356)
at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalManualCache.(BoundedLocalCache.java:3352)
at com.github.benmanes.caffeine.cache.Caffeine.build(Caffeine.java:995)

@ben-manes
Copy link
Owner

jdk.unsupported is a required module, I'm glad you found that. There is some discussion of this in #273 that might offer clues. Maybe you need another flag? That thread also mentions --add-exports java.base/sun.nio.ch=ALL-UNNAMED.

@dearnani
Copy link
Author

dearnani commented Nov 12, 2020

Hi @ben-manes , many thanks for your kind response, tried to pass this as jvm arguement,

The exception remains same,

java.lang.IllegalStateException: com.github.benmanes.caffeine.cache.SSMSW : Error Type : SERVER : StackTrace : java.lang.IllegalStateException: com.github.benmanes.caffeine.cache.SSMSW
at com.github.benmanes.caffeine.cache.LocalCacheFactory.newBoundedLocalCache(LocalCacheFactory.java:95)
at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalManualCache.(BoundedLocalCache.java:3356)
at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalManualCache.(BoundedLocalCache.java:3352)
at com.github.benmanes.caffeine.cache.Caffeine.build(Caffeine.java:995)

ran into the following exception at lower---

Caused by: java.lang.StackOverflowError: null
at java.base/java.lang.String.startsWith(String.java:1470)
at org.springframework.boot.loader.jar.Handler.getFileFromContext(Handler.java:173)
at org.springframework.boot.loader.jar.Handler.parseURL(Handler.java:153)
at java.base/java.net.URL.(URL.java:674)
at java.base/java.net.URL.(URL.java:541)
at java.base/jdk.internal.loader.URLClassPath$Loader.getResource(URLClassPath.java:634)
at java.base/jdk.internal.loader.URLClassPath.getResource(URLClassPath.java:314)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:455)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:92)

@ben-manes
Copy link
Owner

ben-manes commented Nov 12, 2020

Sorry but I can’t help, this is not directly caused by this library.

I’d try on AdoptJdk instead of a customized distribution. If that fails, then ask for help from your local build’s author. That error isn’t normal and from your environment.

@dearnani
Copy link
Author

Sorry but I can’t help, this is not directly caused by this library.

I’d try on AdoptJdk instead of a customized distribution. If that fails, then ask for help from your local build’s author. That error isn’t normal and from your environment.

May I know the recommended spring boot version for Caffeine 2.8.6. I tested with 2.2.2

@ben-manes
Copy link
Owner

Spring uses a BOM for the version that they have verified against. Our latest is backwards compatible with all Spring versions (1.4+) that offer support.

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

No branches or pull requests

2 participants