Netbean6.8: Cant deploy an app if I have Message Driven Bean

Posted by Harry Pham on Stack Overflow See other posts from Stack Overflow or by Harry Pham
Published on 2010-06-02T22:10:33Z Indexed on 2010/06/02 22:14 UTC
Read the original article Hit count: 339

I create an Enterprise Application CustomerApp that also generated two projects CustomerApp-ejb and CustomerApp-war. In the CustomerApp-ejb, I create a SessionBean call CustomerSessionBean.java as below.

package com.customerapp.ejb;

import javax.ejb.Stateless;
import javax.ejb.LocalBean;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Stateless
@LocalBean
public class CustomerSessionBean {
    @PersistenceContext(unitName = "CustomerApp-ejbPU")
    private EntityManager em;

    public void persist(Object object) {
        em.persist(object);
    } 
}

Now I can deploy CustomerApp-war just fine. But as soon as I create a Message Driven Bean, I cant deploy CustomerApp-war anymore. When I create NotificationBean.java (message driven bean), In the project destination option, I click add, and have NotificationQueue for the Destination Name and Destination Type is Queue. Below are the code

package com.customerapp.mdb;

import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.Message;
import javax.jms.MessageListener;

@MessageDriven(mappedName = "jms/NotificationQueue", activationConfig =  {
    @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
    @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
})
public class NotificationBean implements MessageListener {

    public NotificationBean() {
    }

    public void onMessage(Message message) {
    }

}

If I remove the @MessageDriven annotation, then I can deploy the project. Any idea why and how to fix it?

© Stack Overflow or respective owner

Related posts about java

Related posts about jpa