wood burning stoves 2.0*
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
Author

my MDB does not recives any messages

Yashar Kalantari
Greenhorn

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

code:

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) {
e.printStackTrace();
}
}
}
}

ejb-jar.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
<ejb-jar>
<enterprise-beans>
<message-driven>
<ejb-name>Log</ejb-name>
<ejb-class>log.LogBean</ejb-class>
<transaction-type>Container</transaction-type>
<message-driven-destination>
<destination-type>javax.jms.Topic</destination-type>
</message-driven-destination>
</message-driven>
</enterprise-beans>
</ejb-jar>

jboss.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "http://www.jboss.org/j2ee/dtd/jboss.dtd">
<jboss>
<secure>false</secure>
<enterprise-beans>
<message-deriven>
<ejb-name>Log</ejb-name>
<destination-jndi-name>ejb/Log</destination-jndi-name>
</message-deriven>
</enterprise-beans>
</jboss>

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
yashar
M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 382
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: http://aspose.com/file-tools
 
subject: my MDB does not recives any messages
 
Similar Threads
JMS
MDB(Sorry for the last post .It was by mistake)This i want to ask
WL guru's - message bean not receiving messages from JMS
I get message to queue, but not to MDB Bean. So close yet so far!
JBoss 5.1 ejbCreate method not called on mdb