2 Replies Latest reply on Nov 11, 2004 11:34 AM by fredatwork

    setSessionContext() method not called

    fredatwork

      Hello,

      I'm trying to implement a stateful session bean that manages its own transactions (see the @ejb.bean tag of my sample below).

      However, the setSessionContext() method is not called for my sample. If created with with a remote interface or with local one, the result is the same, JBoss does not go through the setSessionContext() method.

      I'm using JBoss 4.0.

      Does anybody have an idea what is the problem ? It looks like it is a common question raised on the JBoss forums, but there never is any answer or clue proposed.

      Thanks in advance for any tip.

      Fred


      Extract of my bean class :
      ------------------------------

      import java.rmi.RemoteException;
      
      import javax.ejb.EJBException;
      import javax.ejb.SessionBean;
      import javax.ejb.SessionContext;
      import javax.transaction.NotSupportedException;
      import javax.transaction.Status;
      import javax.transaction.SystemException;
      
      import org.apache.log4j.Logger;
      
      import com.rubis.app.basics.loader.interfaces.EquityLoaderException;
      import com.rubis.util.loader.Record;
      
      /**
       * @ejb.bean
       * name="EquityRecordHandler"
       * jndi-name="EquityRecordHandlerBean"
       * type="Stateful"
       * transaction-type="Bean"
       */
      
      public abstract class EquityRecordHandlerBean implements SessionBean {
      
       /** Session context **/
       private SessionContext sessionContext;
      
       /** Logger **/
       private static Logger logger = Logger.getLogger(EquityRecordHandlerBean.class);
      
       /**
       * Bean creation method
       * @ejb.create-method
       */
       public void ejbCreate() {
       }
      
       /**
       * @see javax.ejb.SessionBean#ejbRemove()
       */
       public void ejbRemove() throws EJBException, RemoteException {
       //sessionContext = null;
       }
      
       /**
       * @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
       */
       public void setSessionContext(SessionContext context) throws EJBException, RemoteException {
       this.sessionContext = context;
       logger.info("Session context = " + context);
       }
      
       .../...
      }