0 Replies Latest reply: Jan 6, 2011 7:58 PM by Yuanwen Wu RSS

MDB could not be deployed using annotation

Yuanwen Wu Newbie

Environment: JBoss AS 5.0.1 with EJB3

 

1. Create MDB with deployment descriptor and it works.  There are five files:

 

1). testJMSClient to send Queue

2). jboss.xml

3). ejb-jar.xml

4). myQueue-service.xml

5). TestMDB.java as Message Bean

 

2. Try to use annotation.

 

According to http://community.jboss.org/wiki/HowtoconfigureEJB3MDBsforIBMWebsphereMQ,

 

There are 3 files needed

 

1). testJMSClient to send Queue.  (Tried to use annotation of Resource but the ConnectionFactory always give null, so give up and still use the original way without annotation)

2). myQueue-service.xml

3). TestMDB.java as Message Bean

 

@MessageDriven(name = "TestMDB",
activationConfig = {
    @ActivationConfigProperty(propertyName = "destination", propertyValue = "MyQueue"),
    @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
})
@Depends(value = "jboss.messaging.destination:service=Queue,name=MyQueue")

 

public class TestMDB implements MessageListener {

 

    private static final Logger LOG = Logger.getLogger(
            TestMDB.class);
   
    @Resource
    private MessageDrivenContext ctx;
   
    private static int mdcSetCount = 0;

 

    public TestMDB() {
    }

 

    // as required by the EJB spec
    @Override
    public void onMessage(Message message) {
        try {
            if (message instanceof TextMessage) {
                TextMessage msg = (TextMessage) message;
                String msgText = msg.getText();
            } else {
                LOG.warn("Message not a text message");
            }
        } catch (JMSException ex) {
            LOG.error("Error receiving message", ex);
        }
    }
}

 

Question:

 

1. No error in creating MyQueue.  However, onMessage is not fired.

2. Check the log file and find the following error:

 

2011-01-06 15:38:53,555 WARN  [org.jboss.wsf.container.jboss50.deployer.WebServiceDeployerEJB] (main) Ingore ejb deployment with null classname: org.jboss.metadata.ejb.jboss.JBossMessageDrivenBeanMetaData@e6f5b99{TestMDB}

 

 

Look like the is the mesage could not be deployed?  Have struggled for a couple of days and please help.

 

Regards.