1 Reply Latest reply on Aug 6, 2004 5:09 AM by surajmundada

    Could not activate; failed to restore state

      Hi,

      I am using JBoss_3.2.0-tomcat_4.1.24 with default configuration and PostgreSQL as database.

      I have deployed a single Stateful Session bean in EAR file which does a very heavy task as compared to other stateless and entity beans.

      But when I send lot of concurrent requests to this statefull session bean, it gives me following error for half of the requests.

      01:35:11,103 INFO [STDOUT] ### GetProfilesServ:doService()=>I/O Exception for account_id = testsuraj@max.com ###
      01:35:11,109 INFO [STDOUT] Could not activate; failed to restore state; CausedByException is:
      /opt/jboss-3.2.1_tomcat-4.1.24/server/default/tmp/sessions/GetProfileBean-dxhvoddr-3/dxhx8ptj-3bx.ser (No such file or directory)

      ../jboss*/server/default/conf/standardjboss.xml file contains following configuration for standard statefull beans ( I am using "default" configuration of JBoss server )


      <cache-policy-conf>
       <min-capacity>50</min-capacity>
       <max-capacity>1000000</max-capacity>
       <remover-period>1800</remover-period>
       <max-bean-life>1800</max-bean-life>
       <overager-period>300</overager-period>
       <max-bean-age>600</max-bean-age>
       <resizer-period>400</resizer-period>
       <max-cache-miss-period>60</max-cache-miss-period>
       <min-cache-miss-period>1</min-cache-miss-period>
       <cache-load-factor>0.75</cache-load-factor>
       </cache-policy-conf>
       </container-cache-conf>
       <container-pool-conf>
       <MaximumSize>100</MaximumSize>
       </container-pool-conf>


      Also, ..\jboss*\server\default\deploy\jbossweb-tomcat.sar\META-INF\jboss-service.xml shows following configuration.




      <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
       port="8080" minProcessors="3" maxProcessors="10"
       enableLookups="true" acceptCount="10" debug="0"
       connectionTimeout="20000" useURIValidationHack="false" />

      Can any one throw some light on it ? How to avoid this error ?

      Thanks & Regards,

      Suraj



        • 1. Re: Could not activate; failed to restore state

          Hi,

          It seems I have fixed the problem.

          I was calling this stateful session bean from a servlet.

          In servlet, I had declared remote interface object for this bean as a global variable. That was the problem. Because when I moved this declaration inside the doService() method where it is created by calling create() on home interface, I didn't get any exception/error, whatever may be the no. of concurrent requests to the servlet.

          The remote interface object after initialization in first request might have been overwritten/reinitialized again by the next request to servlet, before sending response for the first request. That means reference to the state associated with the first remote intreface object was lost this causing the "Failed to restore state" problem.

          Thanks,

          Suraj

          wrong one:

          public class testserv extends HttpServlet
          {
           remote interface object declaration;
           ..
           ..
           service()
           {
           ...
           ...
           }
          
           doPost()
           {
           ...
           ...
           }
          }


          correct one:
          public class testserv extends HttpServlet
          {
           ..
           ..
           service()
           {
           remote interface object declaration;
           ...
           ...
           }
          
           doPost()
           {
           ...
           ...
           }
          }