colorzhang / hybris

hybris gist by winston
67 stars 45 forks source link

java.lang.ClassNotFoundException: de.hybris.platform.acceleratorstorefrontcommons.history.impl.DefaultBrowseHistory$InstanceWrapper #3

Open igor-sokolov opened 7 years ago

igor-sokolov commented 7 years ago

Hi there,

I was interested in the topic you spent time to investigate, I did as you described here: https://github.com/colorzhang/hybris/blob/master/Setup%20a%20multi-nodes%20hybris%20cluster%20with%20centralized%20session%20persistence%20on%20Redis.md however I get an exception during deserialization by Spring Data Redis:

SEVERE: Servlet.service() for servlet [DispatcherServlet] in context with path [/yacceleratorstorefront] threw exception org.springframework.data.redis.serializer.SerializationException: Cannot deserialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to deserialize payload. Is the byte array a result of corresponding serialization for DefaultDeserializer?; nested exception is org.springframework.core.NestedIOException: Failed to deserialize object type; nested exception is java.lang.ClassNotFoundException: de.hybris.platform.acceleratorstorefrontcommons.history.impl.DefaultBrowseHistory$InstanceWrapper at org.springframework.data.redis.serializer.JdkSerializationRedisSerializer.deserialize(JdkSerializationRedisSerializer.java:81) at org.springframework.data.redis.core.AbstractOperations.deserializeHashValue(AbstractOperations.java:335) at org.springframework.data.redis.core.AbstractOperations.deserializeHashMap(AbstractOperations.java:279) at org.springframework.data.redis.core.DefaultHashOperations.entries(DefaultHashOperations.java:227) at org.springframework.data.redis.core.DefaultBoundHashOperations.entries(DefaultBoundHashOperations.java:102) at org.springframework.session.data.redis.RedisOperationsSessionRepository.getSession(RedisOperationsSessionRepository.java:432) at org.springframework.session.data.redis.RedisOperationsSessionRepository.getSession(RedisOperationsSessionRepository.java:402) at org.springframework.session.data.redis.RedisOperationsSessionRepository.getSession(RedisOperationsSessionRepository.java:245) at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.getSession(SessionRepositoryFilter.java:326) at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.getSession(SessionRepositoryFilter.java:343) at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.getSession(SessionRepositoryFilter.java:389) at org.springframework.session.web.http.SessionRepositoryFilter$SessionRepositoryRequestWrapper.getSession(SessionRepositoryFilter.java:214) at javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:238) at de.hybris.platform.servicelayer.web.AbstractPlatformFilterChain.doFilterInternal(AbstractPlatformFilterChain.java:148) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at de.hybris.platform.yacceleratorstorefront.filters.UrlPathFilter.doFilterInternal(UrlPathFilter.java:85) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 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.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at de.hybris.platform.yacceleratorstorefront.filters.AcceleratorAddOnFilter.doFilter(AcceleratorAddOnFilter.java:92) 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 de.hybris.platform.servicelayer.web.XSSFilter.doFilter(XSSFilter.java:230) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:164) at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:80) 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.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

I'm wondering if you had the same issue and if yes how you resolved it?

I tried hybris 5.7, 6.0 and 6.1. 6.0 and 6.1 I get another exception that DefaultBrowseHistory$InstanceWrapper is no serializable which I fixed quickly adding Serializable marker interface however then I start getting the same error with No class found.

Thank you in advance.

colorzhang commented 7 years ago

There is a classloader issue during deserialize in Spring before 4.2. You need to fix it manually.

igor-sokolov commented 7 years ago

Hi colorzhang,

Thank you. I found the cause of the issue and fixed however now I see another but significant worse problem. As I understand Spring Session expects to have in session stored only immutable objects, which makes sense according to best practices. (there is a thread about that on github: https://github.com/spring-projects/spring-session/issues/177). But JaloSession is definitely not a nice immutable object, but huge and tricky mutable (separate cart reference, cart pks, tenants references etc.) as a result spring session doesn't notice any changes in hybris session attributes. So my question to you: can you please share how you solved this problem?

Thank you.

igor-sokolov commented 7 years ago

Never mind. I found the a simple solution, hybris has session.replication.support flag to remove/add each time JaloSession to HTTP Session. It is extremely not optimal and can lead to potential performance issue if we decide fully remove sticky session but at least it works.

Also I found that I have to fix 6.X another issue related to mutex object placed to session by new promotion engine.

colorzhang commented 7 years ago

That's great. Some issues have been fixed in 6.2. You can have a look the release notes.

maqdev commented 7 years ago

Hi there! Could you please provide more details regarding class loader issue in spring?

colorzhang commented 7 years ago

https://jira.spring.io/browse/SPR-13409 https://jira.spring.io/browse/DATAREDIS-427

koppulapr commented 7 years ago

I still have the problem even with hybris version 6.3, i am seeing errors during serialization of jalosession, and also what is the class that has to be patched in the promotionsengine. Could you please let us know what changes have to be made.

deejvince commented 7 years ago

Hi, Anyone has a prescriptive solution for serialization issues with this solution?

priyankanandagopal commented 5 years ago

Hi..Can anyone provide details of resolution if it is fixed already?