Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jms client

 
ranga shreya
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
I have an assignment to write a jms client code. Sending an message from a servlet to a queue. getting the messages from the queue through messagedrivenbean.My question is Iam not abel to put the message through the servelt what might be the reason.
this is my code..
Context jndiContext = null;
ConnectionFactory connectionFactory = null;

Destination dest = null;
//ConnectionFactory connectionFactory = null;

try {
connectionFactory = (ConnectionFactory)
jndiContext.lookup("emailCf");
dest = (Destination) jndiContext.lookup("emailJmsQueue");
Connection connection =
connectionFactory.createConnection();
Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = session.createProducer(dest);
TextMessage message = session.createTextMessage();
message.setText("This is message 1" );
System.out.println("Sending message: " +message.getText());
producer.send(message);



}
catch (Exception e) {
System.out.println("JNDI API lookup failed: " +
e.toString());
e.printStackTrace();
System.exit(1);
}
 
Evil is afoot. But this tiny ad is just an ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!