0 Replies Latest reply on Sep 21, 2004 12:11 PM by fburlet

    ejbPassivate() and private transient fields

    fburlet

      Hi,

      I have a stateful session bean that has a private transient field which is the LocalHome interface of another session Bean (a stateless one).

      I instanciate a proxy by invoking a private method from within the stateful session bean as in the following extract:

      private transient MySessionBeanLocalHome privateField;
      ...
      private MySessionBeanLocalHome getMySessionBeanLocalHome() {
       if (privateField == null) {
       privateField = MySessionBeanUtil.getLocalHome();
       }
       return privateField;
      }
      


      In the ejbPassivate() method of the stateful session bean, I call the getMySessionBeanLocalHome() private method and I get a ClassCastException when the session bean passivate (here below the stacktrace I get).

      I don't understand what happens. Any idea ?

      The stacktrace:
      12:26:10,922 ERROR [synch.driver.ScannerSynchSessionBean] [801018530188-K / 32000110] Could not passivate
      java.lang.ClassCastException
       at com.kiala.kserver.synch.driver.helper.ScannerConnectionLoggerUtil.getLocalHome(ScannerConnectionLoggerUtil.java:54)
       at com.kiala.kserver.synch.driver.ScannerSynchSessionBean.getScannerConnectionLoggerHome(ScannerSynchSessionBean.java:698)
       at com.kiala.kserver.synch.driver.ScannerSynchSessionBean.rollbackSynchAndLogFailure(ScannerSynchSessionBean.java:464)
       at com.kiala.kserver.synch.driver.ScannerSynchSessionBean.ejbPassivate(ScannerSynchSessionBean.java:671)
       at com.kiala.kserver.synch.driver.ScannerSynchSession.ejbPassivate(ScannerSynchSession.java:20)
       at org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager.passivateSession(StatefulSessionFilePersistenceManager.java:371)
       at org.jboss.ejb.plugins.StatefulSessionInstanceCache.passivate(StatefulSessionInstanceCache.java:85)
       at org.jboss.ejb.plugins.AbstractInstanceCache.tryToPassivate(AbstractInstanceCache.java:151)
       at org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy$OveragerTask.run(LRUEnterpriseContextCachePolicy.java:447)
       at org.jboss.ejb.plugins.LRUStatefulContextCachePolicy$RemoverTask.run(LRUStatefulContextCachePolicy.java:143)
       at java.util.TimerThread.mainLoop(Timer.java:432)
       at java.util.TimerThread.run(Timer.java:382)