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

java.lang.NoClassDefFoundError: com/github/benmanes/caffeine/cache/tracing/Tracer when used in OSGI container #29

Closed
alexander-riss opened this issue Sep 21, 2015 · 9 comments

Comments

@alexander-riss
Copy link

the cache.tracing package is not exported and in this way not visible when creating e.g. a LocalCache:

java.lang.NoClassDefFoundError: com/github/benmanes/caffeine/cache/tracing/Tracer
at com.github.benmanes.caffeine.cache.LocalCache.tracer(LocalCache.java:64)
at com.github.benmanes.caffeine.cache.BoundedLocalCache.(BoundedLocalCache.java:139)
at com.github.benmanes.caffeine.cache.LocalCacheFactory$SS.(LocalCacheFactory.java:12966)
at com.github.benmanes.caffeine.cache.LocalCacheFactory$SSMS.(LocalCacheFactory.java:23034)
at com.github.benmanes.caffeine.cache.LocalCacheFactory$SSMSA.(LocalCacheFactory.java:23079)
at com.github.benmanes.caffeine.cache.LocalCacheFactory.newBoundedLocalCache(LocalCacheFactory.java:795)
at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalManualCache.(BoundedLocalCache.java:1779)
at com.github.benmanes.caffeine.cache.BoundedLocalCache$BoundedLocalManualCache.(BoundedLocalCache.java:1775)
at com.github.benmanes.caffeine.cache.Caffeine.build(Caffeine.java:814)

@alexander-riss alexander-riss changed the title java.lang.NoClassDefFoundError: com/github/benmanes/caffeine/cache/tracing/Tracer when using in OSGI container java.lang.NoClassDefFoundError: com/github/benmanes/caffeine/cache/tracing/Tracer when used in OSGI container Sep 21, 2015
@ben-manes
Copy link
Owner

Sorry that I haven't used OSGi so it's not tested, but I thought the bundle instructions were correct. The tracing jar is built with,

bundle {
  instruction 'Export-Package', 'com.github.benmanes.caffeine.cache.tracing.*'
}

@alexander-riss
Copy link
Author

ah ok i did not realise that there are transitive dependencies - i'll give it a try

@alexander-riss
Copy link
Author

i added the tracing-api bundle but as it seems this does not help much, since the com.github.ben-manes.caffeine is not importing the tracing bundle.

So adding that import would probably fix the issue and document this runtime dependency all at once

@ben-manes
Copy link
Owner

That makes sense that I missed the Import-Package. If there's an easy way to run an OSGi container in a unit test to verify compatibility, I'd appreciate some pointers. The fix should be available in the snapshot repository when the CI passes (~25 minutes) if you'd like to verify.

The tracing package will probably be removed in v2 since we collected enough data to simulate policies and choose an optimal one to replace LRU.

@ben-manes
Copy link
Owner

I probably need an import statement for the guava jar too...

ben-manes added a commit that referenced this issue Sep 21, 2015
Not sure why this fails on travis but runs locally. I'll have to retry
piecemeal...

This reverts commit 98a7282.
ben-manes added a commit that referenced this issue Sep 26, 2015
Not sure why this fails on travis but runs locally. I'll have to retry
piecemeal...

This reverts commit 98a7282.
ben-manes added a commit that referenced this issue Sep 26, 2015
Not sure why this fails on travis but runs locally. I'll have to retry
piecemeal...

This reverts commit 98a7282.
@ben-manes
Copy link
Owner

Release v2.0 which fixes the OSGi manifests. It also removes the tracing packages, which are no longer needed due to choosing a new eviction policy. Sorry this took so long to release.

@gvsharma
Copy link

having this same issue with spring container, any suggestions?

@ben-manes
Copy link
Owner

I guess you're referring to this StackOverflow issue? I think you are supposed to use Spring's CaffeineCacheManager, but I am not very familiar with Spring these days.

@gvsharma
Copy link

gvsharma commented Sep 16, 2019 via email

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

3 participants