Announcement Announcement Module
Collapse
No announcement yet.
JmsTemplate102 MQJMS2008 error Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JmsTemplate102 MQJMS2008 error

    All,

    I am using the JmsTemplate102 class to send a text message.


    Code:
    public void sendMessage(final String txtMessage){
    		jmsTemplate.send(
    			new MessageCreator(){
    				public Message createMessage(Session session)
    					throws JMSException{
    						Message message = session.createTextMessage(txtMessage);
    						return message;
    				}
    			}
    		);
    	}
    When I execute the code above, everything works great and I receive my message on the other side. When I try to manually set the destination (because depending on the contents of the message, I send to different locations), I get the following MQ error:

    Code:
    MQJMS2008: failed to open MQ queue OFMQueue; nested exception is javax.jms.InvalidDestinationException: MQJMS2008: failed to open MQ queue OFMQueue; nested exception is javax.jms.InvalidDestinationException: MQJMS2008: failed to open MQ queue OFMQueue
    Here is the code I am trying:

    Code:
    public void sendMessage(final String txtMessage){
    		jmsTemplate.send("OFMQueue",
    			new MessageCreator(){
    				public Message createMessage(Session session)
    					throws JMSException{
    						Message message = session.createTextMessage(txtMessage);
    						return message;
    				}
    			}
    		);
    	}
    Here is my wiring:

    Code:
    <!-- Configuration for JMS 1.0.2 -->
    	<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate102">
    		<property name="connectionFactory">
    			<ref bean="jmsConnectionFactory"/>
    		</property>
    		<property name="defaultDestination">
    			<ref bean="destination"/>
    		</property>
    		<property name="pubSubDomain">
    			<value>false</value>
    		</property>
    	</bean>
    	<bean id="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
    		<property name="jndiName">
    			<value>OFMConnectionFactory</value>
    		</property>
    	</bean>
    	<bean id="destination" class="org.springframework.jndi.JndiObjectFactoryBean">
    		<property name="jndiName">
    			<value>OFMQueue</value>
    		</property>
    	</bean>
    Any ideas?
Working...
X