2 Replies Latest reply on Feb 22, 2007 3:44 AM by grdzeli_kaci

    SerializationException when attempting to activate a statefu

    redyz

      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 during activation??

      btw my server.log looks like this:

      2006-11-24 13:41:59,486 DEBUG [org.jboss.remoting.transport.socket.ServerThread] WAKEUP in SERVER THREAD
      2006-11-24 13:41:59,486 DEBUG [org.jboss.remoting.transport.socket.ServerThread] beginning dorun
      2006-11-24 13:41:59,501 DEBUG [org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManager] Attempting to activate; id=4sv39f-d5cdqc-euwcjwy9-1-euwleaex-e
      2006-11-24 13:41:59,501 DEBUG [org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManager] Reading session state from: C:\java\jboss-4.0.4.GA\server\all\tmp\sessions\MyStatefulBean-euwlcs60-c\4sv39f-d5cdqc-euwcjwy9-1-euwleaex-e.ser
      2006-11-24 13:41:59,533 DEBUG [org.jboss.ejb3.cache.simple.StatefulSessionFilePersistenceManager] Removing passivated state file: C:\java\jboss-4.0.4.GA\server\all\tmp\sessions\MyStatefulBean-euwlcs60-c\4sv39f-d5cdqc-euwcjwy9-1-euwleaex-e.ser

      --------------------------------------------------------------------------------
      ** SO:
      Any help greatly appreciated.

      redyz

        • 1. Re: SerializationException when attempting to activate a sta

          i have also this problem.

          can anybody help us ?


          Regards,
          Paata

          • 2. Re: SerializationException when attempting to activate a sta

            hi redyz,

            i did it,
            the problem is that in statefull session bean i had define Query class object and this class is not a serializable.

            you must define this class as transient or use it only method scope.....
            my programm example




            @Stateful
            @Remote(CountFasade.class)
            public class CountFasadeBean implements CountFasade {
            
             @PersistenceContext(unitName = "srvProvOracle")
             private EntityManager oracleManager;
            
             Query _query = null;
            
             public void addCount() throws Exception {
             try {
             _query = oracleManager.createNativeQuery("some query");
             } catch (Exception e) {
             e.printStackTrace();
             throw e;
             }
             }
            }
            
            



            must be like this :

            @Stateful
            @Remote(CountFasade.class)
            public class CountFasadeBean implements CountFasade {
            
             @PersistenceContext(unitName = "srvProvOracle")
             private EntityManager oracleManager;
            
             @Transient
             Query _query = null;
            
             public void addCount() throws Exception {
             try {
             _query = oracleManager.createNativeQuery("some query");
             } catch (Exception e) {
             e.printStackTrace();
             throw e;
             }
             }
            }
            


            or like this :

            @Stateful
            @Remote(CountFasade.class)
            public class CountFasadeBean implements CountFasade {
            
             @PersistenceContext(unitName = "srvProvOracle")
             private EntityManager oracleManager;
            
             public void addCount() throws Exception {
             try {
             Query _query = oracleManager.createNativeQuery("some query");
             } catch (Exception e) {
             e.printStackTrace();
             throw e;
             }
             }
            }
            
            



            good luck