[jboss-user] [Installation, Configuration & DEPLOYMENT] - Re: Errors during deployment of EJB3 application into JBoss
ilangocal
do-not-reply at jboss.com
Tue Oct 21 17:38:40 EDT 2008
I thought I was using EJB 3 all along. Perhaps I have been wrong!!
The best option is to reproduce the MDB source here: Here is the source for my MDB: Thanks again. Appreciate your kind replies
/*
| * To change this template, choose Tools | Templates
| * and open the template in the editor.
| */
| package ejb;
|
| import javax.ejb.ActivationConfigProperty;
| import javax.ejb.MessageDriven;
| import javax.jms.Message;
| import javax.jms.MessageListener;
| import javax.annotation.Resource;
| import javax.ejb.MessageDrivenContext;
| import javax.jms.JMSException;
| import javax.jms.ObjectMessage;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
|
| /**
| *
| * @author
| */
| @MessageDriven(mappedName = "jms/DCMessageBean",
| activationConfig = {
| @ActivationConfigProperty(propertyName = "messagingType", propertyValue = "javax.jms.MessageListener"),
| @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
| @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
| @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/DCSubmitQueue"),
| @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "4")})
|
| public class DCMessageBean implements MessageListener {
|
| @Resource
| private MessageDrivenContext messageDrivenContext;
| @PersistenceContext
| private EntityManager entityManager;
|
| public DCMessageBean() {
| }
|
| public void onMessage(Message message) {
| ObjectMessage msg = null;
| try {
| if (message instanceof ObjectMessage) {
| msg = (ObjectMessage) message;
| QueueingEntity e = (QueueingEntity) msg.getObject();
| save(e);
| }
| } catch (JMSException e) {
| e.printStackTrace();
| messageDrivenContext.setRollbackOnly();
| } catch (Throwable te) {
| te.printStackTrace();
| }
| }
|
| public void save(Object object) {
| entityManager.persist(object);
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4183657#4183657
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4183657
More information about the jboss-user
mailing list