Giter Site home page Giter Site logo

hazelcast-hibernate's Introduction

Hibernate Second Level Cache

GitHub Actions status Maven Central

Hazelcast provides a distributed second-level cache for your Hibernate entities, collections, and queries.

You can use an IMap as distributed storage(HazelcastCacheRegionFactory), or ConcurrentHashMap-based near-cache(HazelcastLocalCacheRegionFactory) with updates synchronized via ITopic.

Supported Versions

  • hazelcast-hibernate53 supports Hibernate 5.3+, and Hazelcast 4+

If you need Hazelcast 3.x support, you can use a 1.3.x version of each hazelcast-hibernate module.

Examples

Documentation

Table of Contents

Configuring Hibernate for Hazelcast

To configure Hibernate for Hazelcast:

  • Add the jar to your classpath (depending on your Hibernate/Hazelcast versions)
  • Enable Second-Level Cache
  • Choose a desired RegionFactory implementation
  • Configure remaining properties by:
    • Adding them to your Hibernate configuration file, e.g., hibernate.cfg.xml
    • Adding them to Spring Boot's application.properties prefixed with spring.jpa.properties, e.g., spring.jpa.properties.hibernate.cache.use_second_level_cache=true

Enabling Second Level Cache

<property name="hibernate.cache.use_second_level_cache">true</property>

Configuring RegionFactory

You can configure Hibernate RegionFactory with HazelcastCacheRegionFactory or HazelcastLocalCacheRegionFactory.

HazelcastCacheRegionFactory

HazelcastCacheRegionFactory uses standard Hazelcast distributed maps to cache the data, so all cache operations go through the wire.

<property name="hibernate.cache.region.factory_class">
   com.hazelcast.hibernate.HazelcastCacheRegionFactory
</property>

All operations like get, put, and remove will be performed on a distributed map. The only downside of using HazelcastCacheRegionFactory may be lower performance compared to HazelcastLocalCacheRegionFactory since operations are handled as distributed calls.


NOTE: If you use HazelcastCacheRegionFactory, you can see your maps on Management Center.


With HazelcastCacheRegionFactory, all below caches are distributed across Hazelcast Cluster:

  • Entity Cache
  • Collection Cache
  • Timestamp Cache

HazelcastLocalCacheRegionFactory

You can use HazelcastLocalCacheRegionFactory, which stores data in a local member and sends invalidation messages when an entry is changed locally.

<property name="hibernate.cache.region.factory_class">
  com.hazelcast.hibernate.HazelcastLocalCacheRegionFactory
</property>

With HazelcastLocalCacheRegionFactory, each cluster member has a local map, and each of them is registered to a Hazelcast Topic (ITopic). Whenever a put or remove operation is performed on a member, hazelcast-hibernate sends an invalidation message to other members, which removes related entries from their local storage.

In the get operations, invalidation messages are not generated, and reads are performed on the local map.

An illustration of the above logic is shown below:

Invalidation with Local Cache Region Factory

If your operations consist mostly of reads, then this option gives better performance.


NOTE: If you use HazelcastLocalCacheRegionFactory, you cannot see your maps on Management Center.


With HazelcastLocalCacheRegionFactory, all of the following caches are not distributed and are kept locally:

  • Entity Cache
  • Collection Cache
  • Timestamp Cache

Entity and Collection caches are invalidated on update. When they are updated on a member, an invalidation message is sent to all other members in order to remove the entity from their local cache.

When needed, each member reads that data from the underlying datasource.

On every Timestamp cache update, hazelcast-hibernate publishes an invalidation message to a topic (see #hazelcastlocalcacheregionfactory for details).

Configuration

Local region cache eviction can be configured using the following parameters:

  • time-to-live - defining the lifespan of cache entries (defaults to 1 hour)
  • size - defining the maximum cache size, meaning depends on the max-size-policy,
  • max-size-policy - defining the max size policy used for eviction. Available values are as follows:
    • PER_NODE - Maximum number of map entries in the local cache. This is the default policy.
    • FREE_HEAP_SIZE - Minimum free heap size in megabytes for the JVM.

Above can be configured in your Hazelcast configuration file:

<map name="your-cache-name">
  <time-to-live-seconds>60</time-to-live-seconds>
  <eviction size="150" max-size-policy="PER_NODE"/>
</map>

Configuring Query Cache and Other Settings

  • To enable use of query cache:

    <property name="hibernate.cache.use_query_cache">true</property>
  • To force minimal puts into query cache:

    <property name="hibernate.cache.use_minimal_puts">true</property>
  • To avoid NullPointerException when you have entities that have composite keys (using @IdClass):

    <property name="hibernate.session_factory_name">yourFactoryName</property>

NOTE: QueryCache is always LOCAL to the member and never distributed across Hazelcast Cluster.


Other Properties

  • cleanup_delay - the duration of physical local cache cleanups
  • cluster_timeout - the number of milliseconds the client should retry to establish a cluster connection
  • initial_backoff - initial backoff value after failed connection attempt in milliseconds
  • backoff_multiplier - a multiplier used to derive a new backoff value if the connection fails after the previous attempt
  • max_backoff - maximum possible backoff value
  • fallback - if Hibernate should fall back onto the original datasource when Hazelcast cluster is not accessible

Asynchronous Reconnect with Fallback

Whenever a connection between a client and a server is lost, the second-level cache is bypassed.

At the same time, the client tries to reconnect asynchronously to a cluster which can be configured using parameters mentioned above.

If you want to switch back to blocking client operations, you can achieve this by setting the fallback configuration property to _false.

Spring Boot Configuration

In order to configure Hibernate using Spring Boot, you can provide all config entries via application.properties file by prefixing them with spring.jpa.properties.

For example:

spring.jpa.properties.hibernate.cache.use_second_level_cache=true
spring.jpa.properties.hibernate.cache.region.factory_class=com.hazelcast.hibernate.HazelcastCacheRegionFactory
spring.jpa.properties.hibernate.cache.hazelcast.use_native_client=true
spring.jpa.properties.hibernate.show_sql=true

Configuring Hazelcast for Hibernate

To configure Hazelcast for Hibernate, put the configuration file named hazelcast.xml into the root of your classpath. If Hazelcast cannot find hazelcast.xml, then it will use the default configuration.

You can define a custom-named Hazelcast configuration XML file with one of these Hibernate configuration properties.

<property name="hibernate.cache.provider_configuration_file_resource_path">
  hazelcast-custom-config.xml
</property>
<property name="hibernate.cache.hazelcast.configuration_file_path">
  hazelcast-custom-config.xml
</property>

If you're using Hazelcast client (hibernate.cache.hazelcast.use_native_client=true), you can specify a custom Hazelcast client configuration file by using the same parameters.

Hazelcast creates a separate distributed map for each Hibernate cache region. You can easily configure these regions via Hazelcast map configuration. You can define backup, eviction, TTL and Near Cache properties.

Using Second-Level Cache in Peer-to-Peer mode

Hibernate Second Level Cache can use Hazelcast in two modes: Peer-to-Peer (P2P) and Client/Server (next section).

When using the Peer-to-Peer mode, each Hibernate deployment launches its Hazelcast instance.

However, there's an option to configure Hibernate to use an existing instance instead of creating a new HazelcastInstance for each SessionFactory.

To achieve this, set the hibernate.cache.hazelcast.instance_name Hibernate property to the HazelcastInstance's name.

For more information, please see Named Instance Scope

Disabling shutdown during SessionFactory.close()

You can disable shutting down HazelcastInstance during SessionFactory.close(). To do this, set the Hibernate property hibernate.cache.hazelcast.shutdown_on_session_factory_close to false. (In this case, you should not set the Hazelcast property hazelcast.shutdownhook.enabled to false.) The default value is true.

Using Second-Level Cache in Client/Server mode

You can set up Hazelcast to connect to the cluster as Native Client.

The native client is not a member; it connects to one of the cluster members and delegates all cluster-wide operations to it.

A client instance started in the Native Client mode uses smart routing: when the related cluster member dies, the client transparently switches to another live member.

All client operations are retry-able, meaning that the client resends the request as many as ten times in case of a failure.

After the 10th retry, it throws an exception. You cannot change the routing mode and retry-able operation configurations of the Native Client instance used by Hibernate 2nd Level Cache.

Please see the Smart Routing section and Retry-able Operation Failure section for more details.

<property name="hibernate.cache.hazelcast.use_native_client">true</property>

To set up Native Client, add the Hazelcast cluster name and cluster member address (you can also set multiple comma-separated addresses) properties. Native Client will connect to the defined member and will get the addresses of all members in the cluster. If the connected member dies or leaves the cluster, the client will automatically switch to another member in the cluster.

<property name="hibernate.cache.hazelcast.native_client_address">10.34.22.15, 10.34.22.16</property>
<property name="hibernate.cache.hazelcast.native_client_cluster_name">dev</property>

You can use an existing client instead of creating a new one by adding the following property.

<property name="hibernate.cache.hazelcast.native_client_instance_name">my-client</property>

NOTE: To configure a Hazelcast Native Client for Hibernate, put the configuration file named hazelcast-client.xml into the root of your classpath.


NOTE: If your persisted classes only contain Java primitive type fields, you do not need to add your classes into your remote cluster's classpath. However, if your classes have non-primitive type fields, you need to add only these fields' classes (not your domain class) to your cluster's classpath.

Configuring Cache Concurrency Strategy

Hazelcast supports three cache concurrency strategies: read-only, read-write, and nonstrict-read-write.

If you are using XML based class configurations, add a cache element into your configuration with the usage attribute set to one of the read-only, read-write, or nonstrict-read-write strategies.

<class name="eg.Immutable" mutable="false">
  <cache usage="read-only"/>
  .... 
</class>

<class name="eg.Cat" .... >
  <cache usage="read-write"/>
  ....
  <set name="kittens" ... >
    <cache usage="read-write"/>
    ....
  </set>
</class>

If you are using Hibernate-Annotations, then you can add a class-cache or collection-cache element into your Hibernate configuration file with the usage attribute set to read only, read/write, or nonstrict read/write.

<class-cache usage="read-only" class="eg.Immutable"/>
<class-cache usage="read-write" class="eg.Cat"/>
<collection-cache collection="eg.Cat.kittens" usage="read-write"/>

Or alternatively, you can use @Cache annotation on your entities and collections.

@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Cat implements Serializable {
  ...
}

Releasing a new version

In order to release a new version you need to run Prepare Release workflow to create a new release tag (e.g. v1.2.3).

After its successful run the tag will be pushed back to the origin repository and will trigger Deploy Release workflow which will build and deploy release artifacts to Maven Central Repository and create a new release on the GitHub

hazelcast-hibernate's People

Contributors

akoledzhikov avatar asimarslan avatar bilalyasar avatar cszmajda avatar danny-hazelcast avatar dependabot-preview[bot] avatar dependabot[bot] avatar devopshazelcast avatar dohertyfjatl avatar donnerbart avatar emrahkocaman avatar emre-aydin avatar enesakar avatar enozcan avatar ezequielb avatar frant-hartm avatar fuadm avatar hasancelik avatar jackpgreen avatar jerrinot avatar jhinch-at-atlassian-com avatar jontejj avatar ldziedziul avatar mdogan avatar noctarius avatar pivovarit avatar pveentjer avatar renovate[bot] avatar serkan-ozal avatar taburet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hazelcast-hibernate's Issues

Hazelcast 3.12 is not compatible with Hibernate 5.2.10.Final

I upgraded my application from hazelcast3.7.4 to 3.12. i am facing exception

`Exception in thread "main" java.lang.ExceptionInInitializerError
at com.hazelcast.hibernate.serialization.Hibernate5CacheEntrySerializerHook.createSerializer(Hibernate5CacheEntrySerializerHook.java:65)
at com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder.registerSerializerHooks(DefaultSerializationServiceBuilder.java:317)
at com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder.build(DefaultSerializationServiceBuilder.java:239)
at com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder.build(DefaultSerializationServiceBuilder.java:55)
at com.hazelcast.instance.DefaultNodeExtension.createSerializationService(DefaultNodeExtension.java:210)
at com.hazelcast.instance.Node.(Node.java:240)
at com.hazelcast.instance.HazelcastInstanceImpl.createNode(HazelcastInstanceImpl.java:161)
at com.hazelcast.instance.HazelcastInstanceImpl.(HazelcastInstanceImpl.java:131)
at com.hazelcast.instance.HazelcastInstanceFactory.constructHazelcastInstance(HazelcastInstanceFactory.java:228)
at com.hazelcast.instance.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:207)
at com.hazelcast.instance.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:157)
at com.hazelcast.core.Hazelcast.newHazelcastInstance(Hazelcast.java:57)
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: org.hibernate.cache.spi.entry.StandardCacheEntryImpl.([Ljava.io.Serializable;, java.lang.String, java.lang.Object)
at com.hazelcast.hibernate.serialization.Hibernate51CacheEntrySerializer.(Hibernate51CacheEntrySerializer.java:48)
... 14 more
Caused by: java.lang.NoSuchMethodException: org.hibernate.cache.spi.entry.StandardCacheEntryImpl.([Ljava.io.Serializable;, java.lang.String, java.lang.Object)
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.getDeclaredConstructor(Class.java:2178)
at com.hazelcast.hibernate.serialization.Hibernate51CacheEntrySerializer.(Hibernate51CacheEntrySerializer.java:45)
... 14 more

I am using `Hibernate 5.2.10.Final.
I saw similar defect #9, but i dont use any hazelcast-hibernate5 dependency in my application

RegionFactory implementations should not take HazelcastInstance parameter

spring-orm's LocalSessionFactoryBean does not have a RegionFactory field before version 4 and Hibernate 5 does not take a RegionFactory instance directly. For these situations, Hibernate creates RegionFactory instances by itself so Hazelcast's RegionFactory implementations discover Hazelcast instances by their name.

We should delete constructors that take HazelcastInstance as a parameter and remove <hz:hibernate-region-factory> element from XSD because it causes confusion when users need to configure the Hazelcast instance that they want to use declaratively.

This should be done as part of a major version release as it breaks backward compatibility.

Fail over from hibernate 2nd level cache

During the POC in hazelcast, I have found hazelcast does not have failure handling capabilities. In our poc we are using entities to be cached and for the same we are using hibernate 2nd level cache with HazelcastCacheRegionFactory in our persistence.xml .

In our evalutation of fail-over when we stopped hazelcast server, Native client disconnected itself and after some retry it's basically shutdown itself. Over here if server comes back after this, application cannot use its cache because client does not re-initalize itself again.

Topic notifications not sent in a few scenarios in hazelcast-hibernate53

There are a couple of scenarios in hazelcast-hibernate53 where the topic notifications are not being sent, whereas they are being sent in previous versions.

As an example, the following code fails to send a topic notification for the deletion:

    @Test
    public void testDeleteOneEntity() {
        DummyEntity entity = new DummyEntity(0L, "dummy:0", 0, new Date());

        Session session = sf.openSession();
        Transaction tx = session.beginTransaction();
        try {
            session.save(entity);
            tx.commit();
        } 
           // .. catch finally
        }

        try {
            session = sf.openSession();
            tx = session.beginTransaction();
            DummyEntity entityToDelete = session.get(DummyEntity.class, entity.getId());
            session.delete(entityToDelete);
            tx.commit();
        } 
           // .. catch finally
        }

        assertEquals(1, instance.getTopic(DummyEntity.class.getName()).getLocalTopicStats().getPublishOperationCount());
    }

ClassCastException: com.hazelcast.instance.HazelcastInstanceProxy cannot be cast to com.hazelcast.client.impl.HazelcastClientInstanceImpl

2018-11-14 13:46:12:212 ERROR [org.springframework.boot.SpringApplication] [main] [] - Application startup failed 
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cacheManager' defined in class path resource [org/springframework/boot/autoconfigure/cache/JCacheCacheConfiguration.class]: Unsatisfied dependency expressed through method 'cacheManager' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jCacheCacheManager' defined in class path resource [org/springframework/boot/autoconfigure/cache/JCacheCacheConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.cache.CacheManager]: Factory method 'jCacheCacheManager' threw exception; nested exception is javax.cache.CacheException: Error opening URI [hazelcast]
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1178) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1072) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:297) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:121) [spring-boot-test-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:189) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:131) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137) [junit-4.12.jar:4.12]
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) [junit-rt.jar:?]
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) [junit-rt.jar:?]
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) [junit-rt.jar:?]
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) [junit-rt.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_162]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_162]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_162]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_162]
	at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:67) [idea_rt.jar:?]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with nam2018-11-14 13:46:12:214 ERROR [org.springframework.test.context.TestContextManager] [main] [] - Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@51bab787] to prepare test instance  
java.lang.IllegalStateException: Failed to load ApplicationContext
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) ~[spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83) ~[spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:189) ~[spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:131) ~[spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) [spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137) [junit-4.12.jar:4.12]
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) [junit-rt.jar:?]
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) [junit-rt.jar:?]
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) [junit-rt.jar:?]
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) [junit-rt.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_162]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_162]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_162]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_162]
	at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:67) [idea_rt.jar:?]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cacheManager' defined in class path resource [org/springframework/boot/autoconfigure/cache/JCacheCacheConfiguration.class]: Unsatisfied dependency expressed through method 'cacheManager' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jCacheCacheManager' defined in class path resource [org/springframework/boot/autoconfigure/cache/JCacheCacheConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.cache.CacheManager]: Factory method 'jCacheCacheManager' threw exception; nested exception is javax.cache.CacheException: Error opening URI [hazelcast]
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1178) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1072) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:297) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) ~[spring-boot-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) ~[spring-boot-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[spring-boot-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:121) ~[spring-boot-test-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) ~[spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) ~[spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	... 29 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jCacheCacheManager' defined in class path resource [org/springframework/boot/autoconfigure/cache/JCacheCacheConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.cache.CacheManager]: Factory method 'jCacheCacheManager' threw exception; nested exception is javax.cache.CacheException: Error opening URI [hazelcast]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1178) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1072) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1136) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1064) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1178) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1072) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:297) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) ~[spring-boot-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) ~[spring-boot-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[spring-boot-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:121) ~[spring-boot-test-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) ~[spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) ~[spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	... 29 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.cache.CacheManager]: Factory method 'jCacheCacheManager' threw exception; nested exception is javax.cache.CacheException: Error opening URI [hazelcast]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1178) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1072) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1136) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1064) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1178) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1072) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:297) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) ~[spring-boot-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) ~[spring-boot-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[spring-boot-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:121) ~[spring-boot-test-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) ~[spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) ~[spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	... 29 more
Caused by: javax.cache.CacheException: Error opening URI [hazelcast]
	at com.hazelcast.cache.impl.AbstractHazelcastCachingProvider.getCacheManager(AbstractHazelcastCachingProvider.java:130) ~[hazelcast-3.10.4.jar:3.10.4]
	at com.hazelcast.cache.HazelcastCachingProvider.getCacheManager(HazelcastCachingProvider.java:149) ~[hazelcast-3.10.4.jar:3.10.4]
	at org.springframework.boot.autoconfigure.cache.JCacheCacheConfiguration.createCacheManager(JCacheCacheConfiguration.java:126) ~[spring-boot-autoconfigure-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.autoconfigure.cache.JCacheCacheConfiguration.jCacheCacheManager(JCacheCacheConfiguration.java:105) ~[spring-boot-autoconfigure-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.autoconfigure.cache.JCacheCacheConfiguration$$EnhancerBySpringCGLIB$$db5e5858.CGLIB$jCacheCacheManager$1(<generated>) ~[spring-boot-autoconfigure-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.autoconfigure.cache.JCacheCacheConfiguration$$EnhancerBySpringCGLIB$$db5e5858$$FastClassBySpringCGLIB$$3f737789.invoke(<generated>) ~[spring-boot-autoconfigure-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.boot.autoconfigure.cache.JCacheCacheConfiguration$$EnhancerBySpringCGLIB$$db5e5858.jCacheCacheManager(<generated>) ~[spring-boot-autoconfigure-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_162]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_162]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_162]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_162]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1178) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1072) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1136) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1064) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1178) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1072) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:297) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) ~[spring-boot-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) ~[spring-boot-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[spring-boot-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:121) ~[spring-boot-test-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) ~[spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) ~[spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	... 29 more
Caused by: java.lang.ClassCastException: com.hazelcast.instance.HazelcastInstanceProxy cannot be cast to com.hazelcast.client.impl.HazelcastClientInstanceImpl
	at com.hazelcast.client.cache.impl.HazelcastClientCacheManager.<init>(HazelcastClientCacheManager.java:66) ~[hazelcast-client-3.10.4.jar:3.10.4]
	at com.hazelcast.client.cache.impl.HazelcastClientCachingProvider.createCacheManager(HazelcastClientCachingProvider.java:59) ~[hazelcast-client-3.10.4.jar:3.10.4]
	at com.hazelcast.client.cache.impl.HazelcastClientCachingProvider.createCacheManager(HazelcastClientCachingProvider.java:41) ~[hazelcast-client-3.10.4.jar:3.10.4]
	at com.hazelcast.cache.impl.AbstractHazelcastCachingProvider.createHazelcastCacheManager(AbstractHazelcastCachingProvider.java:250) ~[hazelcast-3.10.4.jar:3.10.4]
	at com.hazelcast.cache.impl.AbstractHazelcastCachingProvider.getCacheManager(AbstractHazelcastCachingProvider.java:127) ~[hazelcast-3.10.4.jar:3.10.4]
	at com.hazelcast.cache.HazelcastCachingProvider.getCacheManager(HazelcastCachingProvider.java:149) ~[hazelcast-3.10.4.jar:3.10.4]
	at org.springframework.boot.autoconfigure.cache.JCacheCacheConfiguration.createCacheManager(JCacheCacheConfiguration.java:126) ~[spring-boot-autoconfigure-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.autoconfigure.cache.JCacheCacheConfiguration.jCacheCacheManager(JCacheCacheConfiguration.java:105) ~[spring-boot-autoconfigure-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.autoconfigure.cache.JCacheCacheConfiguration$$EnhancerBySpringCGLIB$$db5e5858.CGLIB$jCacheCacheManager$1(<generated>) ~[spring-boot-autoconfigure-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.autoconfigure.cache.JCacheCacheConfiguration$$EnhancerBySpringCGLIB$$db5e5858$$FastClassBySpringCGLIB$$3f737789.invoke(<generated>) ~[spring-boot-autoconfigure-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.boot.autoconfigure.cache.JCacheCacheConfiguration$$EnhancerBySpringCGLIB$$db5e5858.jCacheCacheManager(<generated>) ~[spring-boot-autoconfigure-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_162]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_162]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_162]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_162]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1178) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1072) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1136) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1064) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:467) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1178) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1072) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:297) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) ~[spring-boot-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) ~[spring-boot-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[spring-boot-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:121) ~[spring-boot-test-1.5.16.RELEASE.jar:1.5.16.RELEASE]
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) ~[spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) ~[spring-test-4.3.19.RELEASE.jar:4.3.19.RELEASE]
	... 29 more

Entries evicted too quickly when ttl is greater than zero

I'm experiencing an issue when every 60 seconds cache entries are evicted sooner than they should be according their Time to live.

I think it's because every 60 seconds CleanupService runs cleanup in LocalRegionCache and the following removes elements from cache:

https://github.com/hazelcast/hazelcast-hibernate5/blob/92d13a07aa01a850c4d12b7852958735bbb3d4f9/hazelcast-hibernate5/src/main/java/com/hazelcast/hibernate/local/LocalRegionCache.java#L372-L373

Perhaps there are some problems with timestamp generation?

Failing test case

I am able to reproduce the issue on

  • hazelcast 3.11.1
  • hazelcast-hibernate 1.3.2-SNAPSHOT
  • hibernate 5.3.7.Final

by adding the following test case to com.hazelcast.hibernate.RegionFactoryDefaultSlowTest.java in hazelcast-hibernate53 module:

props.setProperty(Environment.CACHE_REGION_FACTORY, HazelcastLocalCacheRegionFactory.class.getName());
@Test
public void testQueryCacheCleanup() {
  final int defaultCleanupPeriod = 60;
  QueryResultsRegionTemplate regionTemplate = (QueryResultsRegionTemplate) (((SessionFactoryImpl) sf)
      .getCache()).getDefaultQueryResultsCache().getRegion();
  RegionCache cache = ((HazelcastStorageAccessImpl) regionTemplate.getStorageAccess()).getDelegate();

  insertDummyEntities(1);
  executeQuery(sf, 0);

  assertEquals(1, cache.getElementCountInMemory());

  sleep(defaultCleanupPeriod + 1);

  assertEquals(1, cache.getElementCountInMemory());
}

Time to live for query cache needs to be greater than zero in hazelcast-custom.xml:

<!-- Config for query cache -->
<map name="default-query-results-region">
  <time-to-live-seconds>3600</time-to-live-seconds>
  <max-size>50</max-size>
</map>

Provide guidance on map configuration

Currently the readme says:
Hazelcast creates a separate distributed map for each Hibernate cache region. You can easily configure these regions via Hazelcast map configuration. You can define backup, eviction, TTL and Near Cache properties.

Related Discussion:
image

TimestampsRegionCache cache clear throwing an NPE

When calling the clear method an NPE is thrown:

Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.18 sec <<< FAILURE! - in com.hazelcast.hibernate.local.TimestampsRegionCacheTest
clearCache(com.hazelcast.hibernate.local.TimestampsRegionCacheTest)  Time elapsed: 0.026 sec  <<< ERROR!
java.lang.NullPointerException: null
	at com.hazelcast.hibernate.local.TimestampsRegionCache.createMessage(TimestampsRegionCache.java:71)
	at com.hazelcast.hibernate.local.LocalRegionCache.maybeNotifyTopic(LocalRegionCache.java:195)
	at com.hazelcast.hibernate.local.LocalRegionCache.clear(LocalRegionCache.java:278)
	at com.hazelcast.hibernate.local.TimestampsRegionCacheTest.clearCache(TimestampsRegionCacheTest.java:87)

How to check statistics of LocalRegionCache when use HazelcastLocalCacheRegionFactory ?

I can't find any solution about getting statistics of LocalRegionCache.

Is there any solution ?
:)

My hibernate setting
hibernate.cache.region.factory_class: com.hazelcast.hibernate.HazelcastLocalCacheRegionFactory

Maven setting
<hibernate.version>5.3.7.Final</hibernate.version>
<hazelcast.version>3.11.1</hazelcast.version>
<hibernate.hazelcast.53.version>1.3.1</hibernate.hazelcast.53.version>

Test failure: RegionFactoryQueryCacheEvictionSlowTest.testQueryCacheCleanup

One of unit tests fail.

$ mvn clean install
...
Failed tests:
  RegionFactoryQueryCacheEvictionSlowTest.testQueryCacheCleanup:102 Number of evictions expected:<60> but was:<0>

Tests run: 109, Failures: 1, Errors: 0, Skipped: 4

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] hazelcast-hibernate5 1.3.2-SNAPSHOT ................ SUCCESS [  6.336 s]
[INFO] hazelcast-hibernate5 ............................... SUCCESS [05:22 min]
[INFO] hazelcast-hibernate52 .............................. SUCCESS [05:05 min]
[INFO] hazelcast-hibernate53 1.3.2-SNAPSHOT ............... FAILURE [04:56 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15:31 min
[INFO] Finished at: 2019-02-28T16:06:25Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project hazelcast-hibernate53: There are test failures.

Value should implement equals

Hello, I was just testing hazelcast-hibernate3 [3.8] 2nd Level cache and came across a potential issue, which is also present in 3.6 and probably other subsequent versions.

Either the class com.hazelcast.hibernate.serialization.Value should implement hashCode/equals or one should document to avoid OBJECT format for org.hibernate.cache.UpdateTimestampsCache region.

Consider the following flow:

1. Insert Entity A
2. Perform cacheable criteria on A
3. Repeat 2 (N times)

The expected result is one query cache miss at 2 and N cache hits at 3. All is well and good unless one is using com.hazelcast.hibernate.HazelcastCacheRegionFactory (IMap based cache) and OBJECT format is explicit declared in hazelcast-config.xml, e.g.,

<map name="org.hibernate.cache.UpdateTimestampsCache">
  <eviction-policy>LRU</eviction-policy>
  <in-memory-format>OBJECT</in-memory-format>
  <max-size>500</max-size>
  <time-to-live-seconds>0</time-to-live-seconds>
  <max-idle-seconds>0</max-idle-seconds>
  <read-backup-data>false</read-backup-data>
</map>

The problem is that hibernate will do the following:

  • If query cache is enabled, hibernate will call UpdateTimestampsCache::preinvalidate. This method will place the timestamp associated with query regions according to cache config's TTL (or 1h if ttl=0) in the future.
  • After 1 completes, hibernate will call UpdateTimestampsCache::invalidate, which should place the timestamps closer to the System clock. However, the following code branch
if (map.replace(key, previousEntry, newValue)) { 
  return true; //---> EXPECTED in this case!
}

at com.hazelcast.hibernate.distributed.IMapRegionCache::put, which internally uses a ReplaceIfSameOperation, will fail because the operation in turn depends on com.hazelcast.map.impl.record.ObjectRecordFactory, whose implementation relies on Java equals contract:

   @Override
    public boolean isEquals(Object value1, Object value2) {
        Object v1 = value1 instanceof Data ? serializationService.toObject(value1) : value1;
        Object v2 = value2 instanceof Data ? serializationService.toObject(value2) : value2;
        if (v1 == null && v2 == null) {
            return true;
        }
        if (v1 == null) {
            return false;
        }
        if (v2 == null) {
            return false;
        }
        return v1.equals(v2);
    }

Since UpdateTimestampsCache::invalidate fails, timestamps associated with the regions are much farther than they should really be and even if the query results are cached in 2 and successfully loaded in 3, they will be discarded because UpdateTimestampsCache::isUpToDate will always return false (see org.hibernate.cache.StandardQueryCache::get)

Since UpdateTimestampsCache methods are heavily executed when 2nd level Query Cache is enabled and it usually holds very few records (entity names and associations), it's a very good use case for OBJECT in-memory-format (possibly combined with near-cache).

`hazelcast-hibernate52` 1.1 not compatible with Hibernate 5.2.3

Application that uses the following combination of dependencies:

  • org.hibernate:hibernate-core:5.2.3.Final
  • com.hazelcast:hazelcast:3.7.2
  • com.hazelcast:hazelcast-hibernate52:1.1

Fails during startup with the following exception:

Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: org.hibernate.cache.spi.entry.StandardCacheEntryImpl.<init>([Ljava.io.Serializable;, java.lang.String, java.lang.Object)
    at com.hazelcast.hibernate.serialization.Hibernate51CacheEntrySerializer.<clinit>(Hibernate51CacheEntrySerializer.java:50) ~[hazelcast-hibernate52-1.1.jar:1.1]
    ... 93 common frames omitted
Caused by: java.lang.NoSuchMethodException: org.hibernate.cache.spi.entry.StandardCacheEntryImpl.<init>([Ljava.io.Serializable;, java.lang.String, java.lang.Object)
    at java.lang.Class.getConstructor0(Class.java:3082) ~[na:1.8.0_111]
    at java.lang.Class.getDeclaredConstructor(Class.java:2178) ~[na:1.8.0_111]
    at com.hazelcast.hibernate.serialization.Hibernate51CacheEntrySerializer.<clinit>(Hibernate51CacheEntrySerializer.java:47) ~[hazelcast-hibernate52-1.1.jar:1.1]
    ... 93 common frames omitted

I've tracked the cause to this change in Hibernate (see HHH-11097) which makes com.hazelcast:hazelcast-hibernate52:1.1 incompatible with org.hibernate:hibernate-core:5.2.3.Final.

java.lang.StackOverflowError when read from cache

<dependency>
	<groupId>com.hazelcast</groupId>
	<artifactId>hazelcast</artifactId>
	<version>3.9</version>
</dependency>
...
<dependency>
	<groupId>com.hazelcast</groupId>
	<artifactId>hazelcast-hibernate52</artifactId>
	<version>1.2.2</version>
</dependency>
...
<dependency>
	<groupId>org.hibernate</groupId>
	<artifactId>hibernate-core</artifactId>
	<version>5.2.12.Final</version>
</dependency>
	at org.hibernate.engine.internal.CacheHelper.fromSharedCache(CacheHelper.java:32)
	at org.hibernate.event.internal.DefaultLoadEventListener.getFromSharedCache(DefaultLoadEventListener.java:651)
	at org.hibernate.event.internal.DefaultLoadEventListener.loadFromSecondLevelCache(DefaultLoadEventListener.java:595)
	at org.hibernate.event.internal.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:462)
	at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:219)
	at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:278)
	at org.hibernate.event.internal.DefaultLoadEventListener.doOnLoad(DefaultLoadEventListener.java:121)
	at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:89)
	at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1239)
	at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:1122)
	at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:646)
	at org.hibernate.type.ManyToOneType.assemble(ManyToOneType.java:283)
	at org.hibernate.collection.internal.PersistentBag.initializeFromCache(PersistentBag.java:176)
	at org.hibernate.cache.spi.entry.CollectionCacheEntry.assemble(CollectionCacheEntry.java:58)
	at org.hibernate.event.internal.DefaultInitializeCollectionEventListener.initializeCollectionFromCache(DefaultInitializeCollectionEventListener.java:144)
	at org.hibernate.event.internal.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:59)
	at org.hibernate.internal.SessionImpl.initializeCollection(SessionImpl.java:2185)
	at org.hibernate.collection.internal.AbstractPersistentCollection$4.doWork(AbstractPersistentCollection.java:565)
	at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:247)
	at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:561)
	at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:132)
	at org.hibernate.collection.internal.PersistentBag.toString(PersistentBag.java:509)
	at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
	at java.io.ObjectOutputStream.writeObject0(Unknown Source)
	at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
	at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
	at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
	at java.io.ObjectOutputStream.writeObject0(Unknown Source)
	at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)
	at java.io.ObjectOutputStream.writeSerialData(Unknown Source)
	at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
	at java.io.ObjectOutputStream.writeObject0(Unknown Source)
	at java.io.ObjectOutputStream.writeObject(Unknown Source)
	at com.hazelcast.internal.serialization.impl.JavaDefaultSerializers$JavaSerializer.write(JavaDefaultSerializers.java:242)
	at com.hazelcast.internal.serialization.impl.StreamSerializerAdapter.write(StreamSerializerAdapter.java:43)
	at com.hazelcast.internal.serialization.impl.AbstractSerializationService.writeObject(AbstractSerializationService.java:250)
	at com.hazelcast.internal.serialization.impl.ByteArrayObjectDataOutput.writeObject(ByteArrayObjectDataOutput.java:370)
	at com.hazelcast.hibernate.region.CacheKeyImpl.writeData(CacheKeyImpl.java:77)
	at com.hazelcast.internal.serialization.impl.DataSerializableSerializer.write(DataSerializableSerializer.java:201)
	at com.hazelcast.internal.serialization.impl.DataSerializableSerializer.write(DataSerializableSerializer.java:50)
	at com.hazelcast.internal.serialization.impl.StreamSerializerAdapter.write(StreamSerializerAdapter.java:43)
	at com.hazelcast.internal.serialization.impl.AbstractSerializationService.toBytes(AbstractSerializationService.java:152)
	at com.hazelcast.internal.serialization.impl.AbstractSerializationService.toData(AbstractSerializationService.java:122)
	at com.hazelcast.map.impl.proxy.MapProxySupport.toDataWithStrategy(MapProxySupport.java:1153)
	at com.hazelcast.map.impl.proxy.MapProxySupport.getInternal(MapProxySupport.java:330)
	at com.hazelcast.map.impl.proxy.MapProxyImpl.get(MapProxyImpl.java:122)
	at com.hazelcast.hibernate.distributed.IMapRegionCache.get(IMapRegionCache.java:78)
	at com.hazelcast.hibernate.access.AbstractAccessDelegate.get(AbstractAccessDelegate.java:62)
	at com.hazelcast.hibernate.region.EntityRegionAccessStrategyAdapter.get(EntityRegionAccessStrategyAdapter.java:74)
	at org.hibernate.engine.internal.CacheHelper.fromSharedCache(CacheHelper.java:32)
	at org.hibernate.event.internal.DefaultLoadEventListener.getFromSharedCache(DefaultLoadEventListener.java:651)
	at org.hibernate.event.internal.DefaultLoadEventListener.loadFromSecondLevelCache(DefaultLoadEventListener.java:595)
	at org.hibernate.event.internal.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:462)
	at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:219)
	at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:278)
	at org.hibernate.event.internal.DefaultLoadEventListener.doOnLoad(DefaultLoadEventListener.java:121)
	at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:89)
	at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1239)

After hibernate migration 5.1.0.Final -> 5.2.1.Final, query.list() fails with AbstractMethodError

java.lang.AbstractMethodError: com.hazelcast.hibernate.region.EntityRegionAccessStrategyAdapter.putFromLoad(Lorg/hibernate/engine/spi/SharedSessionContractImplementor;Ljava/lang/Object;Ljava/lang/Object;JLjava/lang/Object;Z)Z
    at org.hibernate.engine.internal.TwoPhaseLoad.doInitializeEntity(TwoPhaseLoad.java:205) ~[hibernate-core-5.2.1.Final.jar:5.2.1.Final]
    at org.hibernate.engine.internal.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:125) ~[hibernate-core-5.2.1.Final.jar:5.2.1.Final]
    at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:1140) ~[hibernate-core-5.2.1.Final.jar:5.2.1.Final]
    at org.hibernate.loader.Loader.processResultSet(Loader.java:999) ~[hibernate-core-5.2.1.Final.jar:5.2.1.Final]
    at org.hibernate.loader.Loader.doQuery(Loader.java:937) ~[hibernate-core-5.2.1.Final.jar:5.2.1.Final]
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:343) ~[hibernate-core-5.2.1.Final.jar:5.2.1.Final]
    at org.hibernate.loader.Loader.doList(Loader.java:2609) ~[hibernate-core-5.2.1.Final.jar:5.2.1.Final]
    at org.hibernate.loader.Loader.doList(Loader.java:2592) ~[hibernate-core-5.2.1.Final.jar:5.2.1.Final]
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2424) ~[hibernate-core-5.2.1.Final.jar:5.2.1.Final]
    at org.hibernate.loader.Loader.list(Loader.java:2419) ~[hibernate-core-5.2.1.Final.jar:5.2.1.Final]
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:502) ~[hibernate-core-5.2.1.Final.jar:5.2.1.Final]
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:371) ~[hibernate-core-5.2.1.Final.jar:5.2.1.Final]
    at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216) ~[hibernate-core-5.2.1.Final.jar:5.2.1.Final]
    at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1450) ~[hibernate-core-5.2.1.Final.jar:5.2.1.Final]
    at org.hibernate.query.internal.AbstractProducedQuery.doList(AbstractProducedQuery.java:1402) ~[hibernate-core-5.2.1.Final.jar:5.2.1.Final]
    at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1374) ~[hibernate-core-5.2.1.Final.jar:5.2.1.Final]
    at org.hibernate.query.internal.AbstractProducedQuery.getSingleResult(AbstractProducedQuery.java:1420) ~[hibernate-core-5.2.1.Final.jar:5.2.1.Final]
    at com.querydsl.jpa.impl.AbstractJPAQuery.getSingleResult(AbstractJPAQuery.java:183) ~[querydsl-jpa-4.1.3.jar:?]
    at com.querydsl.jpa.impl.AbstractJPAQuery.fetchOne(AbstractJPAQuery.java:253) ~[querydsl-jpa-4.1.3.jar:?]
    at com.lc.repository.CustomerRepositoryImpl.getValidCustomerByMobile(CustomerRepositoryImpl.java:104) ~[main/:?]
    at com.lc.repository.CustomerRepositoryImpl$$FastClassBySpringCGLIB$$bf9aace2.invoke(<generated>) ~[main/:?]
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at com.lc.aspect.LoggingAspect.logAround(LoggingAspect.java:50) ~[main/:?]
    at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91]
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:629) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:618) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at com.lc.repository.CustomerRepositoryImpl$$EnhancerBySpringCGLIB$$1498ae91.getValidCustomerByMobile(<generated>) ~[main/:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_91]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:503) ~[spring-data-commons-1.12.2.RELEASE.jar:?]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:478) ~[spring-data-commons-1.12.2.RELEASE.jar:?]
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460) ~[spring-data-commons-1.12.2.RELEASE.jar:?]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61) ~[spring-data-commons-1.12.2.RELEASE.jar:?]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) ~[spring-tx-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) ~[spring-tx-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:133) ~[spring-data-jpa-1.10.2.RELEASE.jar:?]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at com.sun.proxy.$Proxy193.getValidCustomerByMobile(Unknown Source) ~[?:?]
    at com.lc.service.CustomerServiceImpl.registerCustomerWithMobile(CustomerServiceImpl.java:138) ~[main/:?]
    at com.lc.service.CustomerServiceImpl$$FastClassBySpringCGLIB$$bbdcb4f4.invoke(<generated>) ~[main/:?]
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at com.lc.aspect.LoggingAspect.logAround(LoggingAspect.java:50) ~[main/:?]
    at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91]
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:629) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:618) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) ~[spring-tx-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at com.lc.service.CustomerServiceImpl$$EnhancerBySpringCGLIB$$5415200e.registerCustomerWithMobile(<generated>) ~[main/:?]
    at com.lc.web.rest.RegistrationResource.initRegistration(RegistrationResource.java:70) ~[main/:?]
    at com.lc.web.rest.RegistrationResource$$FastClassBySpringCGLIB$$ce27985d.invoke(<generated>) ~[main/:?]
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at com.lc.aspect.LoggingAspect.logAround(LoggingAspect.java:50) [main/:?]
    at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91]
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:629) [spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:618) [spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.aspectj.AspectJAfterThrowingAdvice.invoke(AspectJAfterThrowingAdvice.java:62) [spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) [spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:48) [metrics-spring-3.1.3.jar:?]
    at com.ryantenney.metrics.spring.TimedMethodInterceptor.invoke(TimedMethodInterceptor.java:34) [metrics-spring-3.1.3.jar:?]
    at com.ryantenney.metrics.spring.AbstractMetricMethodInterceptor.invoke(AbstractMetricMethodInterceptor.java:59) [metrics-spring-3.1.3.jar:?]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) [spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655) [spring-aop-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at com.lc.web.rest.RegistrationResource$$EnhancerBySpringCGLIB$$193ab293.initRegistration(<generated>) [main/:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_91]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_91]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_91]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91]
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) [spring-web-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) [spring-web-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114) [spring-webmvc-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) [spring-webmvc-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) [spring-webmvc-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) [spring-webmvc-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) [spring-webmvc-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) [spring-webmvc-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) [spring-webmvc-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) [spring-webmvc-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) [spring-webmvc-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.5.3.jar:8.5.3]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at com.codahale.metrics.servlet.AbstractInstrumentedFilter.doFilter(AbstractInstrumentedFilter.java:104) [metrics-servlet-3.1.2.jar:3.1.2]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:105) [spring-boot-actuator-1.4.0.RC1.jar:1.4.0.RC1]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:208) [spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177) [spring-security-web-4.1.0.RELEASE.jar:4.1.0.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) [spring-web-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) [spring-web-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) [spring-web-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.1.RELEASE.jar:4.3.1.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:522) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1110) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:785) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1425) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_91]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_91]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.3.jar:8.5.3]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_91]

Environment:
hibernate: 5.2.1.Final
hazelcast: 3.7-EA
hazelcast-hibernate5: 1.0

Threads stuck in TIMED_WAITING for a pending invocation that seems to be lost

Hi,

I have a simple webapp where a handful of Hibernate entities are cached in Hazelcast configured as a L2 cache for Hibernate. Under moderate concurrent load and several days of usage, I can occasionally observe it going unresponsive with the below technical details:

Hazelcast version: 3.9.1
Hibernate version: 4.3.7
hazelcast-hibernate4: 3.8
single node app, no cluster is formed

On my entities I have nonstrict read-write caching enabled. The thread dump I am seeing looks like this:

mq-message-processing-thread-2: in Object.wait() [0x00002b89807cb000]
java.lang.Thread.state: TIMED_WAITING (on object monitor)

at com.hazelcast.spi.impl.operationservice.impl.InvocationFuture.pollResponse(InvocationFuture.java:299)
..
at com.hazelcast.spi.impl.operationservice.impl.InvocationFuture.waitForResponse(InvocationFuture.java:247)
at com.hazelcast.map.impl.MapProxyImpl.set(171)
at com.hazelcast.map.impl.MapProxyImpl.set(161)
at com.hazelcast.hibernate.distributed.IMapRegionCache.update(IMapRegionCache.java:89)
at com.hazelcast.hibernate.distributed.IMapRegionCache.put(IMapRegionCache.java:76)
at com.hazelcast.hibernate.access.AbstractAccessDelegate.put (62)
at com.hazelcast.hibernate.access.ReadWriteAccessDelegate.putFromLoad(58)
at com.hazelcast.hibernate.region.CollectionRegionAccessStrategyAdapter.putFromLoad(69)
at org.hibernate.engine.loading.internal.CollectionLoadContext.addCollectionToCache(369)
t org.hibernate.engine.loading.internal.CollectionLoadContext.endLoadingCollection(278)
..
com.mycompany.entities.PersistentXY.getFirstZ()
...

This thread owns a DB level lock at this point, and prevents other threads from running other SQL queries and the application gets stuck completely.

I cannot see anything suspicious in the logs, the above shortened stacktrace suggests to me that after having initialized something from the database, it is attempted to be written back into the cache, but for some unrevealed reason the operation never finishes and unfortunately there is no timeout taking place ever. (Is that something we could fix in the module..?)

From my previous lessons on Hazelcast, I more or less imagine that these operations should be sitting in a queue and when the threads that are associated with a specific partition in the cache region get free, should pick up the work and do it.

In my thread dump all the hazelcast threads are sitting idle. The generic operation threads, partition operation threads are all in WAITING, on the LinkedBlockingQueue.take()

In the logs, I can see Hazelcast reporting "operations.pending.invocations.count=1, operations.pending.invocations.percentage=0.00%, operations.running.size=0", this is I guess the invocation that my poor thread is waiting for.

I am not quite sure what to debug here, I am not familiar with hazelcast code to know where could I look for the pending invocation that is not being picked up, but I suspect this is a bug. Previously, on version 3.5.1 very similar conditions were easy to reproduce and because I suspected this being hazelcast/hazelcast#4406 I have upgraded which made the situation much better. Now after upgrading to 3.9 our results are much better, but as stated above still not perfect.

I'll try to get this reproduced with a test app, but I thought I'd open this issue here to see if I can get any early advice. What does the 1 pending invocation mean and how is it possible that an invocation completely gets lost and never returns..?

hibernate-5.2 support

There are some binary compatibility issues between hibernate 5.0 and hibernate 5.2 so users can't upgrade to hibernate 5.2 if they use hazelcast-hibernate5 as 2nd level cache in their applications.

Related Issue: #1

Add support for Hibernate 5.3.x

The org.hibernate.cache.spi.RegionFactory in Hibernate 5.3.x extends from the new interface Stoppable. This breaks the compatibility for the HazelcastLocalCacheRegionFactory.

An exception like the following is thrown when trying to use hazelcast 3.10 together with hibernate 5.3.x:

Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.cache.spi.RegionFactory] Unable to resolve name [com.hazelcast.hibernate.HazelcastLocalCacheRegionFactory] as strategy [org.hibernate.cache.spi.RegionFactory]

Strictly name this module for JPMS

Please apply the JPMS naming techniques for this module, please avoid automatic-module-naming.

The moditect plugin can be used to attach the module-info file to the package, without modifying the class versions or the original packaging.

Note that strictly naming the modules will require the full suite be in hazelcast-all,

This should really be considered and done, I have already done FasterXML, Guice, aop, org.json and javax.inject, but the building pattern for hazelcast is slightly different and will need a more knowledgeable hand on the build than what I have.

Thanks!

Different classloader problem for Hibernate4CacheKeySerializer

When hazelcast.jar and hazelcast-hibernate4.jar are loaded by different class loaders, com.hazelcast.hibernate.serialization.Hibernate4CacheKeySerializer is not found to be an internal Serializer type by ClassloaderUtil#isInternalType because they're loaded from different classloaders, so an exception is thrown by AbstractSerializationService

Same problem occurs when trying to use hazelcast-hibernate4.jar and hazelcast-tomcat8-sessionmanager.jar together in the same project as hazelcast-tomcat8-sessionmanager.jar and hazelcast-client.jar is put under ${TOMCAT_HOME}/lib and loaded by Tomcat's common classloader and hazelcast-hibernate4.jar is deployed along with the WAR file as part of the web application (thus loaded by the WebAppClassloader).

This issue is the original one, opened on the old and deprecated hazelcast-hibernate4 repository.

Same problem described in this SO question and in comments of this SO question as well.

Hibernate 5.0.12 support

The current hazelcast-hibernate5 version (1.2.1) is not compatible with the internal API of Hibernate >= 5.0.12. This causes the following runtime exception:

java.lang.IncompatibleClassChangeError: Expected static method org.hibernate.cache.internal.DefaultCacheKeysFactory.createEntityKey(Ljava/lang/Object;Lorg/hibernate/persister/entity/EntityPersister;Lorg/hibernate/engine/spi/SessionFactoryI
	at com.hazelcast.hibernate.region.EntityRegionAccessStrategyAdapter.generateCacheKey(EntityRegionAccessStrategyAdapter.java:66)
	at org.hibernate.engine.internal.TwoPhaseLoad.doInitializeEntity(TwoPhaseLoad.java:187)

In 5.0.12 the public methods of DefaultCacheKeysFactory have been changed and some of cache-key implementations have been renamed as well. It's pretty simple to adjust the current code, but it would break compatibility with previous Hibernate versions, unless reflection is used.

Are there any plans to support Hibernate >= 5.0.12 as well?

Hibernate - Hazelcast. Second level cache.Could not find a SessionFactory exception

Legend:

  • 2 application instances with Hazelcast on each.
  • Hazelcast instances configured in cluster. Configuration is properly configured, synchronization performed (tested in manual mode).
  • Hibernate is using Hazelcast as second-level cache provider.

In application exists entity with next class level annotations:

@Entity
@Cache( usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE )
@Table( name = "entity", catalog = "main" )
@IdClass( EntityPK.class )

When update for this entity performed to database on first instance, Exception com.hazelcast.nio.serialization.HazelcastSerializationException: org.hibernate.HibernateException: Could not find a SessionFactory [uuid=ee9f3ccd-1f7e-4345-83ed-e58440a52123,name=null] is thrown on second instance.

After debug I located cause of this exception - it thrown by org.hibernate.type.spi.TypeConfiguration.Scope#readResolve method during deserialization. Instance of this class is part of default Hibernate cache key object.

From what I found out. Object that cause problem is "session scoped". In other words it is bounded to specific SessionFactory and contain in its fields session factory UUID and reference to factory itself. During serialization factory UUID is preserved. When deserialization is performed, object tries to restore link to its factory but it deserializaed in other instance where session factory with specified UUID not exists. Because session factory is missing exception is thrown.

Is there are way to avoid this exception?

Hibernate and related libs versions is next:

<hibernate.version>5.3.14.Final</hibernate.version>
<hibernate-types-52.version>2.5.0</hibernate-types-52.version>
<hazelcast.version>3.11.5</hazelcast.version>
<dependency>
    <groupId>com.hazelcast</groupId>
    <artifactId>hazelcast-hibernate53</artifactId>
    <version>1.3.2</version>
</dependency>
        <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>${hibernate.version}</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-jpamodelgen</artifactId>
        <version>${hibernate.version}</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-envers</artifactId>
        <version>${hibernate.version}</version>
    </dependency>

    <dependency>
        <groupId>com.vladmihalcea</groupId>
        <artifactId>hibernate-types-52</artifactId>
        <version>${hibernate-types-52.version}</version>
    </dependency>

Can't read entries from cache in Hibernate 5.2

Currenly Hibernate52CacheEntrySerializer uses CacheEntryImpl while deserializing entries.

https://github.com/hazelcast/hazelcast-hibernate5/blob/32e23c0e95baa87a3a631fb0cd9accb5ae87b155/hazelcast-hibernate52/src/main/java/com/hazelcast/hibernate/serialization/Hibernate52CacheEntrySerializer.java#L90

However, there is a code in hibernate-core that casts CacheEntry to specific implementation:
https://github.com/hibernate/hibernate-orm/blob/cf88522a31657ffdbc37dfa44dcdb11cdd27e0a4/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultLoadEventListener.java#L754

This results in ClassCastException and it does not look like custom implementations are allowed at all.

I might be wrong, but it looks like the only reason why you don't get this issue out of the box with hazelcast-hibernate52 is that there is no custom serialization for CacheEntry in at all, as hook is registered for CacheEntryImpl
https://github.com/hazelcast/hazelcast-hibernate5/blob/32e23c0e95baa87a3a631fb0cd9accb5ae87b155/hazelcast-hibernate52/src/main/java/com/hazelcast/hibernate/serialization/Hibernate5CacheEntrySerializerHook.java#L40

HazelcastLocalCacheRegionFactory: Cache is not updated on the local member but on other members

We have a project with entities linked with ManyToMany relationships, like this for example:

@entity(name = "users")
@Inheritance(strategy = InheritanceType.JOINED)
@table(indexes = {@Index(columnList = "token")})
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public abstract class UserEntity implements Serializable
{
....
@manytomany(cascade = CascadeType.ALL ,fetch=FetchType.LAZY)
@jointable(name="user_role",
joinColumns={@joincolumn(name="user_id")},
inverseJoinColumns={@joincolumn(name="role")})
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public Set roles;
}

@entity(name = "roles")
@StandardDb
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class RoleEntity implements Serializable
{
...
}

With these entities we then do:
UserEntity user = users.find(userId);
user.roles.add(roles.find(roleName));
users.persist(user)

To add a role the user. On other nodes in the hazelcast cluster, the cache was invalidated and when doing gets, the cache looked ok. But on the node that received the request to add the role to the user, the cache was not updated.

With HazelcastCacheRegionFactory it's working as it should. We have also tried different settings with hibernate.cache.auto_evict_collection_cache, hibernate.cache.use_minimal_puts. But with no success.

In the end, it seems to be related to LocalRegionCache#MessageListener#onMessage where it does an optimization with:
if (!message.getPublishingMember().localMember())

so updates are not ran on the local member. Any comments on removing this optimization?

Btw, the same issue appears for hibernate4.

Hibernate 5.3.* Support with jcache fails on getCachingProviders because of not a subtype of javax.cache.spi.CachingProvider

Description :
Recently, we have upgraded the version of Hibernate from 4.3.5 to 5.3.7, then we can't launch our project right now in active mode of second level cache with Hazelcast implementation.

Working Environments :
Java 8, Glassfih 4.1, JPA 2.2, Hibernate-* 5.3.7, Hazelcast 3.12, cache-api 1.1.0

Following is a snippet of our related configuration :
<property name="hibernate.cache.use_second_level_cache" value="true"/> <property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.jcache.JCacheRegionFactory" /> <property name="hibernate.cache.jcache.config" value="classpath:myhazelcast.xml"/> <property name="hibernate.javax.cache.provider" value="com.hazelcast.cache.HazelcastCachingProvider" />

Here is the error message we meet :

java.util.ServiceConfigurationError: javax.cache.spi.CachingProvider: Provider com.hazelcast.cache.HazelcastCachingProvider not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:239)
at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at javax.cache.Caching$CachingProviderRegistry$1.run(Caching.java:448)
at javax.cache.Caching$CachingProviderRegistry$1.run(Caching.java:442)
at java.security.AccessController.doPrivileged(Native Method)
at javax.cache.Caching$CachingProviderRegistry.getCachingProviders(Caching.java:442)
at javax.cache.Caching$CachingProviderRegistry.getCachingProvider(Caching.java:529)
at javax.cache.Caching$CachingProviderRegistry.getCachingProvider(Caching.java:476)
at javax.cache.Caching.getCachingProvider(Caching.java:226)
at org.hibernate.cache.jcache.internal.JCacheRegionFactory.getCachingProvider(JCacheRegionFactory.java:246)
at org.hibernate.cache.jcache.internal.JCacheRegionFactory.resolveCacheManager(JCacheRegionFactory.java:204)
at org.hibernate.cache.jcache.internal.JCacheRegionFactory.prepareForUse(JCacheRegionFactory.java:188)
at org.hibernate.cache.spi.AbstractRegionFactory.start(AbstractRegionFactory.java:91)
at org.hibernate.cache.internal.EnabledCaching.(EnabledCaching.java:77)
at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:33)
at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:24)
at org.hibernate.service.spi.SessionFactoryServiceInitiator.initiateService(SessionFactoryServiceInitiator.java:30)
at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.initiateService(SessionFactoryServiceRegistryImpl.java:68)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.getService(SessionFactoryServiceRegistryImpl.java:109)
at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:239)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:939)
at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:141)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:199)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.(PersistenceUnitLoader.java:107)
at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223)
at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510)
at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230)
at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:925)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:434)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)]]
[2019-07-03T14:57:07.478+0200] [glassfish 4.1] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=53 _ThreadName=admin-listener(5)] [timeMillis: 1562158627478] [levelValue: 1000] [[
Exception while preparing the app]]
[2019-07-03T14:57:07.478+0200] [glassfish 4.1] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=53 _ThreadName=admin-listener(5)] [timeMillis: 1562158627478] [levelValue: 1000] [[
Exception during lifecycle processing
java.util.ServiceConfigurationError: javax.cache.spi.CachingProvider: Provider com.hazelcast.cache.HazelcastCachingProvider not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:239)
at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at javax.cache.Caching$CachingProviderRegistry$1.run(Caching.java:448)
at javax.cache.Caching$CachingProviderRegistry$1.run(Caching.java:442)
at java.security.AccessController.doPrivileged(Native Method)
at javax.cache.Caching$CachingProviderRegistry.getCachingProviders(Caching.java:442)
at javax.cache.Caching$CachingProviderRegistry.getCachingProvider(Caching.java:529)
at javax.cache.Caching$CachingProviderRegistry.getCachingProvider(Caching.java:476)
at javax.cache.Caching.getCachingProvider(Caching.java:226)
at org.hibernate.cache.jcache.internal.JCacheRegionFactory.getCachingProvider(JCacheRegionFactory.java:246)
at org.hibernate.cache.jcache.internal.JCacheRegionFactory.resolveCacheManager(JCacheRegionFactory.java:204)
at org.hibernate.cache.jcache.internal.JCacheRegionFactory.prepareForUse(JCacheRegionFactory.java:188)
at org.hibernate.cache.spi.AbstractRegionFactory.start(AbstractRegionFactory.java:91)
at org.hibernate.cache.internal.EnabledCaching.(EnabledCaching.java:77)
at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:33)
at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:24)
at org.hibernate.service.spi.SessionFactoryServiceInitiator.initiateService(SessionFactoryServiceInitiator.java:30)
at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.initiateService(SessionFactoryServiceRegistryImpl.java:68)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.getService(SessionFactoryServiceRegistryImpl.java:109)
at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:239)
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:939)
at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:141)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:199)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.(PersistenceUnitLoader.java:107)
at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223)
at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510)
at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230)
at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:925)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:434)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:745)
]]
[2019-07-03T14:57:07.569+0200] [glassfish 4.1] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=53 _ThreadName=admin-listener(5)] [timeMillis: 1562158627569] [levelValue: 1000] [[
Exception while preparing the app : javax.cache.spi.CachingProvider: Provider com.hazelcast.cache.HazelcastCachingProvider not a subtype]]

Allow MapConfig to be supplied in LocalRegionCache constructor

I would like to see another constructor added to LocalRegionCache that allows the MapConfig to be passed in.

The use case is that the current constructor looks up the MapConfig via HazelcastInstance, which returns a read-only MapConfig. This rules out dynamic, runtime changes to the cache max size an TTL.

By allowing a MapConfig to be supplied, a mutable one can be supplied instead, via a custom RegionFactory.

My preference would have been for a dedicated CacheConfig abstraction rather than a direct dependency on MapConfig, but the MapConfig is already leaking out via the protected field in the class, so that ship has sailed.

Unable to resolve name com.hazelcast.hibernate.HazelcastCacheRegionFactory

I'm using hibernate-core 5.2.12.Final and hazelcast-hibernate52 version 1.0.2
hibernate configurations are as follows:

<bean id="someBean"
		class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<prop key="hibernate.cache.region.factory_class">com.hazelcast.hibernate.HazelcastCacheRegionFactory</prop>
<prop key="hibernate.cache.hazelcast.instance_name">tbosHazelcast</prop>

and my spring hazelcast configuration are as follows;

        <hz:config>
        <hz:instance-name>tbosHazelcast</hz:instance-name>
...

I'm stuck with this exception importing using hazelcast.xml as well but didn't solve my problem

Caused by: org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [com.hazelcast.hibernate.HazelcastCacheRegionFactory] as strategy [org.hibernate.cache.spi.RegionFactory]
	at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:126)
	at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.resolveStrategy(StrategySelectorImpl.java:194)
	at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.resolveStrategy(StrategySelectorImpl.java:161)
	at org.hibernate.cache.internal.RegionFactoryInitiator.initiateService(RegionFactoryInitiator.java:67)
	at org.hibernate.cache.internal.RegionFactoryInitiator.initiateService(RegionFactoryInitiator.java:28)
	at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88)
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:259)
	... 47 more

LocalCacheRegion does not collect any statistics

We use hazelcast as a second level cache for hibernate in p2p mode using a HazelcastLocalCacheRegionFactory, thus synchronising updates in the cache via invalidation messages.

Shortly before we went live, I provided my own modified version because at that time it was lacking LFU eviction mechanics. Aside from that I also added statistics for hits, misses, invalidations, evictions etc.

The current version provides standard eviction mechanisms now (LFU, LRU) but lacks the possibility to gather statistics about the cache regions.

Having (maybe toggable) statistics in there would greatly help to find out if the cache region performs well. In comparison, the ClientNearCache at least collects basic information like hits and misses but the LocalRegionCache has none at all.

I'd really like to have useful stats for the LocalRegionCache as well. I'd also offer to add this functionality and create a github pull request. What do you guys think?

OSGi java.lang.ClassNotFoundException: com.hazelcast.hibernate.instance.DefaultHazelcastInstanceFactory

Hi,
I am trying to use hazelcast-hibernate5-1.2.2 in an OSGi environment but I get the following exception on startup:

Caused by: org.apache.felix.log.LogException: org.hibernate.cache.CacheException: Failed to set up hazelcast instance factory
at com.hazelcast.hibernate.AbstractHazelcastCacheRegionFactory.start(AbstractHazelcastCacheRegionFactory.java:91)
at org.hibernate.internal.CacheImpl.(CacheImpl.java:49)
at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:28)
at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:20)
at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.initiateService(SessionFactoryServiceRegistryImpl.java:46)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:234)
... 16 more
Caused by: java.lang.ClassNotFoundException: com.hazelcast.hibernate.instance.DefaultHazelcastInstanceFactory
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1284)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1118)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.hazelcast.hibernate.AbstractHazelcastCacheRegionFactory.start(AbstractHazelcastCacheRegionFactory.java:88)

The problem is the code in method AbstractHazelcastCacheRegionFactory.start(...) which uses Thread.currentThread().getContextClassLoader() to try to load the class DefaultHazelcastInstanceFactory using Class.forName.

This is unnecessary as both classes are in the same bundle so just calling new DefaultHazelcastInstanceFactory() would be enough in the case that no property hibernate.cache.hazelcast.factory is defined.

Using the Thread's ContextClassLoader in an OSGi environment is generally not a good idea, it seems.

CustomPropertiesTest.testNativeClient

java.lang.AssertionError: expected:<1> but was:<2>
	at org.junit.Assert.fail(Assert.java:88)
	at org.junit.Assert.failNotEquals(Assert.java:834)
	at org.junit.Assert.assertEquals(Assert.java:645)
	at org.junit.Assert.assertEquals(Assert.java:631)
	at com.hazelcast.hibernate.CustomPropertiesTest.testNativeClient(CustomPropertiesTest.java:90)

https://hazelcast-l337.ci.cloudbees.com/view/Plugins/job/Hibernate-5-Master/com.hazelcast$hazelcast-hibernate5/198/testReport/junit/com.hazelcast.hibernate/CustomPropertiesTest/testNativeClient/

`hazelcast-hibernate52` 1.1.1 not compatible with Hibernate 5.2.5

Application that uses the following combination of dependencies:

  • org.hibernate:hibernate-core:5.2.5.Final
  • com.hazelcast:hazelcast:3.7.3
  • com.hazelcast:hazelcast-hibernate52:1.1.1

Fails on first access of 2nd level cache the following exception:

java.lang.IncompatibleClassChangeError: Expected static method org.hibernate.cache.internal.DefaultCacheKeysFactory.createEntityKey(Ljava/lang/Object;Lorg/hibernate/persister/entity/EntityPersister;Lorg/hibernate/engine/spi/SessionFactoryI
	at com.hazelcast.hibernate.region.EntityRegionAccessStrategyAdapter.generateCacheKey(EntityRegionAccessStrategyAdapter.java:66)
	at org.hibernate.event.internal.DefaultLoadEventListener.getFromSharedCache(DefaultLoadEventListener.java:644)
	at org.hibernate.event.internal.DefaultLoadEventListener.loadFromSecondLevelCache(DefaultLoadEventListener.java:595)
	at org.hibernate.event.internal.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:462)
	at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:219)
	at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:278)
	at org.hibernate.event.internal.DefaultLoadEventListener.doOnLoad(DefaultLoadEventListener.java:121)
	at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:89)
	at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1222)
	at org.hibernate.internal.SessionImpl.access$1900(SessionImpl.java:204)
	at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.doLoad(SessionImpl.java:2776)
	at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.load(SessionImpl.java:2750)
	at org.hibernate.internal.SessionImpl.find(SessionImpl.java:3379)
	at org.hibernate.internal.SessionImpl.find(SessionImpl.java:3348)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)

Similar to #9, this is also a consequence of usage of Hibernate's internals instead of SPI (see this change).

hazelcast-hibernate53 does not work with hibernate 5.4

There is need for perhaps hazelcast-hibernate54 to support hibernate-orm 5.4.x
I upgraded to hibernate-orm 5.4.2 and used hazelcast-hibernate53 and discovered that setting query cache to true and the cacheRegion i,.e.

q.setCacheable(true)
                .setCacheRegion(cacheRegion);
                q.list()

resulted into

java.lang.ClassCastException: com.hazelcast.hibernate.HazelcastDomainDataRegionImpl cannot be cast to org.hibernate.cache.spi.QueryResultsRegion

On investigating further I narrowed it down to this block of code in the org.hibernate.cache.internal.EnabledCaching class

protected QueryResultsCache makeQueryResultsRegionAccess(String regionName) {
		final QueryResultsRegion region = (QueryResultsRegion) regionsByName.computeIfAbsent(
				regionName,
				this::makeQueryResultsRegion
		);
		final QueryResultsCacheImpl regionAccess = new QueryResultsCacheImpl(
				region,
				timestampsCache
		);
		namedQueryResultsCacheMap.put( regionName, regionAccess );
		legacySecondLevelCacheNames.add( regionName );
		return regionAccess;
	}

Specifically, the HazelcastDomainDataRegionImpl and QueryResultsRegion are not compatible

[TEST-FAILURE] LocalRegionFactoryDefaultTest.testQuery

Maintenance-3x issue

https://hazelcast-l337.ci.cloudbees.com/job/Hazelcast-3.maintenance-problematicTest/com.hazelcast$hazelcast-hibernate4/96/testReport/junit/com.hazelcast.hibernate/LocalRegionFactoryDefaultTest/testQuery/

java.lang.AssertionError: expected:<1> but was:<3>
    at org.junit.Assert.fail(Assert.java:88)
    at org.junit.Assert.failNotEquals(Assert.java:743)
    at org.junit.Assert.assertEquals(Assert.java:118)
    at org.junit.Assert.assertEquals(Assert.java:555)
    at org.junit.Assert.assertEquals(Assert.java:542)
    at com.hazelcast.hibernate.HibernateStatisticsTestSupport.testQuery(HibernateStatisticsTestSupport.java:181)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at com.hazelcast.test.HazelcastSerialClassRunner.runChild(HazelcastSerialClassRunner.java:37)
    at com.hazelcast.test.HazelcastSerialClassRunner.runChild(HazelcastSerialClassRunner.java:26)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.junit.runners.Suite.runChild(Suite.java:127)
    at org.junit.runners.Suite.runChild(Suite.java:26)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
    at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:113)
    at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:85)
    at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:54)
    at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:134)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)

Hz as Hibernate 2nd level cache - Enum de/serialization issue

Project Setup Description
Hazelcast topology used : Cluster (client/server)
We have a spring boot application where we want to use hazelcast as distributed Hibernate 2nd level cache and distributed query cache (When both are enabled or not by setting the appropriate properties). This spring boot app acts as client to our cluster. The hz server is set up using docker images (Docker desktop on windows 10). Note that 10.70.37.29 is the ip of my pc where everything is running. Management center is also running by executing it's war file downloaded separately.

  • First we run the management center, by executing the below command:
    java -jar hazelcast-mancenter-3.12-ALPHA-1.war 8083 hazelcast-mancenter

  • Then we run the hz server (1st member) with the below command:
    docker run -e JAVA_OPTS="-Dhazelcast.local.publicAddress=10.70.37.29:5701 -Dhazelcast.diagnostics.enabled=true" -e MANCENTER_URL="http://10.70.37.29:8083/hazelcast-mancenter" -p 5701:5701 --name hazelcast1 hazelcast/hazelcast:3.12.1

  • Then we can add a 2nd member to the cluster (docker image) with the below command but this is something optional and is not related to our problem:
    docker run -e JAVA_OPTS="-Dhazelcast.local.publicAddress=10.70.37.29:5702 -Dhazelcast.diagnostics.enabled=true" -e MANCENTER_URL="http://10.70.37.29:8083/hazelcast-mancenter" -p 5702:5701 --name hazelcast2 hazelcast/hazelcast:3.12.1

  • Then we run our spring boot app where we have configured the ClientConfig in order to connect to the cluster and config our maps and caches. Inside the HazelcastConfigurationBase.java class we have all the required config (attached):

Everything works perfect and we can see in the management center all the correct info. The only issue we face is related to custom Enum de/serialization upon updating(via a post rest service) an entity the has an enum as a field. we get this exception in the below method:

Class: ClientProxy.java
Method:

protected <T> T invokeOnPartition(ClientMessage clientMessage, int partitionId) {
        try {
            final Future future = new ClientInvocation(getClient(), clientMessage, getName(), partitionId).invoke();
            return (T) future.get();
        } catch (Exception e) {
            throw rethrow(e);
        }
    }

java.util.concurrent.ExecutionException: com.hazelcast.core.OperationTimeoutException: ClientInvocation{clientMessage = ClientMessage{connection=null, length=22, correlationId=7681, operation=Map.executeOnKey, messageType=132, partitionId=67, isComplete=false, isRetryable=false, isEvent=false, writeOffset=0}, objectName = applicationParameters, target = partition 67, sendConnection = ClientConnection{alive=true, connectionId=2, channel=NioChannel{/10.70.37.29:54318->/10.70.37.29:5701}, remoteEndpoint=[10.70.37.29]:5701, lastReadTime=2019-09-11 14:32:47.521, lastWriteTime=2019-09-11 14:32:47.519, closedTime=never, connected server version=3.12.1}} timed out because exception occurred after client invocation timeout 120000 ms. Current time: 2019-09-11 14:32:47.521. Start time: 2019-09-11 14:30:46.782. Total elapsed time: 120739 ms.
Caused by
com.hazelcast.nio.serialization.HazelcastSerializationException: There is no suitable de-serializer for type -205. This exception is likely to be caused by differences in the serialization configuration between members or between clients and members.

We are using :
Java 8, hazelcast-all 3.12.1, cache-api 1.1.0, hibernate-core 5.0.12.Final

Notes

  • FYI int the above steps that reproduce the issue we are trying to update an entity that contains custom enum fields, named ApplicationParameter.java (attached)
  • We have tried several configurations in the client's serialization config section but no luck.
  • We have tried adding custom hazelcast.xml to the server side and add custom serialization config also but no luck.
  • If we add hibernate-core-5.0.12.Final.jar and hazelcast-hibernate5-1.3.2.jar inside server container to path /opt/hazelcast/lib/ then the above exception transforms into something more clear saying that the entity class which contains the custom enum, cannot be found. ClassNotFoundException
  • Then if we add our persistence.jar (that contains all our entity/model classes plus enums) to the CLASSPATH of the server container obviously the exception is gone and eveything works, but this is quite weird and not desirable.

ApplicationParameter.txt

HazelcastConfigurationBase.txt

ApplicationParameterDataType.txt

ApplicationParameterViewFlag.txt

Could you please assist to overcome this issue? Is this a bug or do we need to add some special configuration to our client or server. Thanks in advacne.

LocalCacheRegion should lookup MapConfig on every cleanup

Currently, LocalRegionCache takes a read-only copy of the MapConfig at constructor time, and uses that MapConfig to get the max cache size and eviction TTL in the cleanup method. The problem there is that any runtime changes in the application to the MapConfig are not reflected.

LocalRegionCache can be changed so that the MapConfig is resolved each time cleanup is called. There should be very little overhead to doing so.

Intermittent Exception "GetConnectedClientsOperation can not be used for multiple invocations!"

I have multiple instances participating in the hazelcast cluster.

However, after I bring few instances up & start another instance, I get this exception intermittently

Exception in thread "hz.message-handler.cached.thread-3" java.lang.IllegalStateException: An operation[com.hazelcast.client.impl.operations.GetConnectedClientsOperation{serviceName='hz:core:clientEngine', identityHash=1628046595, partitionId=-1, replicaIndex=0, callId=2, invocationTime=1468338072297 (2016-07-12 15:41:12.297), waitTimeout=-1, callTimeout=60000}] can not be used for multiple invocations!
    at com.hazelcast.spi.impl.operationservice.impl.Invocation.invoke0(Invocation.java:218)
    at com.hazelcast.spi.impl.operationservice.impl.Invocation.invoke(Invocation.java:205)
    at com.hazelcast.spi.impl.operationservice.impl.OperationServiceImpl.invokeOnTarget(OperationServiceImpl.java:296)
    at com.hazelcast.client.impl.ClientEngineImpl.getConnectedClientStats(ClientEngineImpl.java:439)
    at com.hazelcast.util.PhoneHome.phoneHome(PhoneHome.java:143)
    at com.hazelcast.util.PhoneHome$1.run(PhoneHome.java:80)
    at com.hazelcast.spi.impl.executionservice.impl.SkipOnConcurrentExecutionDecorator.run(SkipOnConcurrentExecutionDecorator.java:40)
    at com.hazelcast.util.executor.CachedExecutorServiceDelegate$Worker.run(CachedExecutorServiceDelegate.java:212)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
    at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)
    at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:92)

Environment:
hibernate: 5.1.0.Final
hazelcast: 3.7-EA
hazelcast-hibernate5: 1.0

QueryCache not working after insert into table

hibernate 5.2.10
hazelcast 3.8.3
hibernate.cfg.xml cache config part
com.hazelcast.hibernate.HazelcastLocalCacheRegionFactory

    <property name="hibernate.cache.use_second_level_cache">true</property>
    <property name="hibernate.cache.use_query_cache">true</property>
    <property name="hibernate.cache.auto_evict_collection_cache">true</property>

Description: cache not working after insert (or delete, not tested on update) into table, for an amount of time equal to cache region timeout (default to one hour).

Source of problem (hibernate code at org.hibernate.cache.spi.UpdateTimestampsCache): Hibernate cache update process consist of two parts. First is preInvalidate, at this step it updates timestamp cache with value equals to region.nextTimestamp() + region.getTimeout(). After transaction completes it calls invalidate and updates timestamp cache with value equals to region.nextTimestamp(). So the second update set timestamp to a value less then it were on first step. The problem is in com.hazelcast.hibernate.local.TimestampsRegionCache, it's maybeInvalidate(...) method does not allow update timestamp to a value less than current. So the query cache timestamp remains in future, not allowing to read from it until the timeout run off.

Cache IMaps not visible in JMX

I have turned on JMX with

<properties>
	<property name="hazelcast.jmx">true</property>
</properties>

When I start my app, I see that the cache is working by re-running the same query and noting that the SQL is only issued the first time, and Hibernate indicates it found the entry in the cache. However, when I look in JMX, the only bean I can find is the ITopic associated with the cached type (presumably for invalidation events) but I cannot see the IMap that holds the actual cache entries.

This is important because I want to evaluate my cache performance, and also because there are times when I need to clear the caches (data updated in db directly) without bouncing all the servers.

I'm using Spring Boot 2.0.1, Hibernate 5.2.16, and hazelcast-hibernate52 1.2.3 (hazelcast 3.9.3).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.