• Bug
  • Status: Open
  • 2 Major
  • Resolution:
  • ehcache-core,ehcache-terracotta
  • cdennis
  • Reporter: mmoayyed
  • August 06, 2012
  • 1
  • Watchers: 4
  • January 22, 2013

Attachments

Description

I have attached my Spring configuration and EhCache configuration to this issue. It appears that when RMISynchronousCacheReplicator is used, the following exception is received:

2012-08-06 12:56:45,238 ERROR [net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator] - <Exception on flushing of replication queue: null. Continuing...>
java.lang.NullPointerException
        at net.sf.ehcache.distribution.RMISynchronousCacheReplicator.listRemoteCachePeers(RMISynchronousCacheReplicator.java:335)
        at net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator.writeReplicationQueue(RMIAsynchronousCacheReplicator.java:312)
        at net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator.replicationThreadMain(RMIAsynchronousCacheReplicator.java:127)
        at net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator.access$000(RMIAsynchronousCacheReplicator.java:58)
        at net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator$ReplicationThread.run(RMIAsynchronousCacheReplicator.java:389)

If I switch to the RMIAsynchronousCacheReplicator, the issue “seems” to go away. I do still receive the exception, but my app is able to proceed.

What am I doing wrong? Appreciate the assistance.

Comments

Fiona OShea 2012-08-13

Any ideas?

Misagh Moayyed 2012-08-13

Just a little bit more digging on my side:

static List<CachePeer> listRemoteCachePeers(Ehcache cache) {
  CacheManagerPeerProvider provider = cache.getCacheManager().getCacheManagerPeerProvider("RMI");
  return provider.listRemoteCachePeers(cache);
}

It appears that for whatever reason, “provider” turns on to be null at line 335. Cant quite figure out why because my configuration is similar to the samples. I have tried the following environments for the application I use:

  • JDK 6/7
  • Tomcat 6/7

Misagh Moayyed 2012-08-13

I should also clarify that the same exception stack appears on EhCache 2.5.0 and above.

Misagh Moayyed 2012-08-13

More info: noticed that if change to this line, setting the value to false:

<constructor-arg name="replicateRemovals" value="false"/>

I no longer get the error. “true” however produces the same stack.

Misagh Moayyed 2012-08-13

Producing this error as part of a unit test, I have two that attempt to execute delete operations. With replicateRemovals=true, I noticed that if use the following block in my pom, the error would go away for the test:

<build>
  	<plugins>
	  	<plugin>
	        <groupId>org.apache.maven.plugins</groupId>
	        <artifactId>maven-surefire-plugin</artifactId>
	        <configuration>
	        	<forkMode>always</forkMode>
	        </configuration>
	      </plugin>
  	</plugins>
  </build>

Hopefully, this should hint at something.

P.S: other plugin settings are retrieved from the parent pom.

Chris Dennis 2013-01-22

I have a sneaking suspicion considering the kinds of things that “fix” the issue here that this is some kind of race in Spring setting up the Caches/CacheManager. Of course without a reproducible test case this could take a lot of effort to debug.