This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring Boot in Practice and have Somnath Musib on-line!
See this thread for details.
Win a copy of Spring Boot in Practice this week in the Spring 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Message apparantly not getting to Queue or MDB from Java Client

Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am trying to write a message to a queue from a simple Java Client using Weblogic Workshop 8.1. The code runs to completion, yet the Admin console shows no messages or bytes received and there is no output from the message bean showing that it received anything.

The client and an MDB are part of the same application,
but are in different projects. The Server log does not show any glowing errors. My code is shown below as fragments. Any help would be greatly appreciated!!!

Thank you,


* @ejbgen:message-driven
* ejb-name = Synch
* destination-jndi-name="SynchQueue"
* destination-type = javax.jms.Queue
public class SynchMDBBean extends GenericMessageDrivenBean implements MessageDrivenBean, MessageListener
public void onMessage(Message msg) {
System.out.println("Synch queue got message");

CLIENT CODE (getInitialContext shown below)
Context ic = getInitialContext("t3://localhost:7001", "weblogic", "weblogic");
//factory = (QueueConnectionFactory) ic.lookup("java:comp/env/jms/QueueConnectionFactory");
factory = (QueueConnectionFactory) ic.lookup("weblogic.jws.jms.QueueConnectionFactory");
queue = (Queue) ic.lookup("SynchQueue");

transaction t = new orders(11111111,"YA","YA","SB","EEE","0001","TA26",1,1,1000,1000,

QueueConnection connect = factory.createQueueConnection();
QueueSession session = connect.createQueueSession(true,Session.AUTO_ACKNOWLEDGE);
QueueSender sender = session.createSender(queue);

ObjectMessage message = null;

message = session.createObjectMessage(t);// throws JMSException;

static Context getInitialContext(String url, String user, String password) {
InitialContext p =null;
Hashtable h = new Hashtable();
h.put(Context.PROVIDER_URL, url);
//h.put(Context.SECURITY_PRINCIPAL, user);
// h.put(Context.SECURITY_CREDENTIALS, password);
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My suggestion is to drop the transaction attribute from the QueueSession and make sure you properly close your resources. Would look something like this:

If this went anywhere beyond the simple example I would extract out the code in the finally block into a utility class to avoid copy-and-paste code.
[ April 11, 2006: Message edited by: Chris Mathews ]
Ken Rubin
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Either not using the transaction class or closing the connections has
gotten this to work. Will find out which one,

I thank you because I was (figuratively) knocking my head against the wall!

Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic