java.lang.NoSuchMethodError: net.sf.ehcache.distribution.EventMessage.<init>(ILjava/io/Serializable;Lnet/sf/ehcache/Element;)V

Terracotta Project Issue Tracker | Ilya Kikoin | 2 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    These are the relevant parts of my ehcache.xml: <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory" properties="channel=ehcache^connect=UDP(mcast_addr=231.12.21.132;mcast_port=45566;ip_ttl=32; mcast_send_buf_size=150000;mcast_recv_buf_size=80000): PING(timeout=2000;num_initial_members=6): MERGE2(min_interval=5000;max_interval=10000): FD_SOCK:VERIFY_SUSPECT(timeout=1500): pbcast.NAKACK(gc_lag=10;retransmit_timeout=3000): UNICAST(timeout=5000): pbcast.STABLE(desired_avg_gossip=20000): FRAG: pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;shun=false;print_local_addr=false)" propertySeparator="^" /> <cache name="sampleRepicatedCache2" maxEntriesLocalHeap="10" eternal="false" timeToIdleSeconds="100" timeToLiveSeconds="100"> <cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory" properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true, replicateUpdatesViaCopy=false, replicateRemovals=true,asynchronousReplicationIntervalMillis=1000"/> </cache> The synchronization crashes with this: Exception in thread "main" java.lang.NoSuchMethodError: net.sf.ehcache.distribution.EventMessage.<init>(ILjava/io/Serializable;Lnet/sf/ehcache/Element;)V at net.sf.ehcache.distribution.jgroups.JGroupEventMessage.<init>(JGroupEventMessage.java:86) at net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicator.replicatePutNotification(JGroupsCacheReplicator.java:203) at net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicator.notifyElementPut(JGroupsCacheReplicator.java:144) at net.sf.ehcache.event.RegisteredEventListeners.internalNotifyElementPut(RegisteredEventListeners.java:192) at net.sf.ehcache.event.RegisteredEventListeners.notifyElementPut(RegisteredEventListeners.java:170) at net.sf.ehcache.Cache.notifyPutInternalListeners(Cache.java:1631) at net.sf.ehcache.Cache.putInternal(Cache.java:1601) at net.sf.ehcache.Cache.put(Cache.java:1526) at net.sf.ehcache.Cache.put(Cache.java:1491) I checked the source code of these classes, net.sf.ehcache.distribution.jgroups.JGroupEventMessage constructor calls the net.sf.ehcache.distribution.EventMessage constructor: public JGroupEventMessage(int event, Serializable key, Element element, String cacheName) { super(event, key, element); this.cacheName = cacheName; this.asyncTime = -1; } which is: public EventMessage(Ehcache cache, Serializable key) { this.cache = cache; this.key = key; } apparently, this can't work. Just to be sure, I extracted the class files and decompiled them, and that is the code.

    Terracotta Project Issue Tracker | 2 years ago | Ilya Kikoin
    java.lang.NoSuchMethodError: net.sf.ehcache.distribution.EventMessage.<init>(ILjava/io/Serializable;Lnet/sf/ehcache/Element;)V
  2. 0

    These are the relevant parts of my ehcache.xml: <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory" properties="channel=ehcache^connect=UDP(mcast_addr=231.12.21.132;mcast_port=45566;ip_ttl=32; mcast_send_buf_size=150000;mcast_recv_buf_size=80000): PING(timeout=2000;num_initial_members=6): MERGE2(min_interval=5000;max_interval=10000): FD_SOCK:VERIFY_SUSPECT(timeout=1500): pbcast.NAKACK(gc_lag=10;retransmit_timeout=3000): UNICAST(timeout=5000): pbcast.STABLE(desired_avg_gossip=20000): FRAG: pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;shun=false;print_local_addr=false)" propertySeparator="^" /> <cache name="sampleRepicatedCache2" maxEntriesLocalHeap="10" eternal="false" timeToIdleSeconds="100" timeToLiveSeconds="100"> <cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory" properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true, replicateUpdatesViaCopy=false, replicateRemovals=true,asynchronousReplicationIntervalMillis=1000"/> </cache> The synchronization crashes with this: Exception in thread "main" java.lang.NoSuchMethodError: net.sf.ehcache.distribution.EventMessage.<init>(ILjava/io/Serializable;Lnet/sf/ehcache/Element;)V at net.sf.ehcache.distribution.jgroups.JGroupEventMessage.<init>(JGroupEventMessage.java:86) at net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicator.replicatePutNotification(JGroupsCacheReplicator.java:203) at net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicator.notifyElementPut(JGroupsCacheReplicator.java:144) at net.sf.ehcache.event.RegisteredEventListeners.internalNotifyElementPut(RegisteredEventListeners.java:192) at net.sf.ehcache.event.RegisteredEventListeners.notifyElementPut(RegisteredEventListeners.java:170) at net.sf.ehcache.Cache.notifyPutInternalListeners(Cache.java:1631) at net.sf.ehcache.Cache.putInternal(Cache.java:1601) at net.sf.ehcache.Cache.put(Cache.java:1526) at net.sf.ehcache.Cache.put(Cache.java:1491) I checked the source code of these classes, net.sf.ehcache.distribution.jgroups.JGroupEventMessage constructor calls the net.sf.ehcache.distribution.EventMessage constructor: public JGroupEventMessage(int event, Serializable key, Element element, String cacheName) { super(event, key, element); this.cacheName = cacheName; this.asyncTime = -1; } which is: public EventMessage(Ehcache cache, Serializable key) { this.cache = cache; this.key = key; } apparently, this can't work. Just to be sure, I extracted the class files and decompiled them, and that is the code.

    Terracotta Project Issue Tracker | 2 years ago | Ilya Kikoin
    java.lang.NoSuchMethodError: net.sf.ehcache.distribution.EventMessage.<init>(ILjava/io/Serializable;Lnet/sf/ehcache/Element;)V

    Root Cause Analysis

    1. java.lang.NoSuchMethodError

      net.sf.ehcache.distribution.EventMessage.<init>(ILjava/io/Serializable;Lnet/sf/ehcache/Element;)V

      at net.sf.ehcache.distribution.jgroups.JGroupEventMessage.<init>()
    2. JGroups Replication
      JGroupsCacheReplicator.notifyElementPut
      1. net.sf.ehcache.distribution.jgroups.JGroupEventMessage.<init>(JGroupEventMessage.java:86)
      2. net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicator.replicatePutNotification(JGroupsCacheReplicator.java:203)
      3. net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicator.notifyElementPut(JGroupsCacheReplicator.java:144)
      3 frames
    3. Ehcache
      Cache.put
      1. net.sf.ehcache.event.RegisteredEventListeners.internalNotifyElementPut(RegisteredEventListeners.java:192)
      2. net.sf.ehcache.event.RegisteredEventListeners.notifyElementPut(RegisteredEventListeners.java:170)
      3. net.sf.ehcache.Cache.notifyPutInternalListeners(Cache.java:1631)
      4. net.sf.ehcache.Cache.putInternal(Cache.java:1601)
      5. net.sf.ehcache.Cache.put(Cache.java:1526)
      6. net.sf.ehcache.Cache.put(Cache.java:1491)
      6 frames