no response in message-driven bean!
aupres Dec 30, 2011 3:55 AMI try to execute message-driven bean by using jboss 7 and eclipse indigo.
First, I inserted a few codes into standalone.xml. The codes are
.......
<extension module="org.jboss.as.messaging"/>
.......
<subsystem xmlns="urn:jboss:domain:messaging:1.0">
<persistence-enabled>
false
</persistence-enabled>
..........
<connectors>
<netty-connector name="netty" socket-binding="messaging"/>
<netty-connector name="netty-throughput" socket-binding="messaging-throughput">
<param key="batch-delay" value="50"/>
</netty-connector>
<in-vm-connector name="in-vm" server-id="0"/>
</connectors>
..........
<jms-destinations>
<jms-queue name="testQueue">
<entry name="queue/testQueue"/>
</jms-queue>
<jms-topic name="testTopic">
<entry name="topic/test"/>
</jms-topic>
</jms-destinations>
</subsystem>
............
<socket-binding name="messaging" port="5445"/>
<socket-binding name="messaging-throughput" port="5455"/>
.....
When executing Jboss 7, console shows the message queue was deployed.
17:29:14,250 정보 [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-3) HornetQ Server version 2.2.7.Final (HQ_2_2_7_FINAL_AS7, 121) [532fd29a-3077-11e1-b630-90e6bab7cd02] started
17:29:14,250 정보 [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-3) trying to deploy queue jms.queue.testQueue
17:29:14,453 INFO [org.jboss.as.messaging.jms.AS7BindingRegistry] (MSC service thread 1-3) Bound messaging object to jndi name java:/queue/testQueue
17:29:14,453 정보 [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-1) trying to deploy queue jms.topic.testTopic
17:29:14,468 INFO [org.jboss.as.messaging.jms.AS7BindingRegistry] (MSC service thread 1-1) Bound messaging object to jndi name java:/topic/test
17:29:14,485 INFO [org.jboss.as.messaging.jms.AS7BindingRegistry] (MSC service thread 1-2) Bound messaging object to jndi name java:/ConnectionFactory
17:29:14,485 INFO [org.jboss.as.messaging.jms.AS7BindingRegistry] (MSC service thread 1-4) Bound messaging object to jndi name java:/RemoteConnectionFactory
And I made message-driven bean with Message Driven Bean Wizard of eclipse indigo.
Value of Destination Name is queue/testQueue and Destination Type is Queue. Transaction type is Bean.
Generated codes are like below :
package com.aaa.jms;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.Message;
import javax.jms.MessageListener;
@MessageDriven(
activationConfig = { @ActivationConfigProperty(
propertyName = "destinationType", propertyValue = "javax.jms.Queue"
) },
mappedName = "queue/testQueue")
public class JMSBean implements MessageListener {
public JMSBean() {
// TODO Auto-generated constructor stub
}
public void onMessage(Message message) {
// TODO Auto-generated method stub
System.out.println("I got Message"); // No response !!
}
}
Client is jsp file
<body>
<%
try {
Context ctx = new InitialContext();
QueueConnectionFactory qcf = (QueueConnectionFactory) ctx.lookup("/ConnectionFactory");
Queue queue = (Queue) ctx.lookup("queue/testQueue");
QueueConnection conn = qcf.createQueueConnection();
QueueSession qs = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
conn.start();
TextMessage msg = qs.createTextMessage();
msg.setText("hello");
MessageProducer producer = qs.createProducer(queue);
producer.send(msg);
out.println("Done");
producer.close();
qs.close();
conn.close();
} catch (Exception e) {
out.println(e.getMessage());
}
%>
</body>
Client threw no exception.But No response either! It seems queue doesn't send recieved-message to Message driven bean.
I have no idea what process I missed. Pls, inform me.
Best Regards!