File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Spring JMS with IBM  Websphere MQ5.3.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Spring JMS with IBM  Websphere MQ5.3.1" Watch "Spring JMS with IBM  Websphere MQ5.3.1" New topic

Spring JMS with IBM Websphere MQ5.3.1

Palash Sahu

Joined: Dec 06, 2006
Posts: 13
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" />

<!-- JNDI Environment Template -->
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<prop key="java.naming.factory.initial">com.sun.jndi.fscontext.RefFSContextFactory</prop>
<prop key="java.naming.provider.url">file:/C:/JNDI-Directory</prop>

<!-- JMS Queue Connection Factory -->
<bean id="internalJmsQueueConnectionFactory"
<property name="jndiTemplate">
<ref bean="jndiTemplate"/>
<property name="jndiName">

<!-- Spring JMS Queue Connection Factory -->
<bean id="jmsQueueConnectionFactory"
<property name="targetConnectionFactory">
<ref bean="internalJmsQueueConnectionFactory"/>
<property name="pubSubDomain">

<!-- Destination -->
<bean id="jmsDestination" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate"/>
<property name="jndiName">

<!-- JMS Template -->
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate102">
<property name="connectionFactory">
<ref bean="jmsQueueConnectionFactory"/>
<property name="defaultDestination">
<ref bean="jmsDestination"/>
<property name="receiveTimeout">

<!-- JMS Sender -->
<bean id="messageSender" class="com.anshinsoft.pi.MessageSender">
<property name="jmsTemplate">
<ref bean="jmsTemplate"/>

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.
I agree. Here's the link:
subject: Spring JMS with IBM Websphere MQ5.3.1
It's not a secret anymore!