ZK with Spring Session jdbc throws: Unable to serialize entry - spring

We have an aplication based on ZK with Spring Boot / Spring Security / JPA implementation running in Google Cloud Run, within a docker. It works quite fine with non jdbc persistent sessions. Google is probably sending the requests with the same JSESSION_ID to same server of the server pool.
Unfortunatelly, too often the aplication closes and the user has to relogin, probably when the server previously answering the requests is shutdown or becomes too busy and Google decides to change the destination server.
Our idea to improve usability was to implement the Spring persistent session which is very easy to implement. It is just about adding in the Pom :
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-jdbc</artifactId>
</dependency>
and the .properties :
spring.session.store-type=jdbc
spring.session.jdbc.initialize-schema=ALWAYS
The table for holding the session data is created, the server starts, but when trying to load the login page we get the following error :
2022-01-04 16:50:19.395 INFO 15092 --- [nio-8443-exec-4] o.z.util.resource.impl.LabelLoaderImpl : Loading labels for es
2022-01-04 16:50:19.396 INFO 15092 --- [nio-8443-exec-4] o.z.util.resource.impl.LabelLoaderImpl : Opening file:/C:/gitlab/hov2-springboot/target/classes/metainfo/zk-label_es.properties
2022-01-04 16:50:19.399 INFO 15092 --- [nio-8443-exec-4] o.z.util.resource.impl.LabelLoaderImpl : Opening file:/C:/gitlab/hov2-springboot/target/classes/metainfo/zk-label.properties
2022-01-04 16:50:19.615 ERROR 15092 --- [nio-8443-exec-4] org.zkoss.io.serializable : Unable to serialize entry: $composer=org.zkoss.bind.BindComposer#45f1b067
2022-01-04 16:50:19.718 ERROR 15092 --- [nio-8443-exec-4] o.a.c.c.C.[.[.[/V2].[auEngine] : Servlet.service() for servlet [auEngine] threw exception
org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.Object] to type [byte[]] for value 'org.zkoss.zk.ui.http.SerializableSession#1f9bd946'; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException
This error looks like this is one of the ZK framework object that is not serializable, I double checked that all the session data is serializable and did not find any thing wrong on that side.
I can add here some config files in this post, but i basically followed the instruccions from :
https://www.zkoss.org/wiki/ZK_Installation_Guide/Setting_up_Servers/Google_App_Engine
Any help to succeed implementing the Spring Session store with ZK is welcome !
This is a "org.zkoss.bind.BindComposer" Object that fails to serialize any idea why ?
as per very good Hawk idea, here is the log with the detailed error log :
2022-01-05 12:45:20.410 ERROR 27596 --- [nio-8443-exec-4] org.zkoss.io.serializable : Unable to serialize entry: $composer=org.zkoss.bind.BindComposer#38cc879f
2022-01-05 12:45:20.508 ERROR 27596 --- [nio-8443-exec-4] o.a.c.c.C.[.[.[/V2].[auEngine] : Servlet.service() for servlet [auEngine] threw exception
org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.Object] to type [byte[]] for value 'org.zkoss.zk.ui.http.SerializableSession#7f4fb979'; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor
- field (class "org.springframework.aop.support.AbstractGenericPointcutAdvisor", name: "advice", type: "interface org.aopalliance.aop.Advice")
- object (class "org.springframework.aop.support.DefaultPointcutAdvisor", org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor#586a49e8])
- custom writeObject data (class "java.util.ArrayList")
- object (class "java.util.ArrayList", [org.springframework.aop.interceptor.ExposeInvocationInterceptor.ADVISOR, org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor#586a49e8], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.dao.support.PersistenceExceptionTranslationInterceptor#5f18770], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.transaction.interceptor.TransactionInterceptor#6aa74b32], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor#64eec21d], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor#6ec1e261], org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor#18709cb2])
- field (class "org.springframework.aop.framework.AdvisedSupport", name: "advisors", type: "interface java.util.List")
- object (class "org.springframework.aop.framework.ProxyFactory", org.springframework.aop.framework.ProxyFactory: 3 interfaces [com.vyv.hov2.repository.ConfRepository, org.springframework.data.repository.Repository, org.springframework.transaction.interceptor.TransactionalProxy]; 7 advisors [org.springframework.aop.interceptor.ExposeInvocationInterceptor.ADVISOR, org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor#586a49e8], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.dao.support.PersistenceExceptionTranslationInterceptor#5f18770], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.transaction.interceptor.TransactionInterceptor#6aa74b32], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor#64eec21d], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor#6ec1e261], org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor#18709cb2]; targetSource [SingletonTargetSource for target object [com.vyv.hov2.repository.CustomRepositoryImpl#776682b]]; proxyTargetClass=false; optimize=false; opaque=false; exposeProxy=false; frozen=false)
- field (class "org.springframework.aop.framework.JdkDynamicAopProxy", name: "advised", type: "class org.springframework.aop.framework.AdvisedSupport")
- object (class "org.springframework.aop.framework.JdkDynamicAopProxy", org.springframework.aop.framework.JdkDynamicAopProxy#88477f8a)
- field (class "java.lang.reflect.Proxy", name: "h", type: "interface java.lang.reflect.InvocationHandler")
- object (class "com.sun.proxy.$Proxy170", com.vyv.hov2.repository.CustomRepositoryImpl#776682b)
- field (class "com.vyv.hov2.business.impl.ConfBusinessImpl", name: "confRepository", type: "interface com.vyv.hov2.repository.ConfRepository")
- object (class "com.vyv.hov2.business.impl.ConfBusinessImpl", com.vyv.hov2.business.impl.ConfBusinessImpl#6f377b1f)
- field (class "org.springframework.aop.target.SingletonTargetSource", name: "target", type: "class java.lang.Object")
- object (class "org.springframework.aop.target.SingletonTargetSource", SingletonTargetSource for target object [com.vyv.hov2.business.impl.ConfBusinessImpl#6f377b1f])
- field (class "org.springframework.aop.framework.AdvisedSupport", name: "targetSource", type: "interface org.springframework.aop.TargetSource")
- object (class "org.springframework.aop.framework.ProxyFactory", org.springframework.aop.framework.ProxyFactory: 0 interfaces []; 1 advisors [org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor: advice org.springframework.transaction.interceptor.TransactionInterceptor#4f64d9cb]; targetSource [SingletonTargetSource for target object [com.vyv.hov2.business.impl.ConfBusinessImpl#6f377b1f]]; proxyTargetClass=true; optimize=false; opaque=false; exposeProxy=false; frozen=false)
- field (class "org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor", name: "advised", type: "class org.springframework.aop.framework.AdvisedSupport")
- object (class "org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor", org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor#2b88fa68)
- field (class "com.vyv.hov2.business.impl.ConfBusinessImpl$$EnhancerBySpringCGLIB$$1da6c3fa", name: "CGLIB$CALLBACK_0", type: "interface org.springframework.cglib.proxy.MethodInterceptor")
- object (class "com.vyv.hov2.business.impl.ConfBusinessImpl$$EnhancerBySpringCGLIB$$1da6c3fa", com.vyv.hov2.business.impl.ConfBusinessImpl#6f377b1f)
- field (class "com.vyv.hov2.viewModel.LoginViewModel", name: "confB", type: "interface com.vyv.hov2.business.ConfBusiness")
- object (class "com.vyv.hov2.viewModel.LoginViewModel", com.vyv.hov2.viewModel.LoginViewModel#15d2453)
- field (class "org.zkoss.bind.BindComposer", name: "_viewModel", type: "class java.lang.Object")
- object (class "org.zkoss.bind.BindComposer", org.zkoss.bind.BindComposer#38cc879f)
- custom writeObject data (class "org.zkoss.zk.ui.AbstractComponent")
- object (class "org.zkoss.zul.Window", <Window yH5Q0#win>)
- custom writeObject data (class "org.zkoss.zk.ui.AbstractPage")
- object (class "org.zkoss.zk.ui.impl.PageImpl", [Page yH5Q_])
- custom writeObject data (class "java.util.LinkedList")
- object (class "java.util.LinkedList", [[Page yH5Q_]])
- field (class "org.zkoss.zk.ui.impl.DesktopImpl", name: "_pages", type: "interface java.util.List")
- custom writeObject data (class "org.zkoss.zk.ui.impl.DesktopImpl")
- object (class "org.zkoss.zk.ui.impl.DesktopImpl", [Desktop z_Jbfu8exW9haA_LuuwzUJCQ:/zul/login.zul])
- field (class "org.zkoss.util.CacheMap$Value", name: "value", type: "class java.lang.Object")
- object (class "org.zkoss.util.CacheMap$Value", ([Desktop z_Jbfu8exW9haA_LuuwzUJCQ:/zul/login.zul]#1641404719684))
- custom writeObject data (class "java.util.HashMap")
- object (class "java.util.LinkedHashMap", {z_Jbfu8exW9haA_LuuwzUJCQ=([Desktop z_Jbfu8exW9haA_LuuwzUJCQ:/zul/login.zul]#1641404719684)})
- field (class "org.zkoss.util.CacheMap", name: "_map", type: "interface java.util.Map")
- custom writeObject data (class "org.zkoss.util.CacheMap")
- object (class "org.zkoss.zk.ui.impl.SimpleDesktopCache$Cache", {z_Jbfu8exW9haA_LuuwzUJCQ=[Desktop z_Jbfu8exW9haA_LuuwzUJCQ:/zul/login.zul]})
- field (class "org.zkoss.zk.ui.impl.SimpleDesktopCache", name: "_desktops", type: "class org.zkoss.zk.ui.impl.SimpleDesktopCache$Cache")
- object (class "org.zkoss.zk.ui.impl.SimpleDesktopCache", org.zkoss.zk.ui.impl.SimpleDesktopCache#8570f71)
- custom writeObject data (class "org.zkoss.zk.ui.http.SerializableSession")
- root object (class "org.zkoss.zk.ui.http.SerializableSession", org.zkoss.zk.ui.http.SerializableSession#7f4fb979)
at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:47)
Caused by: org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor
- field (class "org.springframework.aop.support.AbstractGenericPointcutAdvisor", name: "advice", type: "interface org.aopalliance.aop.Advice")
- object (class "org.springframework.aop.support.DefaultPointcutAdvisor", org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor#586a49e8])
- custom writeObject data (class "java.util.ArrayList")
- object (class "java.util.ArrayList", [org.springframework.aop.interceptor.ExposeInvocationInterceptor.ADVISOR, org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor#586a49e8], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.dao.support.PersistenceExceptionTranslationInterceptor#5f18770], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.transaction.interceptor.TransactionInterceptor#6aa74b32], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor#64eec21d], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor#6ec1e261], org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor#18709cb2])
- field (class "org.springframework.aop.framework.AdvisedSupport", name: "advisors", type: "interface java.util.List")
- object (class "org.springframework.aop.framework.ProxyFactory", org.springframework.aop.framework.ProxyFactory: 3 interfaces [com.vyv.hov2.repository.ConfRepository, org.springframework.data.repository.Repository, org.springframework.transaction.interceptor.TransactionalProxy]; 7 advisors [org.springframework.aop.interceptor.ExposeInvocationInterceptor.ADVISOR, org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor#586a49e8], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.dao.support.PersistenceExceptionTranslationInterceptor#5f18770], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.transaction.interceptor.TransactionInterceptor#6aa74b32], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor#64eec21d], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor#6ec1e261], org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor#18709cb2]; targetSource [SingletonTargetSource for target object [com.vyv.hov2.repository.CustomRepositoryImpl#776682b]]; proxyTargetClass=false; optimize=false; opaque=false; exposeProxy=false; frozen=false)
- field (class "org.springframework.aop.framework.JdkDynamicAopProxy", name: "advised", type: "class org.springframework.aop.framework.AdvisedSupport")
- object (class "org.springframework.aop.framework.JdkDynamicAopProxy", org.springframework.aop.framework.JdkDynamicAopProxy#88477f8a)
- field (class "java.lang.reflect.Proxy", name: "h", type: "interface java.lang.reflect.InvocationHandler")
- object (class "com.sun.proxy.$Proxy170", com.vyv.hov2.repository.CustomRepositoryImpl#776682b)
- field (class "com.vyv.hov2.business.impl.ConfBusinessImpl", name: "confRepository", type: "interface com.vyv.hov2.repository.ConfRepository")
- object (class "com.vyv.hov2.business.impl.ConfBusinessImpl", com.vyv.hov2.business.impl.ConfBusinessImpl#6f377b1f)
- field (class "org.springframework.aop.target.SingletonTargetSource", name: "target", type: "class java.lang.Object")
- object (class "org.springframework.aop.target.SingletonTargetSource", SingletonTargetSource for target object [com.vyv.hov2.business.impl.ConfBusinessImpl#6f377b1f])
- field (class "org.springframework.aop.framework.AdvisedSupport", name: "targetSource", type: "interface org.springframework.aop.TargetSource")
- object (class "org.springframework.aop.framework.ProxyFactory", org.springframework.aop.framework.ProxyFactory: 0 interfaces []; 1 advisors [org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor: advice org.springframework.transaction.interceptor.TransactionInterceptor#4f64d9cb]; targetSource [SingletonTargetSource for target object [com.vyv.hov2.business.impl.ConfBusinessImpl#6f377b1f]]; proxyTargetClass=true; optimize=false; opaque=false; exposeProxy=false; frozen=false)
- field (class "org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor", name: "advised", type: "class org.springframework.aop.framework.AdvisedSupport")
- object (class "org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor", org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor#2b88fa68)
- field (class "com.vyv.hov2.business.impl.ConfBusinessImpl$$EnhancerBySpringCGLIB$$1da6c3fa", name: "CGLIB$CALLBACK_0", type: "interface org.springframework.cglib.proxy.MethodInterceptor")
- object (class "com.vyv.hov2.business.impl.ConfBusinessImpl$$EnhancerBySpringCGLIB$$1da6c3fa", com.vyv.hov2.business.impl.ConfBusinessImpl#6f377b1f)
- field (class "com.vyv.hov2.viewModel.LoginViewModel", name: "confB", type: "interface com.vyv.hov2.business.ConfBusiness")
- object (class "com.vyv.hov2.viewModel.LoginViewModel", com.vyv.hov2.viewModel.LoginViewModel#15d2453)
- field (class "org.zkoss.bind.BindComposer", name: "_viewModel", type: "class java.lang.Object")
- object (class "org.zkoss.bind.BindComposer", org.zkoss.bind.BindComposer#38cc879f)
- custom writeObject data (class "org.zkoss.zk.ui.AbstractComponent")
- object (class "org.zkoss.zul.Window", <Window yH5Q0#win>)
- custom writeObject data (class "org.zkoss.zk.ui.AbstractPage")
- object (class "org.zkoss.zk.ui.impl.PageImpl", [Page yH5Q_])
- custom writeObject data (class "java.util.LinkedList")
- object (class "java.util.LinkedList", [[Page yH5Q_]])
- field (class "org.zkoss.zk.ui.impl.DesktopImpl", name: "_pages", type: "interface java.util.List")
- custom writeObject data (class "org.zkoss.zk.ui.impl.DesktopImpl")
- object (class "org.zkoss.zk.ui.impl.DesktopImpl", [Desktop z_Jbfu8exW9haA_LuuwzUJCQ:/zul/login.zul])
- field (class "org.zkoss.util.CacheMap$Value", name: "value", type: "class java.lang.Object")
- object (class "org.zkoss.util.CacheMap$Value", ([Desktop z_Jbfu8exW9haA_LuuwzUJCQ:/zul/login.zul]#1641404719684))
- custom writeObject data (class "java.util.HashMap")
- object (class "java.util.LinkedHashMap", {z_Jbfu8exW9haA_LuuwzUJCQ=([Desktop z_Jbfu8exW9haA_LuuwzUJCQ:/zul/login.zul]#1641404719684)})
- field (class "org.zkoss.util.CacheMap", name: "_map", type: "interface java.util.Map")
- custom writeObject data (class "org.zkoss.util.CacheMap")
- object (class "org.zkoss.zk.ui.impl.SimpleDesktopCache$Cache", {z_Jbfu8exW9haA_LuuwzUJCQ=[Desktop z_Jbfu8exW9haA_LuuwzUJCQ:/zul/login.zul]})
- field (class "org.zkoss.zk.ui.impl.SimpleDesktopCache", name: "_desktops", type: "class org.zkoss.zk.ui.impl.SimpleDesktopCache$Cache")
- object (class "org.zkoss.zk.ui.impl.SimpleDesktopCache", org.zkoss.zk.ui.impl.SimpleDesktopCache#8570f71)
- custom writeObject data (class "org.zkoss.zk.ui.http.SerializableSession")
- root object (class "org.zkoss.zk.ui.http.SerializableSession", org.zkoss.zk.ui.http.SerializableSession#7f4fb979)
at org.springframework.core.serializer.support.SerializingConverter.convert(SerializingConverter.java:64)
at org.springframework.core.serializer.support.SerializingConverter.convert(SerializingConverter.java:33)
at org.springframework.core.convert.support.GenericConversionService$ConverterAdapter.convert(GenericConversionService.java:386)
at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:41)
... 155 common frames omitted
Caused by: java.io.NotSerializableException: org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor
- field (class "org.springframework.aop.support.AbstractGenericPointcutAdvisor", name: "advice", type: "interface org.aopalliance.aop.Advice")
- object (class "org.springframework.aop.support.DefaultPointcutAdvisor", org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor#586a49e8])
- custom writeObject data (class "java.util.ArrayList")
- object (class "java.util.ArrayList", [org.springframework.aop.interceptor.ExposeInvocationInterceptor.ADVISOR, org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor#586a49e8], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.dao.support.PersistenceExceptionTranslationInterceptor#5f18770], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.transaction.interceptor.TransactionInterceptor#6aa74b32], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor#64eec21d], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor#6ec1e261], org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor#18709cb2])
- field (class "org.springframework.aop.framework.AdvisedSupport", name: "advisors", type: "interface java.util.List")
- object (class "org.springframework.aop.framework.ProxyFactory", org.springframework.aop.framework.ProxyFactory: 3 interfaces [com.vyv.hov2.repository.ConfRepository, org.springframework.data.repository.Repository, org.springframework.transaction.interceptor.TransactionalProxy]; 7 advisors [org.springframework.aop.interceptor.ExposeInvocationInterceptor.ADVISOR, org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor#586a49e8], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.dao.support.PersistenceExceptionTranslationInterceptor#5f18770], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.transaction.interceptor.TransactionInterceptor#6aa74b32], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor#64eec21d], org.springframework.aop.support.DefaultPointcutAdvisor: pointcut [Pointcut.TRUE]; advice [org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor#6ec1e261], org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor#18709cb2]; targetSource [SingletonTargetSource for target object [com.vyv.hov2.repository.CustomRepositoryImpl#776682b]]; proxyTargetClass=false; optimize=false; opaque=false; exposeProxy=false; frozen=false)
- field (class "org.springframework.aop.framework.JdkDynamicAopProxy", name: "advised", type: "class org.springframework.aop.framework.AdvisedSupport")
- object (class "org.springframework.aop.framework.JdkDynamicAopProxy", org.springframework.aop.framework.JdkDynamicAopProxy#88477f8a)
- field (class "java.lang.reflect.Proxy", name: "h", type: "interface java.lang.reflect.InvocationHandler")
- object (class "com.sun.proxy.$Proxy170", com.vyv.hov2.repository.CustomRepositoryImpl#776682b)
- field (class "com.vyv.hov2.business.impl.ConfBusinessImpl", name: "confRepository", type: "interface com.vyv.hov2.repository.ConfRepository")
- object (class "com.vyv.hov2.business.impl.ConfBusinessImpl", com.vyv.hov2.business.impl.ConfBusinessImpl#6f377b1f)
- field (class "org.springframework.aop.target.SingletonTargetSource", name: "target", type: "class java.lang.Object")
- object (class "org.springframework.aop.target.SingletonTargetSource", SingletonTargetSource for target object [com.vyv.hov2.business.impl.ConfBusinessImpl#6f377b1f])
- field (class "org.springframework.aop.framework.AdvisedSupport", name: "targetSource", type: "interface org.springframework.aop.TargetSource")
- object (class "org.springframework.aop.framework.ProxyFactory", org.springframework.aop.framework.ProxyFactory: 0 interfaces []; 1 advisors [org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor: advice org.springframework.transaction.interceptor.TransactionInterceptor#4f64d9cb]; targetSource [SingletonTargetSource for target object [com.vyv.hov2.business.impl.ConfBusinessImpl#6f377b1f]]; proxyTargetClass=true; optimize=false; opaque=false; exposeProxy=false; frozen=false)
- field (class "org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor", name: "advised", type: "class org.springframework.aop.framework.AdvisedSupport")
- object (class "org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor", org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor#2b88fa68)
- field (class "com.vyv.hov2.business.impl.ConfBusinessImpl$$EnhancerBySpringCGLIB$$1da6c3fa", name: "CGLIB$CALLBACK_0", type: "interface org.springframework.cglib.proxy.MethodInterceptor")
- object (class "com.vyv.hov2.business.impl.ConfBusinessImpl$$EnhancerBySpringCGLIB$$1da6c3fa", com.vyv.hov2.business.impl.ConfBusinessImpl#6f377b1f)
- field (class "com.vyv.hov2.viewModel.LoginViewModel", name: "confB", type: "interface com.vyv.hov2.business.ConfBusiness")
- object (class "com.vyv.hov2.viewModel.LoginViewModel", com.vyv.hov2.viewModel.LoginViewModel#15d2453)
- field (class "org.zkoss.bind.BindComposer", name: "_viewModel", type: "class java.lang.Object")
- object (class "org.zkoss.bind.BindComposer", org.zkoss.bind.BindComposer#38cc879f)
- custom writeObject data (class "org.zkoss.zk.ui.AbstractComponent")
- object (class "org.zkoss.zul.Window", <Window yH5Q0#win>)
- custom writeObject data (class "org.zkoss.zk.ui.AbstractPage")
- object (class "org.zkoss.zk.ui.impl.PageImpl", [Page yH5Q_])
- custom writeObject data (class "java.util.LinkedList")
- object (class "java.util.LinkedList", [[Page yH5Q_]])
- field (class "org.zkoss.zk.ui.impl.DesktopImpl", name: "_pages", type: "interface java.util.List")
- custom writeObject data (class "org.zkoss.zk.ui.impl.DesktopImpl")
- object (class "org.zkoss.zk.ui.impl.DesktopImpl", [Desktop z_Jbfu8exW9haA_LuuwzUJCQ:/zul/login.zul])
- field (class "org.zkoss.util.CacheMap$Value", name: "value", type: "class java.lang.Object")
- object (class "org.zkoss.util.CacheMap$Value", ([Desktop z_Jbfu8exW9haA_LuuwzUJCQ:/zul/login.zul]#1641404719684))
- custom writeObject data (class "java.util.HashMap")
- object (class "java.util.LinkedHashMap", {z_Jbfu8exW9haA_LuuwzUJCQ=([Desktop z_Jbfu8exW9haA_LuuwzUJCQ:/zul/login.zul]#1641404719684)})
- field (class "org.zkoss.util.CacheMap", name: "_map", type: "interface java.util.Map")
- custom writeObject data (class "org.zkoss.util.CacheMap")
- object (class "org.zkoss.zk.ui.impl.SimpleDesktopCache$Cache", {z_Jbfu8exW9haA_LuuwzUJCQ=[Desktop z_Jbfu8exW9haA_LuuwzUJCQ:/zul/login.zul]})
- field (class "org.zkoss.zk.ui.impl.SimpleDesktopCache", name: "_desktops", type: "class org.zkoss.zk.ui.impl.SimpleDesktopCache$Cache")
- object (class "org.zkoss.zk.ui.impl.SimpleDesktopCache", org.zkoss.zk.ui.impl.SimpleDesktopCache#8570f71)
- custom writeObject data (class "org.zkoss.zk.ui.http.SerializableSession")
- root object (class "org.zkoss.zk.ui.http.SerializableSession", org.zkoss.zk.ui.http.SerializableSession#7f4fb979)
at java.base/java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183)

Please call System.setProperty("sun.io.serialization.extendedDebugInfo", "true"); which will print details debugging information about which member field is not serializable.
updated:
If you check the exception, the last field it printed is the root cause of NotSerializableException:
- field (class "org.springframework.aop.support.AbstractGenericPointcutAdvisor", name: "advice", type: "interface org.aopalliance.aop.Advice")
You can trace the object path from the root object to know how your ViewModel references AbstractGenericPointcutAdvisor.
- root object (class "org.zkoss.zk.ui.http.SerializableSession", org.zkoss.zk.ui.http.SerializableSession#7f4fb979)
Hence, I think the exception is not caused by ZK.

Related

Spring Cloud Stream - failed to deserialize - failed to resolve class name. Class not found

Application A writes to a Kafka Topic below User object (json):
public class UserEvent {
private UUID id;
private Object payload; // contains User fields name etc.
}
Application B is trying to consume this User object (User.java resides in application B project) with below application.yml (multiple binders):
binders:
azureEventHub:
type: kafka
environment:
spring:
kafka:
bootstrap-servers: servicebus.windows.net:9093
consumer:
key-deserializer: org.springframework.kafka.support.serializer.ErrorHandlingDeserializer
value-deserializer: org.springframework.kafka.support.serializer.ErrorHandlingDeserializer
properties:
spring.deserializer.key.delegate.class: org.apache.kafka.common.serialization.StringDeserializer
spring.deserializer.value.delegate.class: org.springframework.kafka.support.serializer.JsonDeserializer
spring.json.trusted.packages: com.*
spring.json.value.default.type: com.applicationb.User
Below is how my Spring Cloud Stream Processor class looks:
#Bean
public Function<Message<User>, String> userProcessor()
{.. }
But instead of converting the Message payload to "User" class it keeps throwing the error with the
Parent class "UserEvent" not found.
org.springframework.kafka.listener.ListenerExecutionFailedException:
Listener failed; nested exception is org.springframework.kafka.support.serializer.DeserializationException:
failed to deserialize; nested exception is org.springframework.messaging.converter.MessageConversionException:
failed to resolve class name. Class not found [com.abcd.UserEvent];
nested exception is java.lang.ClassNotFoundException: com.abcd.UserEvent
Any ideas ?
The deserializer will use type information in the headers before falling back to the default (User).
Also set spring.json.use.type.headers to false.

why jdk proxy could not be injected

I use Aspect like this:
#Aspect
#Component
public class DataSourceAspect {
#Pointcut("#target(com.chen.dynamicsource.aspect.DataSource)")
public void pointCut() {
}
#Before("pointCut()")
public void doBefore(JoinPoint joinPoint) {}
}
And I add it to application.yml:
spring
aop:
proxy-target-class: false
When I run the application. I get the following error:
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'dispatcherServlet' could not be injected because it is a JDK dynamic proxy
The bean is of type 'com.sun.proxy.$Proxy67' and implements:
org.springframework.context.ApplicationContextAware
org.springframework.core.env.EnvironmentCapable
org.springframework.context.EnvironmentAware
javax.servlet.Servlet
javax.servlet.ServletConfig
java.io.Serializable
org.springframework.aop.SpringProxy
org.springframework.aop.framework.Advised
org.springframework.core.DecoratingProxy
Expected a bean of type 'org.springframework.web.servlet.DispatcherServlet' which implements:
I know I can use statically evaluated pointcut designators like within () and change the value of proxy-target-class to true to avoid the problem.
But I just want to know why jdk proxy could not be injected.

MybatisAutoConfiguration didn't create dataSource bean

I have a SpringBoot 2.0.4.RELEASE project,using mybatis-spring-boot-autoconfigure-1.3.2.jar,and it works fine.
mybatis-spring-boot-autoconfigure-1.3.2.jar will create the bean datasource of type [com.zaxxer.hikari.HikariDataSource].
But when I use jar xvf to extract the jar file,then I use jar cvmf0 /META-INF/MANIFEST.MF to recover the jar.Although the jar is the same,but it can't create the datasource bean.
I use java -Ddebug -jar to run my project,find out the spring-boot-2.0.4.RELEASE.jar is not on the top of classpath.
Here is some error log:
MybatisAutoConfiguration:
Did not match:
- #ConditionalOnBean (types: javax.sql.DataSource; SearchStrategy: all) **did not find any beans of typejavax.sql.DataSource** (OnBeanCondition)
Matched:
- #ConditionalOnClass found required classes 'org.apache.ibatis.session.SqlSessionFactory','org.mybatis.spring.SqlSessionFactoryBean'; #ConditionalOnMissingClass did not find unwanted class (OnClassCondition)
Caused by: java.lang.IllegalArgumentException: Property'sqlSessionFactory' or 'sqlSessionTemplate' are required
at org.springframework.util.Assert.notNull(Assert.java:193) ~[spring-core-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
at org.mybatis.spring.support.SqlSessionDaoSupport.checkDaoConfig(SqlSessionDaoSupport.java:74)~[mybatis-spring-1.3.2.jar!/:1.3.2]
at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:73) ~[mybatis-spring-1.3.2.jar!/:1.3.2]
at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44~[spring-tx-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1758)~[spring-beans-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1695)~[spring-beans-5.0.8.RELEASE.jar!/:5.0.8.RELEASE]
... 108 common frames omitted
The application.yml is:
spring:
profiles:
active: prod
datasource:
name: dataSource
url: xxx
username: xxx
password: xxx
#type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: XXXX
mybatis:
typeAliasesPackage: xxx
mapperLocations: classpath:mybatis/mapper/*Mapper.xml

Grails: Error creating bean with name 'properties': Bean definition is abstract

I'm new to Grails so I posted a question a few days ago on how to do a query to a different Datasource:
Grails - Getting data from a different datasource and saving it in my Grails database
The answer above worked, but then I got a strange error when I tried to view or modify anything in my default datasource. In this case I tried to go to index view of my Client controller which uses some basic scaffolding:
[http-bio-8080-exec-10] ERROR spring.ReloadAwareAutowireCapableBeanFactory - Bean couldn't be autowired using grails optimization: Error creating bean with name 'properties': Bean definition is abstract
[http-bio-8080-exec-10] ERROR spring.ReloadAwareAutowireCapableBeanFactory - Retrying using spring autowire
[http-bio-8080-exec-10] ERROR errors.GrailsExceptionResolver - BeanIsAbstractException occurred when processing request: [GET] /EmmaRestServer/client/index
Error creating bean with name 'properties': Bean definition is abstract. Stacktrace follows:
Message: Error creating bean with name 'properties': Bean definition is abstract
If I remove the second datasource, this problem disappears. What could be causing this issue?
I had some extra configurations in the resources.groovy. I removed them and now it looks like this, and it works properly:
beans = {
dataSource_drupal(DataSource) { bean ->
bean.destroyMethod = 'close'
driverClassName = "com.mysql.jdbc.Driver"
username = "user"
password = "password"
url = "jdbc:databaseURL
}
}

spring aop - exception while creating advice around JdbcTemplate methods

I've a web application that uses apache dbcp and spring jdbc to perform database operations on an oracle database. I need to write a performance logger that logs the individual times of each database operation. I tried writing an around advice on all 'execute' methods of org.springframework.jdbc.core.JdbcTemplate but it results in an error when spring gets initialized. The logger class and the exception stacktrace is as follows:-
I also tried to use CGLIB proxies by enabling but it errors out on dao classes that extends from spring's StoredProcedure class and use constructor injection.
#Aspect
public class Logger {
#Around("this(org.springframework.jdbc.core.JdbcTemplate) && execution(* execute(*))")
public Object invoke(ProceedingJoinPoint pjp) throws Throwable {
long time = System.currentTimeMillis();
Object result = pjp.proceed();
LOGGER.debug("time consumed = " + (System.currentTimeMillis() - time));
return result;
}
Exception stacktrace:
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'myDao' defined in class path resource [spring/my-dao.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.jdbc.core.JdbcTemplate]:
Could not convert constructor argument value of type [$Proxy7] to required type [org.springframework.jdbc.core.JdbcTemplate]:
Failed to convert value of type '$Proxy7 implementing org.springframework.jdbc.core.JdbcOperations,org.springframework.beans.factory.InitializingBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised'
to required type 'org.springframework.jdbc.core.JdbcTemplate';
nested exception is
java.lang.IllegalStateException: Cannot convert value of type [$Proxy7 implementing org.springframework.jdbc.core.JdbcOperations,org.springframework.beans.factory.InitializingBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised]
to required type [org.springframework.jdbc.core.JdbcTemplate]:
no matching editors or conversion strategy found
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:702)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)

Resources