• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MDB deployment using WAS 5.1 and WebsphereMQ

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have successfully installed Websphere MQ (v5.3) and WAS 5.1 . I have created a MDB in my ear which basically is supposed to lookup a queue in the WebSphereMQ , and just print the message to screen.
I created the queue, it connectionfactory etc using JMSAdmin.
Next i then created a Listener Port in WAS5.1 which i called as "MQSeriesJMS" which bascially had the
Connection factory JNDI name as jms/ivtQCF
Destination JNDI name as jms/ivtQ.

Next i created the Websphere JMS Provider as follows :
WebSphere Queue Connection Factories -->
Name --> ivtOCF
JNDI Name --> jms/ivtQCF

Simialrly the WebSphere Queue Destination Factories -->
Name --> ivtQ
JNDI Name --> jms/ivtQ

Also in the web.xml i defined the follwing:

< resource-ref id="ResourceRef_1034735563261" >
< res-ref-name > jms/ivtQCF </ res-ref-name >
< res-type > javax.jms.QueueConnectionFactory </ res-type >
< res-auth > Application </ res-auth >
</ resource-ref >
< resource-ref id="ResourceRef_1034735563281" >
< res-ref-name > jms/ivtQ </ res-ref-name >
< res-type > javax.jms.Queue </ res-type >
< res-auth > Application </ res-auth >
</ resource-ref >

And in the ejb-jar.xml its as follows :

< message-driven id="SalesMDB" >
< display-name > SalesMDB </ display-name >
< ejb-name > SalesMDB </ ejb-name >
< ejb-class > com.infocorpnow.a2g.messageobjects.SalesMDB </ ejb-class >
< transaction-type > Container </ transaction-type >
< message-driven-destination >
< destination-type > javax.jms.Queue </ destination-type >
</ message-driven-destination >
</ message-driven >

I then restarted my server, deployed the ear and in the option for Listener Port Name during my ear deployment i gave it the name "MQSeriesJMS".

The code i use in my SessionBean to send the messaeg to the queue is :

String QMGR = "QM_aanchal";
String QUEUE= "anchal" ;
String qcfLookup = "ivtQCF";
String qLookup= "ivtQ";
javax.jms.Queue ioQueue = null;
QueueSession session= null;
QueueConnection connection = null;
QueueConnectionFactory factory = null;
Context ctx = null;
String icf = "com.sun.jndi.fscontext.RefFSContextFactory";
String url = null;
String outString="TESTING QM via JMS with CustomerSBIMPL";
boolean transacted = false;

try
{
ctx = new InitialContext();
factory = (QueueConnectionFactory)ctx.lookup("java:comp/env/jms/ivtQCF");
System.out.println("factory==>"+factory);
((MQQueueConnectionFactory)factory).setQueueManager(QMGR);
connection = factory.createQueueConnection();
ioQueue=(javax.jms.Queue)ctx.lookup("java:comp/env/jms/ivtQ");
System.out.println("queue=====>"+ioQueue);
session = connection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
QueueSender queueSender = session.createSender(ioQueue);
TextMessage outMessage = session.createTextMessage();
System.out.println("Adding Text");
outMessage.setText(xmlinput);
queueSender.send(outMessage);
}
catch(Exception e)
{
}

**************************************************************************

When i call the above method in my application i get the follwoing error:

javax.naming.NameNotFoundException: Context: aanchal/nodes/aanchal/servers/server1, name: jms/ivtQCF: First component in name jms/ivtQCF not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL mg.org/CosNaming/NamingContext/NotFound:1.0]

**************************************************************************

Not sure what is it that i am missing out on.
Incase anyone can help me please let me know.

thanx
aanchal.
 
Seriously? That's what you're going with? I prefer this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic