Hello Everyone!
I just started experimentation with JMS on JBoss3.2.1. I wrote a small jsp page which tries to post a message to a Queue. I created the queue by putting a queue-service.xml in the deploy directory.
I was able to get the jndi lookup to QueueConenctionFactory . but when I do a jndi lookup to the queue, it fails by throwing an error saying queue not bound. I have tried all possible things to correct this but I have failed. So I am turning to the forum for some enlightenement.
Here is the jsp code ! (I have just put the java code alone here!)
<%
try {
InitialContext ctx;
QueueConnectionFactory cf;
QueueConnection connection;
QueueSession session;
Queue destination;
QueueSender sender;
TextMessage message;
ctx = new InitialContext();
cf = (QueueConnectionFactory)ctx.lookup("java:/JmsXA");
destination = (Queue)ctx.lookup("queue/RameshQueue");
connection = cf.createQueueConnection();
session = connection.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
sender = session.createSender(destination);
message = session.createTextMessage();
message.setText(Message);
System.out.println("Sending Message.");
sender.send(message);
connection.close();
System.out.println("Done.");
}
catch(Exception e)
{
}
%>
The queue-service.xml file
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
If you're just starting out, why not use JBoss 3.2.6?
Refer to the JBoss getting started doc: Go to the JMX console and use the JNDI view tool to find out where your queue is bound.