Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

jms configuration in jboss with mysql

Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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) {
First, you drop a couch from the plane, THEN you surf it. Here, take this tiny ad with you:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic