4 Replies Latest reply on Nov 14, 2006 6:49 AM by Sharath Reddy

    SerializationException when attempting to activate/passivate

    Louis Coetzee Apprentice

      Hi,

      I am running EJB3-RC6 with jboss 4.0.4.CR2. I get the following error when jboss attempts to activate (passivate ?) an entity which also contains Enums:

      2006-05-02 15:20:48,134 DEBUG [org.jboss.serial.classmetamodel.ClassMetaData] Constructor being rebuilt for class csir.content.par.ApplicableLocation
      2006-05-02 15:20:48,147 ERROR [STDERR] java.lang.RuntimeException: org.jboss.serial.exception.SerializationException
      2006-05-02 15:20:48,148 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulBeanContext.extractBeanAndInterceptors(StatefulBeanContext.java:362)
      2006-05-02 15:20:48,148 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulBeanContext.getInstance(StatefulBeanContext.java:306)
      2006-05-02 15:20:48,148 ERROR [STDERR] at org.jboss.ejb3.AbstractPool.remove(AbstractPool.java:169)
      2006-05-02 15:20:48,148 ERROR [STDERR] at org.jboss.ejb3.cache.simple.SimpleStatefulCache.remove(SimpleStatefulCache.java:284)
      2006-05-02 15:20:48,148 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulRemoveInterceptor.removeSession(StatefulRemoveInterceptor.java:125)
      2006-05-02 15:20:48,148 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulRemoveInterceptor.invoke(StatefulRemoveInterceptor.java:86)
      2006-05-02 15:20:48,148 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      2006-05-02 15:20:48,148 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
      2006-05-02 15:20:48,148 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      2006-05-02 15:20:48,148 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
      2006-05-02 15:20:48,148 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      2006-05-02 15:20:48,148 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      2006-05-02 15:20:48,148 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      2006-05-02 15:20:48,148 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:199)
      2006-05-02 15:20:48,148 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
      2006-05-02 15:20:48,148 ERROR [STDERR] at $Proxy481.theEnd(Unknown Source)
      2006-05-02 15:20:48,148 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2006-05-02 15:20:48,148 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      2006-05-02 15:20:48,148 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      2006-05-02 15:20:48,148 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      2006-05-02 15:20:48,148 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
      2006-05-02 15:20:48,148 ERROR [STDERR] at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:32)
      2006-05-02 15:20:48,148 ERROR [STDERR] at org.jboss.seam.contexts.Contexts.callDestroyMethod(Contexts.java:211)
      2006-05-02 15:20:48,149 ERROR [STDERR] at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:189)
      2006-05-02 15:20:48,149 ERROR [STDERR] at org.jboss.seam.contexts.Lifecycle.endSession(Lifecycle.java:181)
      2006-05-02 15:20:48,149 ERROR [STDERR] at org.jboss.seam.servlet.SeamListener.sessionDestroyed(SeamListener.java:45)
      2006-05-02 15:20:48,149 ERROR [STDERR] at org.apache.catalina.session.StandardSession.expire(StandardSession.java:680)
      2006-05-02 15:20:48,149 ERROR [STDERR] at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:572)
      2006-05-02 15:20:48,149 ERROR [STDERR] at org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:678)
      2006-05-02 15:20:48,149 ERROR [STDERR] at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:663)
      2006-05-02 15:20:48,149 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1284)
      2006-05-02 15:20:48,149 ERROR [STDERR] at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1569)
      2006-05-02 15:20:48,149 ERROR [STDERR] at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
      2006-05-02 15:20:48,149 ERROR [STDERR] at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1578)
      2006-05-02 15:20:48,149 ERROR [STDERR] at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1558)
      2006-05-02 15:20:48,149 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
      2006-05-02 15:20:48,149 ERROR [STDERR] Caused by: org.jboss.serial.exception.SerializationException
      2006-05-02 15:20:48,149 ERROR [STDERR] at org.jboss.serial.persister.PrivateWritePersister.readData(PrivateWritePersister.java:134)
      2006-05-02 15:20:48,150 ERROR [STDERR] at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:167)
      2006-05-02 15:20:48,150 ERROR [STDERR] at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:55)
      2006-05-02 15:20:48,150 ERROR [STDERR] at org.jboss.serial.objectmetamodel.DataContainer$DataContainerInput.readObject(DataContainer.java:657)
      2006-05-02 15:20:48,150 ERROR [STDERR] at org.jboss.serial.persister.RegularObjectPersister.defaultRead(RegularObjectPersister.java:204)
      2006-05-02 15:20:48,150 ERROR [STDERR] at org.jboss.serial.persister.RegularObjectPersister.readData(RegularObjectPersister.java:151)
      2006-05-02 15:20:48,150 ERROR [STDERR] at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:167)
      2006-05-02 15:20:48,150 ERROR [STDERR] at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:55)
      2006-05-02 15:20:48,150 ERROR [STDERR] at org.jboss.serial.objectmetamodel.DataContainer$DataContainerInput.readObject(DataContainer.java:657)
      2006-05-02 15:20:48,150 ERROR [STDERR] at org.jboss.serial.persister.ArrayPersister.readObjectArray(ArrayPersister.java:186)
      2006-05-02 15:20:48,150 ERROR [STDERR] at org.jboss.serial.persister.ArrayPersister.readData(ArrayPersister.java:162)
      2006-05-02 15:20:48,150 ERROR [STDERR] at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:167)
      2006-05-02 15:20:48,151 ERROR [STDERR] at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:55)
      2006-05-02 15:20:48,151 ERROR [STDERR] at org.jboss.serial.objectmetamodel.DataContainer$DataContainerInput.readObject(DataContainer.java:657)
      2006-05-02 15:20:48,151 ERROR [STDERR] at org.jboss.serial.io.JBossObjectInputStream.readObjectOverride(JBossObjectInputStream.java:85)
      2006-05-02 15:20:48,151 ERROR [STDERR] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:333)
      2006-05-02 15:20:48,151 ERROR [STDERR] at org.jboss.serial.io.MarshalledObject.get(MarshalledObject.java:68)
      2006-05-02 15:20:48,151 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulBeanContext.extractBeanAndInterceptors(StatefulBeanContext.java:339)
      2006-05-02 15:20:48,151 ERROR [STDERR] ... 35 more
      2006-05-02 15:20:48,151 ERROR [STDERR] Caused by: java.lang.reflect.InvocationTargetException
      2006-05-02 15:20:48,151 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor1153.invoke(Unknown Source)
      2006-05-02 15:20:48,152 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      2006-05-02 15:20:48,152 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
      2006-05-02 15:20:48,152 ERROR [STDERR] at org.jboss.serial.persister.PrivateWritePersister.readData(PrivateWritePersister.java:124)
      2006-05-02 15:20:48,152 ERROR [STDERR] ... 52 more
      2006-05-02 15:20:48,152 ERROR [STDERR] Caused by: java.io.IOException: Enumeration KWAZULU_NATAL not found at Enum Class class csir.common.enums.seam.ProvinceEnum
      2006-05-02 15:20:48,152 ERROR [STDERR] at org.jboss.serial.persister.EnumerationPersister.readData(EnumerationPersister.java:96)
      2006-05-02 15:20:48,152 ERROR [STDERR] at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:167)
      2006-05-02 15:20:48,153 ERROR [STDERR] at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:55)
      2006-05-02 15:20:48,153 ERROR [STDERR] at org.jboss.serial.objectmetamodel.DataContainer$DataContainerInput.readObject(DataContainer.java:657)
      2006-05-02 15:20:48,153 ERROR [STDERR] at org.jboss.serial.persister.RegularObjectPersister.defaultRead(RegularObjectPersister.java:204)
      2006-05-02 15:20:48,153 ERROR [STDERR] at org.jboss.serial.persister.RegularObjectPersister.readData(RegularObjectPersister.java:151)
      2006-05-02 15:20:48,153 ERROR [STDERR] at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:167)
      2006-05-02 15:20:48,153 ERROR [STDERR] at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:55)
      2006-05-02 15:20:48,153 ERROR [STDERR] at org.jboss.serial.objectmetamodel.DataContainer$DataContainerInput.readObject(DataContainer.java:657)
      2006-05-02 15:20:48,153 ERROR [STDERR] at org.jboss.serial.persister.ObjectInputStreamProxy.readObjectOverride(ObjectInputStreamProxy.java:65)
      2006-05-02 15:20:48,153 ERROR [STDERR] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:333)
      2006-05-02 15:20:48,153 ERROR [STDERR] at java.util.HashMap.readObject(HashMap.java:1013)
      2006-05-02 15:20:48,153 ERROR [STDERR] ... 56 more
      2006-05-02 15:20:48,154 WARN [org.jboss.seam.contexts.Contexts] Could not destroy component: contentManagementBean
      


      Below is the code for my Enums. Note the usage of the abstract toString (can this cause the problem ?). Other entities with enums (without this toString seems to work OK).

      package csir.common.enums.seam;
      
      public enum ProvinceEnum {
       GAUTENG {
       public String toString() {
       return translatedProvinces[0];
       }
       },
       LIMPOPO {
       public String toString() {
       return translatedProvinces[1];
       }
       },
       NORTH_WEST {
       public String toString() {
       return translatedProvinces[2];
       }
       },
       WESTERN_CAPE {
       public String toString() {
       return translatedProvinces[3];
       }
       },
       NORTHERN_CAPE {
       public String toString() {
       return translatedProvinces[4];
       }
       },
       EASTERN_CAPE {
       public String toString() {
       return translatedProvinces[5];
       }
       },
       FREE_STATE {
       public String toString() {
       return translatedProvinces[6];
       }
       },
       MPUMALANGA {
       public String toString() {
       return translatedProvinces[7];
       }
       },
       KWAZULU_NATAL {
       public String toString() {
       return translatedProvinces[8];
       }
       };
       public static final String translatedProvinces[] = { "Gauteng", "Limpopo",
       "North West", "Western Cape", "Nothern Cape", "Eastern Cape",
       "Free State", "Mpumalanga", "Kwazulu Natal" };
      
       public abstract String toString();
      }
      


      Any suggestions appreciated.

      Thanks

      Louis


        • 1. Re: SerializationException when attempting to activate/passi
          Clebert Suconic Master

          I will create a testcase within JBossSerilaization to test that.

          • 2. Re: SerializationException when attempting to activate/passi
            Clebert Suconic Master

            http://jira.jboss.com/jira/browse/JBSER-71

            Thanks for pointing this out.

            It was fixed on CVS at JBossSerialization.
            So, next release will have this fixed.

            • 4. Re: SerializationException when attempting to activate/passi
              Sharath Reddy Newbie

              Hi,

              I got the SerializationException problem when JBoss 4.0.4 tries to activate a stateful session bean that was passivated (and hence serialized to a file unser [JBOSS-DIR]/server/all/tmp/sessions directory). I am not using enum. The error is as follows:

              Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: org.jboss.serial.exception.SerializationException: Could not create instance of org.hibernate.ejb.QueryImpl - org.hibernate.ejb.QueryImpl

              at org.jboss.ejb3.stateful.StatefulBeanContext.extractBeanAndInterceptors(StatefulBeanContext.java:365)

              at org.jboss.ejb3.stateful.StatefulBeanContext.getInstance(StatefulBeanContext.java:309)

              at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:75)

              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

              at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)

              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

              at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)

              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

              at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)

              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

              at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:308)

              at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)

              at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)

              at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:828)

              at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:681)

              at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:358)

              at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:412)

              at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:239)

              at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:190)

              at org.jboss.remoting.Client.invoke(Client.java:525)

              at org.jboss.remoting.Client.invoke(Client.java:488)

              at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)

              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

              at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)

              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

              at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:55)

              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

              at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:65)

              at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

              at org.jboss.ejb3.stateful.StatefulRemoteProxy.invoke(StatefulRemoteProxy.java:133)

              at $Proxy4.report(Unknown Source)

              at uk.co.MyCompany.a.b.MyStatefulBean.report(MyStatefulBean.java:49)

              Somehow the deserialization in JBoss is not working??

              Any help greatly appreciated.

              redyz