I'm trying to connect to a JMS queue from a stateless session bean.
I got the feeling I am missing something, I get a
javax.naming.NameNotFoundException: jms/SyncQueue not found
Here is what I have,
my jms.xml has an entry like this:
<jms-server port="9127">
<!--I tried with or without this queue-connection-factory, same
error-->
<queue-connection-factory location="jms/QueueConnectionFactory" />
<queue name="syncqueue" location="jms/SyncQueue">
<description>Some queue for testing</description>
</queue>
</jms-server>
my ejb-jar.xml session bean has the following:
<session>
...
<resource-env-ref>
<resource-env-ref-name>jms/SyncQueue</resource-env-ref-name>
<resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
</resource-env-ref>
<resource-ref>
<res-ref-name>jms/QueueConnectionFactory</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>
And the code in my session bean is as follow:
....
context = new InitialContext();
QueueConnectionFactory queueConnectionFactory =
(QueueConnectionFactory)
context.lookup("java:comp/env/jms/QueueConnectionFactory");
/* The line below throws the javax.naming.NameNotFoundException:
jms/SyncQueue not found */
Queue syncQueue = (Queue)
context.lookup("java:comp/env/jms/SyncQueue");
....
I must be blind to something, what am I doing wrong ?
Thanks,
Christian