Win a copy of Create an Uber Clone in 7 Days: Build a real world full stack mobile app in Java this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

my MDB does not recives any messages  RSS feed

Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone

I have two ejbs deployed on jboss and it seems that they working fine .the first one is a mdb listening for text messages as follow


package log;

import javax.ejb.MessageDrivenBean;
import javax.ejb.MessageDrivenContext;
import javax.ejb.EJBException;
import javax.jms.MessageListener;
import javax.jms.Message;
import javax.jms.TextMessage;
import javax.jms.JMSException;

* Created by IntelliJ IDEA.
* User: Yashar Kalantari
* Date: Oct 20, 2004
* Time: 4:19:47 PM
public class LogBean implements MessageDrivenBean, MessageListener {

MessageDrivenContext ctx;

public void ejbRemove() throws EJBException {
System.out.println("ejbRemove() Called.");

public void setMessageDrivenContext(MessageDrivenContext messageDrivenContext) throws EJBException {
System.out.println("setMessageDrivenContext() Called.");
this.ctx = messageDrivenContext;

public void ejbCreate() {
System.out.println("ejbCreate() Called.");

public void onMessage(Message message) {
System.out.println("a new Message!!!");
if(message instanceof TextMessage) {
TextMessage tm = (TextMessage)message;
try {
String text = tm.getText();
System.out.println("Recieved new message : " + text);
} catch (JMSException e) {


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' ''>


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "">

and the second one is a session bean that sends the message it seems the message is sending with no problem but the mdb is unable to recive it. maybe something is wrong with my jboss configuration? any suggestion?

thanks and regards
Ranch Hand
Posts: 416
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use WebSphere, so I don't know exactly where to look. But check your JMS server properties. Also, make sure your topic or queue settings are correct and the JNDI names match.

Also, you do need a JMS message service running for this to work. I am using IBM MQ. Make sure your message service is up and running.
[ December 28, 2004: Message edited by: M Burke ]
A timing clock, fuse wire, high explosives and a tiny ad:
Why should you try IntelliJ IDEA ?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!