File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes my MDB does not recives any messages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "my MDB does not recives any messages" Watch "my MDB does not recives any messages" New topic

my MDB does not recives any messages

Yashar Kalantari

Joined: Sep 19, 2004
Posts: 12
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
M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 397
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 ]
I agree. Here's the link:
subject: my MDB does not recives any messages
It's not a secret anymore!