• Bug
  • Status: Resolved
  • 2 Major
  • Resolution: Fixed
  • ehcache-jgroupsreplication
  • rism
  • Reporter: rzanner
  • October 14, 2015
  • 2
  • Watchers: 5
  • February 08, 2016
  • February 08, 2016



I’m trying to use the “file” property of {{net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory}} to be able to re-use the same JGroups configuration for EhCache and my own JGroups channels.

```<?xml version=”1.0” encoding=”UTF-8”?>

Unfortunately this throws a "NoSuchMethodError", because the factory tries to load the given file via \{\{ClassLoaderUtil.getStandardClassLoader()\}\}, which has been removed from EhCache long time ago.

```java.lang.NoSuchMethodError: net.sf.ehcache.util.ClassLoaderUtil.getStandardClassLoader()Ljava/lang/ClassLoader;
	at net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory.createCachePeerProvider(JGroupsCacheManagerPeerProviderFactory.java:61)
	at net.sf.ehcache.config.ConfigurationHelper.createCachePeerProviders(ConfigurationHelper.java:136)
	at net.sf.ehcache.CacheManager.configure(CacheManager.java:795)
	at net.sf.ehcache.CacheManager.doInit(CacheManager.java:471)
	at net.sf.ehcache.CacheManager.init(CacheManager.java:395)
	at net.sf.ehcache.CacheManager.<init>(CacheManager.java:270)
	at net.sf.ehcache.CacheManager.newInstance(CacheManager.java:1116)
	at net.sf.ehcache.CacheManager.newInstance(CacheManager.java:1060)

Similar to the fix done for Hibernate (https://hibernate.atlassian.net/browse/HHH-9497), this method call must be inlined and replaced with a call to {{Thread.currentThread().getContextClassLoader()}}.


Ramses Gomez 2015-10-22

Any update on this? We have the same problem and we had to downgrade ehcache to 2.8.2 to be able to use the jgroups distribution. Thanks

Rene Zanner 2015-11-02

Maybe it helps when you vote for this issue - EhCache with JGroups replication does not seem to have much attention at the moment :-(

Ryan Martin 2016-01-18

We’re having the same problem when trying to upgrade from Ehcache 2.6.10 to 2.10.1. Are there any workarounds?

Rene Zanner 2016-01-18

Two “workarounds” (when you want to call it that way): 1.) Do not use “file”, but only inline configuration. 2.) Write your own “JGroupsCacheManagerPeerProviderFactory” which supports “file” correctly. I did the second…

Ryan Martin 2016-01-18

Rene, based on your suggestion I constructed the attached workaround. It looks like a real patch would need to be generated against net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory. The obsolete call to ClassLoaderUtil.getStandardClassLoader() still exists in the latest release of ehcache-jgroups3replication, which is 1.7.4.

Ryan Martin 2016-01-18

Here’s a patch against your Ehcache SVN trunk/HEAD (r10208).

Rishabh Monga 2016-02-08

fix committed to revision 10245 of trunk

Rishabh Monga 2016-02-08

Fix committed to trunk