2 Replies Latest reply on May 31, 2006 10:40 AM by goeh

    Callback methods not called for @Stateless bean

      I am playing around with EJB3 on 4.0.4.CR2, and cannot get the callbacks PostConstruct or PreDestroy to work.

      I saw an issue from about 8 months ago, that said this was a bug that needed to be input via JIRA, but did not find one there, nor a resolution.

      Was this fixed ?



      Here is the bean, and it's interface

      package com.parasynthion.testbed.ejb;
      
      import javax.ejb.*;
      import javax.annotation.*;
      import org.apache.log4j.*;
      
      @Stateless
      public class TraderBean implements Trader
      {
       Logger logger=Logger.getLogger("CONSOLE");
      
       public void buy(String symbol,int quantity)
       {
       System.out.println("Buying " + quantity + " of "+symbol);
       }
      
       public void sell(String symbol,int quantity)
       {
       System.out.println("Selling " + quantity + " of "+symbol);
       }
      
       @PostConstruct
       protected void postConstruct()
       {
       logger.info("#################### Post Construct called ########################");
       }
      
       @PreDestroy
       protected void preDestroy()
       {
       logger.info("##################### Pre destroy called #############################");
       }
      
      }


      package com.parasynthion.testbed.ejb;
      
      import javax.ejb.*;
      
      @Local
      public interface Trader
      {
       public void buy(String symbol,int qty);
       public void sell(String symbol,int qty);
      }