posted 17 years ago
Hi,
I am using JMS provider as IBM Websphere MQ5.3.1.
Message sending and receiving is working fine with jmsTemplate.
But when I am writing MessageDrivenPOJO class using DefaultMessageListenerContainer or MessageListenerAdapter,then I am getting error.
I have set up websphre MQ correctly.Added all required jars to the classpath.I have created QManager and Queue.Then inialized jndi. After that I binded instance of QueueConnectonFactory and Queue. My bean configuration file is as follows:-
<!-- description of the suite context -->
<description>This file defines beans of Message driven POJO and Message Listener Container</description>
<!-- this is the Message Driven POJO (MDP) -->
<bean id="msgDrivenPOJOId" class="com.anshinsoft.pi.messaging.MessageDrivenPOJOImpl"/>
<!-- and this is the message listener container -->
<bean id="listenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="concurrentConsumers" value="5"/>
<property name="connectionFactory" ref="jmsQueueConnectionFactory" />
<property name="destination" ref="jmsDestination" />
<property name="messageListener" ref="msgDrivenPOJOId" />
</bean>
<!-- JNDI Environment Template -->
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">com.sun.jndi.fscontext.RefFSContextFactory</prop>
<prop key="java.naming.provider.url">file:/C:/JNDI-Directory</prop>
</props>
</property>
</bean>
<!-- JMS Queue Connection Factory -->
<bean id="internalJmsQueueConnectionFactory"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate"/>
</property>
<property name="jndiName">
<value>jmsQCF1</value>
</property>
</bean>
<!-- Spring JMS Queue Connection Factory -->
<bean id="jmsQueueConnectionFactory"
class="org.springframework.jms.connection.SingleConnectionFactory102">
<property name="targetConnectionFactory">
<ref bean="internalJmsQueueConnectionFactory"/>
</property>
<property name="pubSubDomain">
<value>false</value>
</property>
</bean>
<!-- Destination -->
<bean id="jmsDestination" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate"/>
</property>
<property name="jndiName">
<value>jmsspringQueue1</value>
</property>
</bean>
<!-- JMS Template -->
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate102">
<property name="connectionFactory">
<ref bean="jmsQueueConnectionFactory"/>
</property>
<property name="defaultDestination">
<ref bean="jmsDestination"/>
</property>
<property name="receiveTimeout">
<value>30000</value>
</property>
</bean>
<!-- JMS Sender -->
<bean id="messageSender" class="com.anshinsoft.pi.MessageSender">
<property name="jmsTemplate">
<ref bean="jmsTemplate"/>
</property>
</bean>
I think websphre mq(version 5.3.1) does support spring's new feature like DefaultMessageListenerContainer or MessageListenerAdapter.
I will be oblized for any kind of help and active participation to this topic.