Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-10972

Session serialization and deserialization fails under Tomcat with an advised and session-scoped bean

    XMLWordPrintable

    Details

    • Last commented by a User:
      true

      Description

      In a webapp run under Tomcat there is a session-scoped bean which is also the target of advice.
      When Tomcat is being shut down it logs a warning (logged from a reproduction project, with -Dsun.io.serialization.extendedDebugInfo=true):

      09-Oct-2013 12:33:01 org.apache.catalina.session.StandardSession writeObject
      WARNING: Cannot serialize session attribute scopedTarget.component for session 2FC40E979D1454DB9B01A288CF06C56F
      java.io.NotSerializableException: org.springframework.aop.aspectj.annotation.InstantiationModelAwarePointcutAdvisorImpl
      	- element of array (index: 1)
      	- array (class "[Lorg.springframework.aop.Advisor;", size: 2)
      	- field (class "org.springframework.aop.framework.AdvisedSupport", name: "advisorArray", type: "class [Lorg.springframework.aop.Advisor;")
      	- object (class "org.springframework.aop.framework.ProxyFactory", org.springframework.aop.framework.ProxyFactory: 0 interfaces []; 2 advisors [org.springframework.aop.interceptor.ExposeInvocationInterceptor.ADVISOR, InstantiationModelAwarePointcutAdvisor: expression [@annotation(org.springframework.issues.AdivseMe) && this(c)]; advice method [public void org.springframework.issues.ComponentAspect.doSomething(org.springframework.issues.ScopedComponent)]; perClauseKind=SINGLETON]; targetSource [SingletonTargetSource for target object [[email protected]]]; proxyTargetClass=false; 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.spring[email protected]178feba)
      	- field (class "org.springframework.issues.ScopedComponent$$EnhancerByCGLIB$$b0bb4729", name: "CGLIB$CALLBACK_0", type: "interface org.springframework.cglib.proxy.MethodInterceptor")
      	- root object (class "org.springframework.issues.ScopedComponent$$EnhancerByCGLIB$$b0bb4729", [email protected])
      

      and, what's worse, when starting again sesion deserialization fails for the same reason:

      SEVERE: Exception loading sessions from persistent storage
      java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.springframework.aop.aspectj.annotation.InstantiationModelAwarePointcutAdvisorImpl
      	- element of array (index: 1)
      	- array (class "[Lorg.springframework.aop.Advisor;", size: 2)
      	- field (class "org.springframework.aop.framework.AdvisedSupport", name: "advisorArray", type: "class [Lorg.springframework.aop.Advisor;")
      	- object (class "org.springframework.aop.framework.ProxyFactory", org.springframework.aop.framework.ProxyFactory: 0 interfaces []; 2 advisors [org.springframework.aop.interceptor.ExposeInvocationInterceptor.ADVISOR, InstantiationModelAwarePointcutAdvisor: expression [@annotation(org.springframework.issues.AdivseMe) && this(c)]; advice method [public void org.springframework.issues.ComponentAspect.doSomething(org.springframework.issues.ScopedComponent)]; perClauseKind=SINGLETON]; targetSource [SingletonTargetSource for target object [[email protected]]]; proxyTargetClass=false; 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.spring[email protected]178feba)
      	- field (class "org.springframework.issues.ScopedComponent$$EnhancerByCGLIB$$b0bb4729", name: "CGLIB$CALLBACK_0", type: "interface org.springframework.cglib.proxy.MethodInterceptor")
      	- root object (class "org.springframework.issues.ScopedComponent$$EnhancerByCGLIB$$b0bb4729", [email protected])
      	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
      

        Attachments

          Activity

            People

            Assignee:
            juergen.hoeller Juergen Hoeller
            Reporter:
            mpol MichaƂ Politowski
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Days since last comment:
              3 years, 24 weeks, 1 day ago