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

Fix ClassNotFoundException in Caffeine for native image #263

Merged
merged 1 commit into from
Jan 25, 2023

Conversation

nscuro
Copy link
Member

@nscuro nscuro commented Jan 25, 2023

Something changed after upgrading Quarkus to 2.16.0.Final, causing Caffeine to use a different cache implementation behind the scenes.

ERROR [io.qua.run.Application] (main) Failed to start application (with profile [prod]): java.lang.ClassNotFoundException: com.github.benmanes.caffeine.cache.SSSW
2023-01-25 21:17:26     at java.base@17.0.6/java.lang.Class.forName(DynamicHub.java:1132)
2023-01-25 21:17:26     at java.base@17.0.6/java.lang.Class.forName(DynamicHub.java:1105)
2023-01-25 21:17:26     at com.github.benmanes.caffeine.cache.LocalCacheFactory.loadFactory(LocalCacheFactory.java:84)
2023-01-25 21:17:26     at com.github.benmanes.caffeine.cache.LocalCacheFactory.newBoundedLocalCache(LocalCacheFactory.java:40)
2023-01-25 21:17:26     at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalAsyncCache.<init>(BoundedLocalCache.java:4216)
2023-01-25 21:17:26     at com.github.benmanes.caffeine.cache.Caffeine.buildAsync(Caffeine.java:1096)
2023-01-25 21:17:26     at io.quarkus.cache.runtime.caffeine.CaffeineCacheImpl.<init>(CaffeineCacheImpl.java:71)
2023-01-25 21:17:26     at io.quarkus.cache.runtime.caffeine.CaffeineCacheManagerBuilder$1.get(CaffeineCacheManagerBuilder.java:56)
2023-01-25 21:17:26     at io.quarkus.cache.runtime.caffeine.CaffeineCacheManagerBuilder$1.get(CaffeineCacheManagerBuilder.java:34)
2023-01-25 21:17:26     at io.quarkus.cache.CacheManager_7ace4235729bbc654ace276b403267860dc707de_Synthetic_Bean.createSynthetic(Unknown Source)
2023-01-25 21:17:26     at io.quarkus.cache.CacheManager_7ace4235729bbc654ace276b403267860dc707de_Synthetic_Bean.create(Unknown Source)
2023-01-25 21:17:26     at io.quarkus.cache.CacheManager_7ace4235729bbc654ace276b403267860dc707de_Synthetic_Bean.create(Unknown Source)
2023-01-25 21:17:26     at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:113)
2023-01-25 21:17:26     at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:37)
2023-01-25 21:17:26     at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:34)
2023-01-25 21:17:26     at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)

Signed-off-by: nscuro nscuro@protonmail.com

Something changed after upgrading Quarkus to 2.16.0.Final, causing Caffeine to use a different cache implementation behind the scenes.

```
ERROR [io.qua.run.Application] (main) Failed to start application (with profile [prod]): java.lang.ClassNotFoundException: com.github.benmanes.caffeine.cache.SSSW
2023-01-25 21:17:26     at java.base@17.0.6/java.lang.Class.forName(DynamicHub.java:1132)
2023-01-25 21:17:26     at java.base@17.0.6/java.lang.Class.forName(DynamicHub.java:1105)
2023-01-25 21:17:26     at com.github.benmanes.caffeine.cache.LocalCacheFactory.loadFactory(LocalCacheFactory.java:84)
2023-01-25 21:17:26     at com.github.benmanes.caffeine.cache.LocalCacheFactory.newBoundedLocalCache(LocalCacheFactory.java:40)
2023-01-25 21:17:26     at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalAsyncCache.<init>(BoundedLocalCache.java:4216)
2023-01-25 21:17:26     at com.github.benmanes.caffeine.cache.Caffeine.buildAsync(Caffeine.java:1096)
2023-01-25 21:17:26     at io.quarkus.cache.runtime.caffeine.CaffeineCacheImpl.<init>(CaffeineCacheImpl.java:71)
2023-01-25 21:17:26     at io.quarkus.cache.runtime.caffeine.CaffeineCacheManagerBuilder$1.get(CaffeineCacheManagerBuilder.java:56)
2023-01-25 21:17:26     at io.quarkus.cache.runtime.caffeine.CaffeineCacheManagerBuilder$1.get(CaffeineCacheManagerBuilder.java:34)
2023-01-25 21:17:26     at io.quarkus.cache.CacheManager_7ace4235729bbc654ace276b403267860dc707de_Synthetic_Bean.createSynthetic(Unknown Source)
2023-01-25 21:17:26     at io.quarkus.cache.CacheManager_7ace4235729bbc654ace276b403267860dc707de_Synthetic_Bean.create(Unknown Source)
2023-01-25 21:17:26     at io.quarkus.cache.CacheManager_7ace4235729bbc654ace276b403267860dc707de_Synthetic_Bean.create(Unknown Source)
2023-01-25 21:17:26     at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:113)
2023-01-25 21:17:26     at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:37)
2023-01-25 21:17:26     at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:34)
2023-01-25 21:17:26     at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
```

Signed-off-by: nscuro <nscuro@protonmail.com>
@nscuro nscuro added the defect Something isn't working label Jan 25, 2023
@sonarcloud
Copy link

sonarcloud bot commented Jan 25, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Copy link
Collaborator

@VinodAnandan VinodAnandan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kodiakhq kodiakhq bot merged commit a3a3a8b into main Jan 25, 2023
@kodiakhq kodiakhq bot deleted the fix-cache-for-native branch January 25, 2023 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants