EJB Message Driven Bean

Discussions

EJB programming & troubleshooting: EJB Message Driven Bean

  1. EJB Message Driven Bean (2 messages)

    Hi i have created a mdb using eclipse ide.. m having the foll deploy time error ...
    --- MBeans waiting for other MBeans --- ObjectName: jboss.j2ee:ear=MDBProject.ear,jar=MDBProjectEJB.jar,name=ContentConsumer,service=EJB3 State: FAILED Reason: org.jboss.deployment.DeploymentException: Required config property RequiredConfigPropertyMetaData@1135cd9[name=destinationType descriptions=[DescriptionMetaData@fa0bf4[language=en]]] for messagingType 'javax.jms.MessageListener' not found in activation config [ActivationConfigProperty(destination=javax.jms.Queue)] ra=jboss.jca:service=RARDeployment,name='jms-ra.rar' --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM --- ObjectName: jboss.j2ee:ear=MDBProject.ear,jar=MDBProjectEJB.jar,name=ContentConsumer,service=EJB3 State: FAILED Reason: org.jboss.deployment.DeploymentException: Required config property RequiredConfigPropertyMetaData@1135cd9[name=destinationType descriptions=[DescriptionMetaData@fa0bf4[language=en]]] for messagingType 'javax.jms.MessageListener' not found in activation config [ActivationConfigProperty(destination=javax.jms.Queue)] ra=jboss.jca:service=RARDeployment,name='jms-ra.rar'
    this code is working fine package com; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.ejb.EJB; import javax.jms.*; import javax.naming.Context; import javax.naming.InitialContext; /** * Servlet implementation class ContentProducer */ @EJB public class ContentProducer extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public ContentProducer() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int counter=Integer.parseInt(request.getParameter("times")); try { Context ctx = new InitialContext(); QueueConnectionFactory cf=(QueueConnectionFactory) ctx.lookup("ConnectionFactory"); Destination dest = (Destination)ctx.lookup("queue/MyQueue"); Connection conn=null; Session sess=null; conn=cf.createConnection(); sess=conn.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer prod=null; TextMessage msg=null; prod=sess.createProducer(dest); msg=sess.createTextMessage("hey"); for(int i=0;i<=counter;i++) {prod.send(msg); System.out.println("sent message to dest"+i); } } catch (Exception e) { // TODO: handle exception System.out.println(e.toString()); } } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } } <<<<<<<<<<<<<<<< Content Consumer>>>>>>>>>>>>>>>>>>>>>>> Code not working .. package beans; import javax.ejb.ActivationConfigProperty; import javax.ejb.MessageDriven; import javax.ejb.TransactionManagement; import javax.ejb.TransactionManagementType; import javax.jms.Message; import javax.jms.MessageListener; import javax.jms.TextMessage; /** * Message-Driven Bean implementation class for: ContentConsumer * */ @MessageDriven( activationConfig = { @ActivationConfigProperty( propertyName = "destination", propertyValue = "javax.jms.Queue" ) }) @TransactionManagement(TransactionManagementType.BEAN) public class ContentConsumer implements MessageListener { /** * Default constructor. */ public ContentConsumer() { // TODO Auto-generated constructor stub } /** * @see MessageListener#onMessage(Message) */ public void onMessage(Message message) { try { // TODO Auto-generated method stub System.out.println(((TextMessage) message).getText()); } catch (Exception e) { // TODO: handle exception } } } Please help
  2. Hi, Where are you bing the jndi destination mame i.e. "queue/MyQueue" to your mdb. You should do this in annotations and also you may want to bind the connection factory also. Thanx and Regards KR Kumar
  3. EJB Message Driven Bean[ Go to top ]

    Can someone clarify what is the solution for this issue?