Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassNotFoundException throwed when trying to get an entry of TransactionalMap #4969

Closed
seyfullahdemir opened this issue Apr 1, 2015 · 29 comments

Comments

Projects
None yet
7 participants
@seyfullahdemir
Copy link

commented Apr 1, 2015

When using Hazelcast's TransactionalMap to hold Entry(key:String, value:CustomEntity), I am facing a problem when trying to get an entry in a TransactionalTask. There is no problem when putting the entry to the cache, serialization of the object is done successfully; but when I try to the get the entry in a different TransactionalTask, HazelcastInstance itself is trying to load the class of object to be deserialized and it could not find it, and throws ClassNotFoundException.

I run Hazelcast Instance as a windows service using server.bat file (I do not programmatically initialize Hazelcast Instance). In application code (Tomcat container and Spring application context) through the hazelcast-client jar dependency, I am getting Hazelcast client object and by using that, achive communicating with Hazelcast Instance.

When I add the jar of custom entities to the classpath of HazelcastInstance (java -server -cp "../lib/hazelcast-3.2.3.jar;../lib/customEntity.jar" com.hazelcast.examples.TestApp), the problem is solved. But I do not want to make HazelcastInstance to be dependent to the entity.jar.

In hazelcast.xml configuration file:

  • in-memory-format for Maps' default configuration (): "BINARY"
  • no specific configuration for TransactionalMap

Can someone have any idea of what the source of the problem really is and can anyone offer a solution or workaround for this issue.

Thanks in advance.

Seyfullah

@pveentjer

This comment has been minimized.

Copy link
Member

commented Apr 1, 2015

Can you post the stacktrace?

@seyfullahdemir

This comment has been minimized.

Copy link
Author

commented Apr 2, 2015

[2015/04/01 15:13:42] ERROR com.myproject.infra.security.MyExceptionHandlerFilter:22 - java.lang.ClassNotFoundException: com.myproject.security.common.entity.session.Session
com.hazelcast.nio.serialization.HazelcastSerializationException: java.lang.ClassNotFoundException: com.myproject.security.common.entity.session.Session
    at com.hazelcast.nio.serialization.DefaultSerializers$ObjectSerializer.read(DefaultSerializers.java:201)
    at com.hazelcast.nio.serialization.StreamSerializerAdapter.toObject(StreamSerializerAdapter.java:65)
    at com.hazelcast.nio.serialization.SerializationServiceImpl.toObject(SerializationServiceImpl.java:260)
    at com.hazelcast.spi.impl.NodeEngineImpl.toObject(NodeEngineImpl.java:186)
    at com.hazelcast.spi.impl.BasicInvocationFuture.resolveApplicationResponse(BasicInvocationFuture.java:361)
    at com.hazelcast.spi.impl.BasicInvocationFuture.resolveApplicationResponseOrThrowException(BasicInvocationFuture.java:320)
    at com.hazelcast.spi.impl.BasicInvocationFuture.get(BasicInvocationFuture.java:194)
    at com.hazelcast.spi.impl.BasicInvocationFuture.get(BasicInvocationFuture.java:173)
    at com.hazelcast.map.impl.tx.TransactionalMapProxySupport.getInternal(TransactionalMapProxySupport.java:119)
    at com.hazelcast.map.impl.tx.TransactionalMapProxy.get(TransactionalMapProxy.java:93)
    at com.hazelcast.map.impl.client.AbstractTxnMapRequest.innerCallInternal(AbstractTxnMapRequest.java:94)
    at com.hazelcast.map.impl.client.AbstractTxnMapRequest.innerCall(AbstractTxnMapRequest.java:83)
    at com.hazelcast.transaction.client.BaseTransactionRequest.call(BaseTransactionRequest.java:40)
    at com.hazelcast.client.impl.client.CallableClientRequest.process(CallableClientRequest.java:29)
    at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.processRequest(ClientEngineImpl.java:434)
    at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.run(ClientEngineImpl.java:353)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
    at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)
    at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:92)
    at ------ End remote and begin local stack-trace ------.(Unknown Source)
    at com.hazelcast.client.spi.impl.ClientCallFuture.resolveResponse(ClientCallFuture.java:202)
    at com.hazelcast.client.spi.impl.ClientCallFuture.get(ClientCallFuture.java:143)
    at com.hazelcast.client.spi.impl.ClientCallFuture.get(ClientCallFuture.java:119)
    at com.hazelcast.client.txn.proxy.ClientTxnProxy.invoke(ClientTxnProxy.java:52)
    at com.hazelcast.client.txn.proxy.ClientTxnMapProxy.get(ClientTxnMapProxy.java:50)
    at com.myproject.security.sessionmanager.HazelcastTransactionalCacheManager.get(HazelcastTransactionalCacheManager.java:41)
    at com.myproject.security.sessionmanager.HazelcastSessionStorageManager.getSession(HazelcastSessionStorageManager.java:46)
    at com.myproject.security.sessionmanager.HazelcastSessionManager$3.execute(HazelcastSessionManager.java:105)
    at com.myproject.security.sessionmanager.HazelcastSessionManager$3.execute(HazelcastSessionManager.java:101)
    at com.hazelcast.client.txn.ClientTransactionManager.executeTransaction(ClientTransactionManager.java:83)
    at com.hazelcast.client.txn.ClientTransactionManager.executeTransaction(ClientTransactionManager.java:76)
    at com.hazelcast.client.impl.HazelcastClientInstanceImpl.executeTransaction(HazelcastClientInstanceImpl.java:291)
    at com.hazelcast.client.impl.HazelcastClientProxy.executeTransaction(HazelcastClientProxy.java:147)
    at com.myproject.security.sessionmanager.HazelcastSessionManager.getSession(HazelcastSessionManager.java:101)
    at com.myproject.security.authentication.MyAuthenticationProvider.authenticate(MyAuthenticationProvider.java:43)
    at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:156)
    at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:177)
    at org.springframework.security.access.intercept.AbstractSecurityInterceptor.authenticateIfRequired(AbstractSecurityInterceptor.java:316)
    at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:202)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at com.myproject.security.authentication.AuthenticationTokenProcessingFilter.doFilter(AuthenticationTokenProcessingFilter.java:24)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at com.myproject.infra.security.MyExceptionHandlerFilter.doFilter(MyExceptionHandlerFilter.java:35)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:610)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ClassNotFoundException: com.myproject.security.common.entity.session.Session
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at com.hazelcast.nio.ClassLoaderUtil.tryLoadClass(ClassLoaderUtil.java:124)
    at com.hazelcast.nio.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:113)
    at com.hazelcast.nio.IOUtil$1.resolveClass(IOUtil.java:113)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1612)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1517)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
    at com.hazelcast.nio.serialization.DefaultSerializers$ObjectSerializer.read(DefaultSerializers.java:196)
    at com.hazelcast.nio.serialization.StreamSerializerAdapter.toObject(StreamSerializerAdapter.java:65)
    at com.hazelcast.nio.serialization.SerializationServiceImpl.toObject(SerializationServiceImpl.java:260)
    at com.hazelcast.spi.impl.NodeEngineImpl.toObject(NodeEngineImpl.java:186)
    at com.hazelcast.spi.impl.BasicInvocationFuture.resolveApplicationResponse(BasicInvocationFuture.java:361)
    at com.hazelcast.spi.impl.BasicInvocationFuture.resolveApplicationResponseOrThrowException(BasicInvocationFuture.java:320)
    at com.hazelcast.spi.impl.BasicInvocationFuture.get(BasicInvocationFuture.java:194)
    at com.hazelcast.spi.impl.BasicInvocationFuture.get(BasicInvocationFuture.java:173)
    at com.hazelcast.map.impl.tx.TransactionalMapProxySupport.getInternal(TransactionalMapProxySupport.java:119)
    at com.hazelcast.map.impl.tx.TransactionalMapProxy.get(TransactionalMapProxy.java:93)
    at com.hazelcast.map.impl.client.AbstractTxnMapRequest.innerCallInternal(AbstractTxnMapRequest.java:94)
    at com.hazelcast.map.impl.client.AbstractTxnMapRequest.innerCall(AbstractTxnMapRequest.java:83)
    at com.hazelcast.transaction.client.BaseTransactionRequest.call(BaseTransactionRequest.java:40)
    at com.hazelcast.client.impl.client.CallableClientRequest.process(CallableClientRequest.java:29)
    at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.processRequest(ClientEngineImpl.java:434)
    at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.run(ClientEngineImpl.java:353)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
    at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)
    at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:92)
[2015/04/01 15:13:42] ERROR com.myproject.infra.security.MyExceptionHandlerFilter:22 - java.lang.ClassNotFoundException: com.myproject.security.common.entity.session.Session
com.hazelcast.nio.serialization.HazelcastSerializationException: java.lang.ClassNotFoundException: com.myproject.security.common.entity.session.Session
    at com.hazelcast.nio.serialization.DefaultSerializers$ObjectSerializer.read(DefaultSerializers.java:201)
    at com.hazelcast.nio.serialization.StreamSerializerAdapter.toObject(StreamSerializerAdapter.java:65)
    at com.hazelcast.nio.serialization.SerializationServiceImpl.toObject(SerializationServiceImpl.java:260)
    at com.hazelcast.spi.impl.NodeEngineImpl.toObject(NodeEngineImpl.java:186)
    at com.hazelcast.spi.impl.BasicInvocationFuture.resolveApplicationResponse(BasicInvocationFuture.java:361)
    at com.hazelcast.spi.impl.BasicInvocationFuture.resolveApplicationResponseOrThrowException(BasicInvocationFuture.java:320)
    at com.hazelcast.spi.impl.BasicInvocationFuture.get(BasicInvocationFuture.java:194)
    at com.hazelcast.spi.impl.BasicInvocationFuture.get(BasicInvocationFuture.java:173)
    at com.hazelcast.map.impl.tx.TransactionalMapProxySupport.getInternal(TransactionalMapProxySupport.java:119)
    at com.hazelcast.map.impl.tx.TransactionalMapProxy.get(TransactionalMapProxy.java:93)
    at com.hazelcast.map.impl.client.AbstractTxnMapRequest.innerCallInternal(AbstractTxnMapRequest.java:94)
    at com.hazelcast.map.impl.client.AbstractTxnMapRequest.innerCall(AbstractTxnMapRequest.java:83)
    at com.hazelcast.transaction.client.BaseTransactionRequest.call(BaseTransactionRequest.java:40)
    at com.hazelcast.client.impl.client.CallableClientRequest.process(CallableClientRequest.java:29)
    at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.processRequest(ClientEngineImpl.java:434)
    at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.run(ClientEngineImpl.java:353)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
    at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)
    at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:92)
    at ------ End remote and begin local stack-trace ------.(Unknown Source)
    at com.hazelcast.client.spi.impl.ClientCallFuture.resolveResponse(ClientCallFuture.java:202)
    at com.hazelcast.client.spi.impl.ClientCallFuture.get(ClientCallFuture.java:143)
    at com.hazelcast.client.spi.impl.ClientCallFuture.get(ClientCallFuture.java:119)
    at com.hazelcast.client.txn.proxy.ClientTxnProxy.invoke(ClientTxnProxy.java:52)
    at com.hazelcast.client.txn.proxy.ClientTxnMapProxy.get(ClientTxnMapProxy.java:50)
    at com.myproject.security.sessionmanager.HazelcastTransactionalCacheManager.get(HazelcastTransactionalCacheManager.java:41)
    at com.myproject.security.sessionmanager.HazelcastSessionStorageManager.getSession(HazelcastSessionStorageManager.java:46)
    at com.myproject.security.sessionmanager.HazelcastSessionManager$3.execute(HazelcastSessionManager.java:105)
    at com.myproject.security.sessionmanager.HazelcastSessionManager$3.execute(HazelcastSessionManager.java:101)
    at com.hazelcast.client.txn.ClientTransactionManager.executeTransaction(ClientTransactionManager.java:83)
    at com.hazelcast.client.txn.ClientTransactionManager.executeTransaction(ClientTransactionManager.java:76)
    at com.hazelcast.client.impl.HazelcastClientInstanceImpl.executeTransaction(HazelcastClientInstanceImpl.java:291)
    at com.hazelcast.client.impl.HazelcastClientProxy.executeTransaction(HazelcastClientProxy.java:147)
    at com.myproject.security.sessionmanager.HazelcastSessionManager.getSession(HazelcastSessionManager.java:101)
    at com.myproject.security.authentication.MyAuthenticationProvider.authenticate(MyAuthenticationProvider.java:43)
    at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:156)
    at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:177)
    at org.springframework.security.access.intercept.AbstractSecurityInterceptor.authenticateIfRequired(AbstractSecurityInterceptor.java:316)
    at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:202)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:115)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at com.myproject.security.authentication.AuthenticationTokenProcessingFilter.doFilter(AuthenticationTokenProcessingFilter.java:24)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at com.myproject.infra.security.MyExceptionHandlerFilter.doFilter(MyExceptionHandlerFilter.java:35)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:610)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ClassNotFoundException: com.myproject.security.common.entity.session.Session
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at com.hazelcast.nio.ClassLoaderUtil.tryLoadClass(ClassLoaderUtil.java:124)
    at com.hazelcast.nio.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:113)
    at com.hazelcast.nio.IOUtil$1.resolveClass(IOUtil.java:113)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1612)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1517)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
    at com.hazelcast.nio.serialization.DefaultSerializers$ObjectSerializer.read(DefaultSerializers.java:196)
    at com.hazelcast.nio.serialization.StreamSerializerAdapter.toObject(StreamSerializerAdapter.java:65)
    at com.hazelcast.nio.serialization.SerializationServiceImpl.toObject(SerializationServiceImpl.java:260)
    at com.hazelcast.spi.impl.NodeEngineImpl.toObject(NodeEngineImpl.java:186)
    at com.hazelcast.spi.impl.BasicInvocationFuture.resolveApplicationResponse(BasicInvocationFuture.java:361)
    at com.hazelcast.spi.impl.BasicInvocationFuture.resolveApplicationResponseOrThrowException(BasicInvocationFuture.java:320)
    at com.hazelcast.spi.impl.BasicInvocationFuture.get(BasicInvocationFuture.java:194)
    at com.hazelcast.spi.impl.BasicInvocationFuture.get(BasicInvocationFuture.java:173)
    at com.hazelcast.map.impl.tx.TransactionalMapProxySupport.getInternal(TransactionalMapProxySupport.java:119)
    at com.hazelcast.map.impl.tx.TransactionalMapProxy.get(TransactionalMapProxy.java:93)
    at com.hazelcast.map.impl.client.AbstractTxnMapRequest.innerCallInternal(AbstractTxnMapRequest.java:94)
    at com.hazelcast.map.impl.client.AbstractTxnMapRequest.innerCall(AbstractTxnMapRequest.java:83)
    at com.hazelcast.transaction.client.BaseTransactionRequest.call(BaseTransactionRequest.java:40)
    at com.hazelcast.client.impl.client.CallableClientRequest.process(CallableClientRequest.java:29)
    at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.processRequest(ClientEngineImpl.java:434)
    at com.hazelcast.client.impl.ClientEngineImpl$ClientPacketProcessor.run(ClientEngineImpl.java:353)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
    at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:76)
    at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:92)
@seyfullahdemir

This comment has been minimized.

Copy link
Author

commented Apr 2, 2015

I couldn't attach it as a text file, sorry for bad visualization.
I think I closed the issue by mistake, by the way.

@seyfullahdemir seyfullahdemir reopened this Apr 2, 2015

@Donnerbart

This comment has been minimized.

Copy link
Contributor

commented Apr 2, 2015

I've taken the liberty to add markdown to your comment. I also uploaded your stack trace to a gist: https://gist.github.com/Donnerbart/9c206b4ac752addb9f66 (the RAW view should be good for visualization)

@seyfullahdemir

This comment has been minimized.

Copy link
Author

commented Apr 2, 2015

Yeah, thanks! :)

@seyfullahdemir

This comment has been minimized.

Copy link
Author

commented Apr 2, 2015

I am using default Java Serialization method by the way, do you think using Hazelcast's other serialization methods (DataSerializable, IdentifiedDataSerializable, Portable) or any other custom serialization methods and configuring Hazelcast Client to use that serialization method makes any change?

Edit: I tried using custom serializers for my entities using Kryo API (using this guide http://blog.hazelcast.com/2013/06/13/updated-comparing-hazelcast-3-serialization-methods-with-kryo-serialization-and-jackson-smile/). I configured Hazelcast Client to use these custom serializers. When I tried to run, I get "com.hazelcast.nio.serialization.HazelcastSerializationException: There is no suitable de-serializer for type 1". The problem then transforms into "hazelcast cluster could not find any suitable custom serializer" I think. Hazelcast cluster still needs to know how to deserialize them (rather than entities). I think my experiment ended up with Sancar's comment below.

@sancar

This comment has been minimized.

Copy link
Member

commented Apr 2, 2015

Hi Seyfullah,
Normally client objects are not deserialised in cluster side in hazelcast. There is a few exceptions to that. One of them happens to be Transaction related API unfortunately. We have plan to change and review these parts but it is not soon. If you use hazelcast IdentifiedDataSerializable by implementing a corresponding class extending IdentifiedDataSerializable for CustomEntity(and other inner classes of that) . And configure the Serialization accordingly on BOTH server and client, then it should work. Of course adding the jar to server side is the easiest solution, but you are saying that it is not applicable to your use case. By trying to implement new classes implementing IdentifiedDataSerilizable for your classes, you may end up having to import customEntity.jar anyway.

Related doc for IdentifiedDataSerializable http://docs.hazelcast.org/docs/3.4/manual/html-single/hazelcast-documentation.html#identifieddataserializable

@seyfullahdemir

This comment has been minimized.

Copy link
Author

commented Apr 2, 2015

Thanks for the information, Sancar. I felt sad to read that :) One other exceptional case for cluster side deserialization is entry eviction, right? I have the same problem for eviction.

The issue is marked to be resolved in 3.4.3 release as far as I understand. But you said the change is not going to come soon. Should I wait for a proper implementation or apply a workaround. Actually, another possible workaround solution (rather than adding entity jar to classpath) came to my mind but I am not sure if it is applicable. Although the documents say ("It isn’t possible to access a transactional data-structure without a transaction. If that happens an IllegalStateException is thrown."), I managed to get the entries in TransactionalMap, by using IMap interface for the same map and calling get for entry on it (like. hazelcastClient.getMap("transactionalMap").get("entryKey")). What do you think about this workaround?

Edit: By the way, I may be wrong for the issue of reaching the entries in TransactionalMap using IMap interface. I checked again my usage and saw that I am able to get the whole entrySet, not for a single entry. It may differ when trying to get a single entry.

Thanks.

@sancar sancar modified the milestones: Backlog, 3.4.3 Apr 2, 2015

@sancar

This comment has been minimized.

Copy link
Member

commented Apr 2, 2015

First of all, I don't think it will be resolved for 3.4.3 which is actually very close. Closest that we can hope to plan is 3.6 which is at least 4 months. But we need to discuss internally. I updated the milestone accordingly.

The documentation means you cant access TransactionalMap.get outside of transaction. The data itself is accessible through IMap. The way that you access the data is actually an expected use case.

@seyfullahdemir

This comment has been minimized.

Copy link
Author

commented Apr 2, 2015

I changed my code so that the get() and contains() calls to maps are done using IMap interface. Everything went well except calling a put call for an existing entry. When I do that call, it throws the same Deserialization exception again. Maybe it happens because put method for existing entry does an internal reading operation?

I'm also sharing a dummy code that may help you better realize the issue.
https://gist.github.com/seyfullahdemir/3520121fc38811ed0c48

@Donnerbart

This comment has been minimized.

Copy link
Contributor

commented Apr 2, 2015

You can try the IMap.set() method. I'm a bit in a hurry, so I couldn't look at the code if this works without serialization. But it is faster (from the JavaDoc):

Puts an entry into this map.Similar to put operation except that set doesn't return the old value which is more efficient.

@seyfullahdemir

This comment has been minimized.

Copy link
Author

commented Apr 3, 2015

I tried TransactionalMap.set instead of TransactionalMap.put, and it successfully works for both non-existing and existing entry case.

One last problem: When I tried removing entry case, similiar to TransactionalMap.put, both TransactionalMap.remove and TransactionalMap.delete makes internal read operation and throws the evil exception too. How can I deal with this removing case?

Thanks.

@seyfullahdemir

This comment has been minimized.

Copy link
Author

commented Apr 3, 2015

I think the removing case is where we get stuck again. Independent from this problem I want to ask using IMap (for reading operations) and TransactionalMap (for writing operations) together in concurrent Transactional Tasks (I gave an example code below) whether or not cause race problems, breaks Repeatable Read guarentee or cause any other problems related to locking entries.

public void storeSentenceWithWordFrequencies(final String key, final Sentence sentence) {

        final HazelcastInstance hazelcastClient = hazelcastClientFactory.getHazelcastClient();

        hazelcastClient.executeTransaction(new TransactionalTask() {
            @Override
            public Object execute(final TransactionalTaskContext context) throws TransactionException {
                final TransactionalMap<String, Sentence> sentences = context.getMap("sentences");
                final TransactionalMap<String, WordFrequency> wordFrequencies = context.getMap("wordFrequencies");
                final IMap<String, WordFrequency> wordFrequenciesAsMap = hazelcastClient.getMap("wordFrequencies");

                sentences.set(key, sentence);

                final String[] words = sentence.getContent().split(" ");
                for (final String word : words) {

                    if(! wordFrequenciesAsMap.containsKey(word)){
                        wordFrequencies.set(word, new WordFrequency(1));
                    } else{
                        final WordFrequency wordFrequency = wordFrequenciesAsMap.get(word);
                        wordFrequency.increaseFrequency();
                        wordFrequencies.set(word, wordFrequency);
                    }

                }

                return null;
            }
        });
    }
@seyfullahdemir

This comment has been minimized.

Copy link
Author

commented Jan 13, 2016

Is there any plan for which release this issue will be fixed?
I mean the issue of "starting not to deserialize client objects in cluster side for exceptional cases like transaction related API"

@gurbuzali gurbuzali modified the milestones: 3.7, Backlog Jan 14, 2016

@balisbalis

This comment has been minimized.

Copy link

commented Apr 27, 2016

The problem at the first of message of this thread is what I am currently experiencing.
The hazelcast version that I am using is 3.5.5, and when I tried to do the following:
myTransactionMap.get(myKey)
It gives the exception:

No DataSerializerFactory registered for namespace: 1.

Then I updated hazelcast version with 3.6.2 on pom.xml, and now the following line gives the folliowing exception.

hazelcastClient = HazelcastClient.newHazelcastClient();

WARNING: Execution of callback: com.hazelcast.client.connection.nio.ClientConnectionManagerImpl$2@23f7d05d is rejected!
java.util.concurrent.RejectedExecutionException: Internal executor rejected task: java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@23986957, because client is shutting down...
at com.hazelcast.client.spi.impl.ClientExecutionServiceImpl$1.rejectedExecution(ClientExecutionServiceImpl.java:56)
at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:823)
at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:326)
at java.util.concurrent.ScheduledThreadPoolExecutor.schedule(ScheduledThreadPoolExecutor.java:533)
at java.util.concurrent.ScheduledThreadPoolExecutor.execute(ScheduledThreadPoolExecutor.java:622)
at com.hazelcast.client.spi.impl.ClientInvocationFuture.runAsynchronous(ClientInvocationFuture.java:167)
at com.hazelcast.client.spi.impl.ClientInvocationFuture.setResponse(ClientInvocationFuture.java:120)
at com.hazelcast.client.spi.impl.ClientInvocation.notifyException(ClientInvocation.java:177)
at com.hazelcast.client.spi.impl.ClientInvocationServiceSupport.shutdown(ClientInvocationServiceSupport.java:175)
at com.hazelcast.client.spi.impl.ClientSmartInvocationServiceImpl.shutdown(ClientSmartInvocationServiceImpl.java:30)
at com.hazelcast.client.impl.HazelcastClientInstanceImpl.doShutdown(HazelcastClientInstanceImpl.java:590)
at com.hazelcast.client.impl.LifecycleServiceImpl.shutdown(LifecycleServiceImpl.java:108)
at com.hazelcast.client.impl.HazelcastClientInstanceImpl.start(HazelcastClientInstanceImpl.java:309)
at com.hazelcast.client.HazelcastClient.newHazelcastClient(HazelcastClient.java:86)
at com.hazelcast.client.HazelcastClient.newHazelcastClient(HazelcastClient.java:71)
at Main_2.main(Main_2.java:25)
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:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

Apr 27, 2016 1:40:55 PM com.hazelcast.core.LifecycleService
INFO: HazelcastClient[hz.client_0_dev][3.6.2] is SHUTDOWN
Exception in thread "main" java.lang.IllegalStateException: Unable to connect to any address in the config! The following addresses were tried:[/127.0.0.1:5701]
at com.hazelcast.client.spi.impl.ClusterListenerSupport.connectToCluster(ClusterListenerSupport.java:174)
at com.hazelcast.client.spi.impl.ClientClusterServiceImpl.start(ClientClusterServiceImpl.java:196)
at com.hazelcast.client.impl.HazelcastClientInstanceImpl.start(HazelcastClientInstanceImpl.java:307)
at com.hazelcast.client.HazelcastClient.newHazelcastClient(HazelcastClient.java:86)
at com.hazelcast.client.HazelcastClient.newHazelcastClient(HazelcastClient.java:71)
at Main_2.main(Main_2.java:25)
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:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

It looks like something much more primitive. I googled about it but could not find out what I should do to fix this new issue that comes with the version 3.6.2. Do you guys have any suggestion for this issue?

@balisbalis

This comment has been minimized.

Copy link

commented Apr 27, 2016

Above the issue I mentioned at the end of the post is fixed when I updated the server running on my local.

But the very first message of this thread is still a valid problem.

@jerrinot

This comment has been minimized.

Copy link
Contributor

commented Apr 27, 2016

@barisalispeak: can you try it with 3.7-SNAPSHOT? thanks!

@balisbalis

This comment has been minimized.

Copy link

commented Apr 27, 2016

When I tried with 3.7-SNAPSHOT version, I got the exception mentioned below. @jerrinot

Apr 27, 2016 6:21:54 PM com.hazelcast.core.LifecycleService
INFO: hz.client_0 [dev] [3.7-SNAPSHOT] HazelcastClient 3.7-SNAPSHOT (20160426 - 68341c3) is CLIENT_CONNECTED
Exception in thread "main" com.hazelcast.nio.serialization.HazelcastSerializationException: No DataSerializerFactory registered for namespace: 1
at com.hazelcast.internal.serialization.impl.DataSerializer.read(DataSerializer.java:108)
at com.hazelcast.internal.serialization.impl.DataSerializer.read(DataSerializer.java:47)
at com.hazelcast.internal.serialization.impl.StreamSerializerAdapter.read(StreamSerializerAdapter.java:46)
at com.hazelcast.internal.serialization.impl.AbstractSerializationService.toObject(AbstractSerializationService.java:170)
at com.hazelcast.spi.impl.NodeEngineImpl.toObject(NodeEngineImpl.java:234)
at com.hazelcast.spi.impl.operationservice.impl.InvocationFuture.resolveApplicationResponse(InvocationFuture.java:376)
at com.hazelcast.spi.impl.operationservice.impl.InvocationFuture.resolveApplicationResponseOrThrowException(InvocationFuture.java:335)
at com.hazelcast.spi.impl.operationservice.impl.InvocationFuture.get(InvocationFuture.java:223)
at com.hazelcast.spi.impl.operationservice.impl.InvocationFuture.get(InvocationFuture.java:202)
at com.hazelcast.map.impl.tx.TransactionalMapProxySupport.getInternal(TransactionalMapProxySupport.java:110)
at com.hazelcast.map.impl.tx.TransactionalMapProxy.get(TransactionalMapProxy.java:109)
at com.hazelcast.client.impl.protocol.task.transactionalmap.TransactionalMapGetMessageTask.innerCall(TransactionalMapGetMessageTask.java:43)
at com.hazelcast.client.impl.protocol.task.AbstractTransactionalMessageTask.call(AbstractTransactionalMessageTask.java:34)
at com.hazelcast.client.impl.protocol.task.AbstractCallableMessageTask.processMessage(AbstractCallableMessageTask.java:34)
at com.hazelcast.client.impl.protocol.task.AbstractMessageTask.initializeAndProcessMessage(AbstractMessageTask.java:118)
at com.hazelcast.client.impl.protocol.task.AbstractMessageTask.run(AbstractMessageTask.java:98)
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)
at ------ submitted from ------.(Unknown Source)
at com.hazelcast.client.spi.impl.ClientInvocationFuture.resolveAndThrow(ClientInvocationFuture.java:74)
at com.hazelcast.client.spi.impl.ClientInvocationFuture.resolveAndThrow(ClientInvocationFuture.java:30)
at com.hazelcast.spi.impl.AbstractInvocationFuture.get(AbstractInvocationFuture.java:158)
at com.hazelcast.client.proxy.txn.ClientTxnProxy.invoke(ClientTxnProxy.java:49)
at com.hazelcast.client.proxy.txn.ClientTxnMapProxy.get(ClientTxnMapProxy.java:77)
at customObjectExample.Main_2.setUserLevelViaTransaction(Main_2.java:90)
at customObjectExample.Main_2.gogogo(Main_2.java:40)
at customObjectExample.Main_2.main(Main_2.java:30)
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:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

@balisbalis

This comment has been minimized.

Copy link

commented Apr 27, 2016

Also maven can not resolve this version when I build via maven. @jerrinot

 <dependency>
             <groupId>com.hazelcast</groupId>
             <artifactId>hazelcast-all</artifactId>
             <version>3.7-SNAPSHOT</version>
 </dependency>
@jerrinot

This comment has been minimized.

Copy link
Contributor

commented Apr 27, 2016

@barisalispeak: do you have both server and client on 3.7-SNAPSHOT?
what revision you are using on the server? it should be in a server log when it's starting.

@balisbalis

This comment has been minimized.

Copy link

commented Apr 27, 2016

No, I am using the server.sh file from the TAR you are sharing on your official web-site. So it is version 3.6.2 for now. @jerrinot

@jerrinot

This comment has been minimized.

Copy link
Contributor

commented Apr 27, 2016

@barisalispeak: I see. can you try it with 3.7-SNAPSHOT server? it should be fixed by #7382
The fix is on a server-side though.

@balisbalis

This comment has been minimized.

Copy link

commented Apr 27, 2016

Thanks @jerrinot , it looks fine with 3.7-SNAPSHOT.
Tomorrow I will make a load test on shared data in order to see whether it is perfectly consistent or not.

@Donnerbart

This comment has been minimized.

Copy link
Contributor

commented Apr 27, 2016

You should be able to use 3.7-SNAPSHOT with Maven by adding our Snapshot repository to your pom.xml:

    <repositories>
        <repository>
            <id>snapshot-repository</id>
            <name>Maven2 Snapshot Repository</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </repository>
    </repositories>
@jerrinot

This comment has been minimized.

Copy link
Contributor

commented Apr 27, 2016

@barisalispeak: thanks for heads-up. I'll keep this issue open and will wait for your confirmation.

@balisbalis

This comment has been minimized.

Copy link

commented Apr 28, 2016

Now it works promising. Thank you @jerrinot @Donnerbart

@jerrinot

This comment has been minimized.

Copy link
Contributor

commented Apr 29, 2016

@barisalispeak: that's great to hear! Many thanks for confirmation.
I'm closing this issue.

@jerrinot jerrinot closed this Apr 29, 2016

@jerrinot

This comment has been minimized.

Copy link
Contributor

commented Apr 29, 2016

fixed by #7382

@seyfullahdemir

This comment has been minimized.

Copy link
Author

commented May 16, 2016

Thanks for the support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.