webtier@glassfish.java.net

how to bind JMS connection factory/queue in web.xml?

From: <webtier_at_javadesktop.org>
Date: Thu, 17 Jul 2008 19:31:40 PDT

Hi,

I'm trying to define a JMS connection factory and a message queue for my web component. I tried something like this in the web.xml:

<!-- JMS Connection Factories (java:comp/env/jms/jwangConnectionFactory) -->
<resource-ref>
<description>Default JMS Connection Factory</description>
<res-ref-name>jms/jwangConnectionFactory</res-ref-name>
<res-type>javax.jms.ConnectionFactory</res-type>
<res-auth>Container</res-auth>
</resource-ref>

<!-- JMS Queue -->
<resource-ref>
<description>Default JMS Queue Destination</description>
<res-ref-name>jms/jwangMsgQueue</res-ref-name>
<res-type>javax.jms.Queue</res-type>
<res-auth>Container</res-auth>
</resource-ref>

I also have tried to define the repective <refource-ref> elements in "sun-web.xml" as well. That is, both "web.xml" and "sun-web.xml" are defined.

My web app log shows this error:
"javax.naming.NameNotFoundException: No object bound to name java:comp/env/jms/jwangConnectionFactory"

The connection factory and queue were defined via the admin web interface.

Injection with annotation @Resource(mappedName="jms/jwangConnectionFactory") into one of the EJB was working fine.

The ejb ref and jdbc datasource defined in the same web.xml were working fine.

My question:
1, which element it should use to define a JMS resource? "resource-ref" or "resource-env-ref"(not working either) or something else?
2, why it's not working in my example.

Thanks for your help
[Message sent by forum member 'classfish' (classfish)]

http://forums.java.net/jive/thread.jspa?messageID=287458