WAN Replication with Hibernate 2nd level cache

58 views
Skip to first unread message

Pratik Patel

unread,
Apr 29, 2014, 8:18:07 AM4/29/14
to haze...@googlegroups.com

Hi,

We have one hazelcast server with WAN replication enabled. This server is configured as 2nd level cache for hibernate in another application which is hazelcast client.

The same setup is configured on remote site. 

The WAN replication is configured between two hazelcast servers.

The WAN replication works, in the sense any updates are sent to remote Hazelcast server. But we get Hibernate CacheEntry object at the remote site. And the server does not understand what to do with these objects. Would it be possible to get the actual Key and Value of the POJO instead of Hibernate Cache representation?

Are we missing anything in the configuration?

Any suggestions or work around would be a great help.

Thanks,
Pratik



Pratik Patel

unread,
May 1, 2014, 1:49:50 AM5/1/14
to haze...@googlegroups.com
I would like to add a point in the original post.

WAN Replication fails on remote site as Hazelcast MapStore.store() method expects actual entity but it receives Hibernate Cached entity objects as key and values. The stacktrace is as shown below.

Unknown entity: org.hibernate.cache.entry.CacheEntry
org.hibernate.MappingException: Unknown entity: org.hibernate.cache.entry.CacheEntry
 at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:691)
 at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1485)
 at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:202)
 at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:531)
 at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:103)
 at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
 at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:685)
 at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:677)
 at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:673)
 at com.mii.persistence.dao.core.GenericDaoImpl.store(GenericDaoImpl.java:172)
 at com.mii.persistence.dao.core.GenericDaoImpl.store(GenericDaoImpl.java:29)
 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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
 at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
 at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
 at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
 at com.sun.proxy.$Proxy24.store(Unknown Source)
 at com.hazelcast.map.MapStoreWrapper.store(MapStoreWrapper.java:94)
 at com.hazelcast.map.DefaultRecordStore.writeMapStore(DefaultRecordStore.java:691)
 at com.hazelcast.map.DefaultRecordStore.set(DefaultRecordStore.java:666)
 at com.hazelcast.map.operation.SetOperation.run(SetOperation.java:40)
 at com.hazelcast.spi.impl.BasicOperationService.processOperation(BasicOperationService.java:368)
 at com.hazelcast.spi.impl.BasicOperationService.access$800(BasicOperationService.java:106)
 at com.hazelcast.spi.impl.BasicOperationService$BasicOperationProcessorImpl.process(BasicOperationService.java:773)
 at com.hazelcast.spi.impl.BasicOperationScheduler$PartitionThread.process(BasicOperationScheduler.java:275)
 at com.hazelcast.spi.impl.BasicOperationScheduler$PartitionThread.doRun(BasicOperationScheduler.java:269)
 at com.hazelcast.spi.impl.BasicOperationScheduler$PartitionThread.run(BasicOperationScheduler.java:244)
 at ------ End remote and begin local stack-trace ------.(Unknown Source)
 at com.hazelcast.client.spi.impl.ClientCallFuture.resolveResponse(ClientCallFuture.java:152)
 at com.hazelcast.client.spi.impl.ClientCallFuture.get(ClientCallFuture.java:106)
 at com.hazelcast.client.spi.impl.ClientCallFuture.get(ClientCallFuture.java:86)
 at com.hazelcast.client.spi.ClientProxy.invoke(ClientProxy.java:109)
 at com.hazelcast.client.proxy.ClientMapProxy.set(ClientMapProxy.java:310)
 at com.hazelcast.client.proxy.ClientMapProxy.set(ClientMapProxy.java:758)
 at com.hazelcast.hibernate.distributed.IMapRegionCache.update(IMapRegionCache.java:106)
 at com.hazelcast.hibernate.distributed.IMapRegionCache.put(IMapRegionCache.java:68)
 at com.hazelcast.hibernate.access.AbstractAccessDelegate.put(AbstractAccessDelegate.java:60)
 at com.hazelcast.hibernate.access.ReadWriteAccessDelegate.putFromLoad(ReadWriteAccessDelegate.java:57)
 at com.hazelcast.hibernate.region.EntityRegionAccessStrategyAdapter.putFromLoad(EntityRegionAccessStrategyAdapter.java:80)
 at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:195)
 at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:982)
 at org.hibernate.loader.Loader.doQuery(Loader.java:857)
 at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
 at org.hibernate.loader.Loader.doList(Loader.java:2533)
 at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
 at org.hibernate.loader.Loader.list(Loader.java:2271)
 at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:119)
 at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1716)
 at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
 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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
 at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
 at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
 at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
 at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
 at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
 at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
 at com.sun.proxy.$Proxy40.getBganProfileListByUserName(Unknown Source)

Am I true assuming that Hazelcast WAN Replication with Hibernate does not work or is there any workaround?

Thanks,

Pratik


Pratik Patel

unread,
May 1, 2014, 11:48:44 PM5/1/14
to haze...@googlegroups.com
Hi,

Can someone please give help on this issue? It is currently a blocker for our POC work.

Many Thanks,
Pratik
Reply all
Reply to author
Forward
0 new messages