File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes java code to send message to JMS queue with out JNDI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "java code to send message to JMS queue with out JNDI" Watch "java code to send message to JMS queue with out JNDI" New topic

java code to send message to JMS queue with out JNDI

Ravindra Talari

Joined: Dec 04, 2012
Posts: 1
Hi Everyone,

Actually I am working on TIBCO, One of our partner does not has TIBCO environment, He wants to send messages to our JMS server. We are thinking that we can write java code to send messages to JMS queue. I have written below java code, I am getting the below error. Please suggest ..thanks in advance.

Dec 5, 2012 12:16:27 PM com.sun.messaging.jmq.jmsclient.ExceptionHandler logCaughtException
WARNING: [I500]: Caught JVM Exception: Connection reset
Exception in thread "main" com.sun.messaging.jms.JMSException: [C4000]: Packet acknowledge failed. user=empty/blank, broker=localhost:7222


ConnectionFactory connFactory =new com.sun.messaging.ConnectionFactory();
connFactory.setProperty(com.sun.messaging.ConnectionConfiguration.imqAddressList,new String("mqtcp://localhost:7222/"));

// create a queue connection
QueueConnection queueConn = connFactory.createQueueConnection();

// create a queue session
QueueSession queueSession = queueConn.createQueueSession(false,

// create a queue sender

QueueSender queueSender = queueSession.createSender((Queue)(new com.sun.messaging.Queue("")));

// create a simple message to say "Hello"
TextMessage message = queueSession.createTextMessage("Hello");

// send the message

// print what we did
//System.out.println("sent: " + message.getText());

// close the queue connection
Even I tried to create like below

MQQueueConnectionFactory connFactory=new;

I am getting the below error.

xception in thread "main" java.lang.UnsatisfiedLinkError: no mqjbnd05 in java.library.path
Bill Gorder

Joined: Mar 07, 2010
Posts: 1682

Have a look here:

[How To Ask Questions][Read before you PM me]
I agree. Here's the link:
subject: java code to send message to JMS queue with out JNDI
It's not a secret anymore!