2 Replies Latest reply on Jan 5, 2005 5:58 PM by Luc Texier

    Stateful Bean and Serialization

    Kalyan Newbie

      Hi,

      We have a stateful session bean, and we have deployed it in JBoss 3.2.5 AS. We have noticed that when the server tries to passivate the bean, it tires to serialize the bean (and it's instance variables) to the file system. Some of our instance variables are not serializable and hence we are getting a NotSerializableException during bean passivation.

      Why does the server try to serialize the bean to the file system? Can it not store in any other secondary storage, like a cache? What will be the down side of having it that way?

      Thanks,
      Kalyan

        • 1. Bug in compiler with null
          Luc Texier Apprentice

          I have been having trouble sometimes passing in null to a method call, particularly arrays. It is weird sometimes null just works, sometimes I have to typecast it, sometimes I have to declare a variable and pass the variable in. I don't have a testcase yet because sometimes it works, sometimes it doesn't.

          i.e.

          {
           Object[] args = null;
           foo.someMethod(args);
          
          OR....
          
           foo.someMethod((Object[])null); // sometimes this doesn't work either
          }
          /code]
          
          instead of just
          
          
          {
          
           foo.someMethod(null);
          }
          /code]
          


          • 2. Re: Stateful Bean and Serialization
            Darran Lofthouse Master

             

            Why does the server try to serialize the bean to the file system ? Can it not store in any other secondary storage, like a cache? What will be the down side of having it that way?


            See the EJB specification for your answers.