Repository navigation
Conversation
The code, ehcache.xml and Spring config all use Ehcache 2.x (net.sf.ehcache). In 2020 the build dependency was switched to org.ehcache:ehcache (3.x) without migrating the code, so 2.x kept arriving transitively via hibernate-ehcache and the 3.x jar shipped unused. Renovate has since bumped it to 3.12.0, which is compiled for Java 17. Declare net.sf.ehcache:ehcache directly at 2.10.5, the version resolved today, and drop the 3.x dependency. Remove the ehcache-core exclusion on hibernate-ehcache, which matched nothing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The build declares Ehcache 3 (
org.ehcache:ehcache), but the portlet uses Ehcache 2.x (net.sf.ehcache) everywhere:CacheConfigurationuses Spring'sEhCacheManagerFactoryBean/EhCacheCacheManager, which are 2.x-only.CacheNotificationService,ClassLoaderResourceNotificationService,PortletEventNotificationServiceandAbstractJdbcNotificationServiceimportnet.sf.ehcache.Cache/Element.ehcache.xmlis in the 2.x format (bare<ehcache>root,<cache name=...>).src/referencesorg.ehcache,javax.cacheor JCache.How it got this way
net.sf.ehcache:ehcache:2.10.6.3bdf7bb(June 2020, "chore: upgrade ehcache to new package and version 3.8.1") changed only the coordinates:net.sf.ehcache:ehcache→org.ehcache:ehcache:3.8.1. Ehcache 3 is not a package rename, though. It's a different API and XML schema, and the code, config and Spring wiring were never migrated.hibernate-ehcache5.6.15 depends onnet.sf.ehcache:ehcacheat compile scope. So the 2.x classes kept arriving transitively, and the Spring Boot 1.x dependency-management BOM resolved them to 2.10.5.exclude group: 'net.sf.ehcache', module: 'ehcache-core'onhibernate-ehcachematches nothing. Hibernate 5.6 depends onehcache, not the oldehcache-coreartifact name.Change
net.sf.ehcache:ehcachedirectly at 2.10.5, the version resolved today. The code imports it, so it shouldn't rely on a transitive path through Hibernate.org.ehcache:ehcache(3.12.0).ehcache-coreexclusion.ehcacheVersionexplaining that it's 2.x on purpose.No runtime version change: the Ehcache 2 jar in the WAR is 2.10.5 before and after.
Verification
Built from current
master(before) and this branch (after) on Java 11 with the Gradle wrapper (6.9.4):./gradlew check -S --no-daemon --no-parallel(same as CI) → BUILD SUCCESSFUL. All 4 tests pass.dependencyInsight --dependency ehcacheonruntimeClasspath:net.sf.ehcache:ehcache:2.10.5before and after.org.ehcache:ehcacheis gone.WEB-INF/libdiff, before → after: onlyehcache-3.12.0.jarandcache-api-1.0.0.jar(the JSR-107 API, pulled only by Ehcache 3) are removed. Nothing else changes.Follow-ups (not in this PR)
resource-server-utils1.5.3 bringsnet.sf.ehcache:ehcache-core:2.6.11(viaehcache-web2.0.4), so the WAR has bothehcache-2.10.5.jarandehcache-core-2.6.11.jar, with overlappingnet.sf.ehcache.*classes. Which copy Tomcat loads isn't guaranteed. That was probably what the no-op exclusion originally meant to prevent. Excludingehcache-corefromresource-server-utilsis the likely fix, but it can change which classes load, so it should be tested on a running portal rather than folded in here.org.ehcache:ehcache < 3.12.0) targets the artifact this PR removes. It can be closed or retargeted once this merges.ehcache.xmland switching Spring to JCache (JSR-107), since Spring 4.3 has no native Ehcache 3 support. That's a migration, not a cleanup.