May 11, 2012

JMS Message Destination Error

In this example i am trying to create a Point to Point messaging service. i am using JEE 5 and Glassfish. I encountered the following error message when using annotations.

SEVERE: NAM0007 : Message Destination Reference java:comp/env/jms/p2pQueue has not been linked to a Message Destination
15-Sep-2009 17:02:38 com.sun.enterprise.appclient.MainWithModuleSupport
WARNING: ACC003: Application threw an exception.
javax.naming.NamingException: Message Destination Reference java:comp/env/jms/p2pQueue has not been resolved
at com.sun.enterprise.naming.NamingManagerImpl.bindObjects(NamingManagerImpl.java:521)
at com.sun.enterprise.appclient.AppContainer.preInvoke(AppContainer.java:137)
at com.sun.enterprise.appclient.MainWithModuleSupport.(MainWithModuleSupport.java:383)
at com.sun.enterprise.appclient.MainWithModuleSupport.(MainWithModuleSupport.java:259)
at com.sun.enterprise.appclient.Main.main(Main.java:200)



This is caused by the following incorrect @Resource references.

@Resource(name = "jms/p2pQueue")
private static Queue p2pQueue;
@Resource(name = "jms/QueueConnectionFactory")
private static ConnectionFactory p2pQueueFactory;


The correct annotation should be

@Resource(mappedName = "jms/p2pQueue")
private static Queue p2pQueue;
@Resource(
mappedName = "jms/QueueConnectionFactory")
private static ConnectionFactory p2pQueueFactory;




No comments: