Jochen Zink pisze:
Hello,

I'm using geronimo 2.0.1 and I try to send a simple textMessage to a JMSQueue.

First, I have configured a JMS-Ressource for ActiveMQ with the geronimo console. You can see the full DeploymentPlan at the end of this email.
The Connectionfactory becomes the name: MyFactory
The Destination becomes the name: MyQueue


Now, I have a simple WebApplication, with a simple Servlet, which trys to send 
a message to MyQueue

Here are the relevant code:
InitialContext jndiContext = getInitialContext();
QueueConnectionFactory factory = (QueueConnectionFactory) 
jndiContext.lookup("java:comp/env/MyFactory");
Queue queue = (Queue) jndiContext.lookup("java:comp/env/MyQueue");
QueueConnection connection = factory.createQueueConnection();
QueueSession session = connection.createQueueSession(true, 
Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = session.createProducer(queue);
TextMessage txtMsg = session.createTextMessage();
txtMsg.setText(vorgangPk);
producer.send( txtMsg );
connection.close();


On line 2 jndiContext.lookup("java:comp/env/MyFactory"); a 
NameNotFoundException is thrown (MyFactory not found).

I'm not sure what I do wrong. If anyone has an idea, it would be great.
There's no global jndi context with jms objects. I've developed small gbean to create bindings, but - I'm sure - you only need to know, that names of your objects are MyFactory, MyQueue. So, I would try to lookup from - imho correctly initialized context - Factory with lookup("MyFactory") and Queue with lookup("MyQueue) arguments. Try those names, I hope it will be working.

Beniamin

Reply via email to