jeudi 28 mai 2015

setMessageDrivenContext is not invoked

I am using EJB 2.0 without annotation. I have a ejb-jar.xml like:

<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC 
          "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
          "http://ift.tt/1nLokCN">

<ejb-jar>
<enterprise-beans>

<message-driven>
        <ejb-name>XMLEventQueueBean00</ejb-name>
    <ejb-class>com.test.XMLEventRequestService</ejb-class>
    <transaction-type>Bean</transaction-type>
    <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
    <message-driven-destination>
      <destination-type>javax.jms.Queue</destination-type>
    </message-driven-destination>

</message-driven>

</enterprise-beans>
</ejb-jar>

And I have a bean

public class XMLEventRequestService implements MessageDrivenBean, MessageListener {
    private MessageDrivenContext    m_context;
    public void setMessageDrivenContext(MessageDrivenContext ctx) {
        logger.debug("setMessageDrivenContext called");
        m_context = ctx;
    }

    public void ejbCreate() {
        logger.debug("ejbCreate called");
    }
    public void onMessage(Message msg) {

    }

}

But neither of the log is given and m_context gives NullPointerException when I called upon:

m_context.setRollbackOnly();

How can I set the context and why is it not invoke? (No annotation please. My supervisor prefers XML descriptor injection)

I am using JBoss 5.1.0.GA.

Aucun commentaire:

Enregistrer un commentaire