ehcache / ehcache3

Ehcache 3.x line
http://www.ehcache.org
Apache License 2.0
2k stars 578 forks source link

Dependency issue #3199

Closed fabianfrz closed 9 months ago

fabianfrz commented 11 months ago

Hi I guess I found a bug in ehcache 3.10.

Intellij IDEA hints this:

Required type:
org.terracotta.statistics.OperationStatistic
<PutOutcome>
Provided:
org.ehcache.shadow.org.terracotta.statistics.OperationStatistic
<PutOutcome>
no instance(s) of type variable(s) T exist so that OperationStatistic<T> conforms to OperationStatistic<PutOutcome>

Libraries:


        <dependency>
            <groupId>org.ehcache</groupId>
            <artifactId>ehcache</artifactId>
            <version>3.10.8</version>
            <classifier>jakarta</classifier>
        </dependency>

Management:


        <dependency>
            <groupId>org.ehcache.modules</groupId>
            <artifactId>ehcache-management</artifactId>
            <version>3.10.8</version>
        </dependency>

Exception:

Exception in thread "main" java.lang.NoSuchMethodError: 'org.terracotta.statistics.OperationStatistic org.ehcache.core.internal.statistics.StatsUtils.findOperationStatisticOnChildren(java.lang.Object, java.lang.Class, java.lang.String)'
    at org.ehcache.management.statistics.DefaultCacheStatistics.<init>(DefaultCacheStatistics.java:70)
    at org.ehcache.management.statistics.DefaultExtendedStatisticsService.cacheAdded(DefaultExtendedStatisticsService.java:222)
    at org.ehcache.management.statistics.DefaultExtendedStatisticsService.registerAllCaches(DefaultExtendedStatisticsService.java:215)
    at org.ehcache.management.statistics.DefaultExtendedStatisticsService.stateTransition(DefaultExtendedStatisticsService.java:197)
    at org.ehcache.core.StatusTransitioner.fireTransitionEvent(StatusTransitioner.java:169)
    at org.ehcache.core.StatusTransitioner.access$300(StatusTransitioner.java:33)
    at org.ehcache.core.StatusTransitioner$Transition.succeeded(StatusTransitioner.java:208)
    at org.ehcache.core.EhcacheManager.init(EhcacheManager.java:608)
    at ehcache.EHCMain.setupCacheManager(EHCMain.java:53)
    at ehcache.EHCMain.main(EHCMain.java:24)

So it looks like some kind of a packaging issue. One seems to be relocated, the other not.

chrisdennis commented 11 months ago

You cannot mix packaged Ehcache 3 modules with unpackaged ones. If you want to use the ehcache-management module then you'll need to use the unpackaged core modules with it: ehcache-api, ehcache-core, ehcache-impl; and then depending on your usage you may need: ehcache-107 and ehcache-xml.

fabianfrz commented 11 months ago

Thanks, will try that tomorrow. Maybe it would be a good idea to mention that somewhere in the documentation.

Feel free to close this issue then.