【问题标题】:ZK with Spring Session jdbc throws: Unable to serialize entry带有 Spring Session jdbc 的 ZK 抛出:无法序列化条目
【发布时间】:2022-01-24 09:23:44
【问题描述】:

我们有一个基于 ZK 的应用程序,在 Docker 中运行在 Google Cloud Run 中的 Spring Boot / Spring Security / JPA 实现。它适用于非 jdbc 持久会话。 Google 可能正在将具有相同 JSESSION_ID 的请求发送到服务器池的同一服务器。 不幸的是,应用程序经常关闭并且用户不得不重新登录,这可能是因为之前响应请求的服务器已关闭或变得太忙,而 Google 决定更改目标服务器。

我们提高可用性的想法是实现非常容易实现的 Spring 持久会话。这只是在 Pom 中添加:

    <dependency>
        <groupId>org.springframework.session</groupId>
        <artifactId>spring-session-jdbc</artifactId>
    </dependency>

和 .properties :

 spring.session.store-type=jdbc
 spring.session.jdbc.initialize-schema=ALWAYS

创建了保存会话数据的表,服务器启动,但是在尝试加载登录页面时,我们收到以下错误:

    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

这个错误看起来像是一个不可序列化的 ZK 框架对象,我仔细检查了所有的会话数据是可序列化的,并没有发现任何错误。

我可以在这篇文章中添加一些配置文件,但我基本上是按照以下指示进行的:

https://www.zkoss.org/wiki/ZK_Installation_Guide/Setting_up_Servers/Google_App_Engine

欢迎任何帮助成功实现 ZK 的 Spring Session 存储!

这是一个“org.zkoss.bind.BindComposer”对象,它无法序列化任何想法,为什么?

按照非常好的 Hawk 想法,这里是带有详细错误日志的日志:

    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)

【问题讨论】:

    标签: spring session zk


    【解决方案1】:

    请致电System.setProperty("sun.io.serialization.extendedDebugInfo", "true");,它将打印有关哪些成员字段不可序列化的详细调试信息。


    更新:

    如果检查异常,它打印的最后一个字段是NotSerializableException的根本原因:

    - field (class "org.springframework.aop.support.AbstractGenericPointcutAdvisor", name: "advice", type: "interface org.aopalliance.aop.Advice")
    

    您可以从根对象跟踪对象路径,以了解您的 ViewModel 如何引用 AbstractGenericPointcutAdvisor。

    - root object (class "org.zkoss.zk.ui.http.SerializableSession", org.zkoss.zk.ui.http.SerializableSession@7f4fb979)
    

    因此,我认为异常不是由 ZK 引起的。

    【讨论】:

    • 感谢 Hawk 的快速回复!我用详细日志更新了问题,但我找不到更多线索,日志现在显示了 Spring 尝试序列化的所有内容,但我无法确定它是否提供了有关无法序列化的特定数据的信息,我可以请参阅: - 此对象列表中的对象(类“org.zkoss.bind.BindComposer”,org.zkoss.bind.BindComposer@38cc879f),但没有更多信息为什么它会失败......任何其他想法更进一步?
    猜你喜欢
    • 2016-09-09
    • 2017-02-15
    • 1970-01-01
    • 2014-04-12
    • 2016-09-20
    • 2016-11-26
    • 1970-01-01
    • 1970-01-01
    • 2018-08-28
    相关资源
    最近更新 更多