[jboss-user] [EJB 3.0] - @PreDestroy not working..?

delley do-not-reply at jboss.com
Fri Oct 13 04:52:17 EDT 2006


Hi,

Im using a jboss 4.0.4GA with jboss-EJB-3.0_RC8-FD installed.

I have a MDB that needs to do some cleaning before it is garbage collected.

I have tried using @PreDestory or similar - but it doesnt seem like its ever being called!?!

I have tried to deploy a new version of the code. Still nothing happend. I tried to shutdown jboss - nothing happend. Or at least no log statment in my logs. And it cant be my logging - have tested it and I know that it is working!

I've read somewhere in this forum that @PreDestroy was moved from javax.ejb to javax.annotation. But as you can see from my import statment I'm using the correct one.

And the library jboss-ejb3x.jar that contains the class is present in <jboss_home>\server\all\deploy\ejb3.deployer\ so it should be loaded - right?

And yes - i'm starting jboss with the -c all switch ;-)

import javax.annotation.PreDestroy;
  | import javax.ejb.ActivationConfigProperty;
  | import javax.ejb.MessageDriven;
  | import javax.jms.Message;
  | import javax.jms.MessageListener;
  | import javax.jms.ObjectMessage;
  | import javax.jms.JMSException;
  | 
  | import org.apache.commons.logging.Log;
  | import org.apache.commons.logging.LogFactory;
  | 
  | @MessageDriven (activationConfig =
  | {
  |   @ActivationConfigProperty(propertyName="destinationType",
  |     propertyValue="javax.jms.Queue"),
  |   @ActivationConfigProperty(propertyName="destination",
  |     propertyValue="queue/wipqueue")
  | })
  | public class TestMBean implements MessageListener{
  | 
  |        /** Logger. */
  | 	private static final Log log_ = LogFactory.getLog(TestMBean.class
  | 			.getName());
  | 
  |        public void onMessage(Message message) {
  |             //do something here...
  |        }
  | 		
  | 	@PreDestroy
  | 	public void preDestroy(){
  | 	    log_.debug("preDestroy called!!!");
  | 	}
  | 	
  | }//end class
  | 
  | Any ideas?

Regards,

delley

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978107#3978107

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978107



More information about the jboss-user mailing list