File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jms configuration in jboss with mysql

djyoti sahu
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JMS Setup in JBOSS with mysql:
1.Remove hsqldb-jdbc2-service.xml from $JBOSS_HOME/server/default/deploy/jms/ directory
2.Copy $JBOSS_HOME/docs/examples/jms/mysql-jdbc2-service.xml to $JBOSS_HOME/server/default/deploy/jms/
3.Modify name in mysql-jdbc2-service.xml with your name given in mysql-ds.xml (This is in deploy/jms directory)

Ex:in my application name of datasource is myatlasdbpool
<mbean code="" name="">
<depends optional-attribute-name="ConnectionManager">jboss.jca:service=LocalTxCM,name=myatlasdbpool</depends>
4.Choose or enter new desitination name in jbossmq-destinations-service.xml (This is in deploy/jms directory)
<mbean code="" name=",name=ex">
<depends optional-attribute-name="DestinationManager"></depends>
5.Set RecursiveSearch as "True" in jboss-service.xml (This is in default/conf directory)
<attribute name="RecursiveSearch">True</attribute>
6.Make <create-table>true</create-table> in jbosscmp-jdbc.xml config files


7.Example Entry in ejb-jar.xml
8.Example Entry in jboss.xml, here the prefix "queue/" is a must, we will use this name from the caller
9.Example calling code:

import javax.jms.*;

try {
javax.naming.Context ctx = new InitialContext();
QueueConnectionFactory qcf = (QueueConnectionFactory)ctx.lookup("ConnectionFactory");
QueueConnection qConn = qcf.createQueueConnection();
QueueSession qSession = qConn.createQueueSession(false,1);
Queue q = (Queue) ctx.lookup("queue/ex");
QueueSender sender = qSession.createSender(q);
TextMessage msg = qSession.createTextMessage();
msg.setText("Hello from Shivdeep!");
catch(Exception e) {
10.Message Driven Bean:
import javax.jms.MessageListener;
import javax.ejb.MessageDrivenBean;
import javax.jms.Message;
import javax.ejb.MessageDrivenContext;
public class SendMessageMDB implements MessageDrivenBean, MessageListener {

private MessageDrivenContext ctx;

public void setMessageDrivenContext(MessageDrivenContext ctx) {
this.ctx = ctx;
public void ejbCreate() { }
public void ejbRemove() {
ctx = null;
public void onMessage(Message msg) {
I agree. Here's the link:
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic