Announcement Announcement Module
Collapse
No announcement yet.
MDB Spring 2.0 + Websphere 5.1.1 + WebSphere MQ 5.3 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MDB Spring 2.0 + Websphere 5.1.1 + WebSphere MQ 5.3

    Im trying to implement a MDB using Spring 2.0 new features.

    I have this configuration

    <bean id="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="resourceRef" value="false" />
    <property name="jndiName" value="jms/remocf" />
    </bean>

    <bean id="enviar" class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="resourceRef" value="false" />
    <property name="jndiName" value="jms/enviar" />
    </bean>

    <bean name="jmsTestTemplate" class="org.springframework.jms.core.JmsTemplate102 ">
    <property name="connectionFactory" ref="jmsConnectionFactory"/>
    <property name="defaultDestination" ref="enviar"/>
    </bean>

    <bean name="testService" class="test.TestServiceImpl">
    <property name="jmsTemplate" ref="jmsTestTemplate"/>
    </bean>

    <bean id="myMessageListenerContainer" class="org.springframework.jms.listener.DefaultMes sageListenerContainer102">
    <property name="connectionFactory" ref="jmsConnectionFactory"/>
    <property name="destinationName" value="enviar"/>
    <property name="messageListener" ref="myMessageListener"/>
    </bean>

    <bean id="myMessageListener" class="test.MyMessageListenerImpl"/>

    The connection factory and destination are ok because i can send a receive messages using them.

    MyMessageListenerImpl code is:

    package test;

    import javax.jms.JMSException;
    import javax.jms.Message;
    import javax.jms.Session;
    import javax.jms.TextMessage;

    import org.springframework.jms.listener.SessionAwareMessa geListener;

    public class MyMessageListenerImpl implements SessionAwareMessageListener {

    public void onMessage(Message message, Session session) throws JMSException {
    TextMessage textMessage = (TextMessage) message;
    System.out.println("message received: " + textMessage.getText());
    }

    }

    The problem is that when i Start the application server (WAS 5.1.1) i get this error:

    ERROR [org.springframework.jms.listener.DefaultMessageLis tenerContainer102] - Setup of JMS message listener invoker failed
    javax.jms.InvalidDestinationException: MQJMS2008: failed to open MQ queue
    at com.ibm.mq.jms.MQQueueSession.getQueueOpenExceptio n(MQQueueSession.java:925)
    at com.ibm.mq.jms.MQQueueSession.createReceiver(MQQue ueSession.java:332)
    at com.ibm.ejs.jms.JMSQueueReceiverHandle.<init>(JMSQ ueueReceiverHandle.java:137)
    at com.ibm.ejs.jms.JMSQueueSessionHandle.createReceiv er(JMSQueueSessionHandle.java:189)
    at org.springframework.jms.listener.DefaultMessageLis tenerContainer102.createConsumer(DefaultMessageLis tenerContainer102.java:77)
    at org.springframework.jms.listener.DefaultMessageLis tenerContainer.createListenerConsumer(DefaultMessa geListenerContainer.java:219)
    at org.springframework.jms.listener.DefaultMessageLis tenerContainer$AsyncMessageListenerInvoker.run(Def aultMessageListenerContainer.java:313)
    at org.springframework.core.task.SimpleAsyncTaskExecu tor$ConcurrencyThrottling

    It looks like the queue name is misconfigured ... but its ok because i send a receice messages from them !!!!

    package test;

    import javax.jms.JMSException;
    import javax.jms.Message;
    import javax.jms.Session;
    import javax.jms.TextMessage;

    import org.springframework.jms.core.JmsTemplate102;
    import org.springframework.jms.core.MessageCreator;

    public class TestServiceImpl implements TestService {

    private JmsTemplate102 jmsTemplate;

    public void setJmsTemplate(JmsTemplate102 jmsTemplate) {
    this.jmsTemplate = jmsTemplate;
    }

    public void testSendJms() {
    jmsTemplate.send(new MessageCreator() {
    public Message createMessage(Session session) throws JMSException {
    TextMessage message = session.createTextMessage();
    message.setText("Hola Jairo !!!");
    return message;
    }
    });
    System.out.println("mensaje enviado: Hola Jairo !!!");
    }

    public void testReceiveJms() {
    Message msg = jmsTemplate.receive();
    TextMessage textMessage = (TextMessage) msg;
    try {
    System.out.println("mensaje recibido: " + textMessage.getText());
    } catch (Exception e) {};
    }
    }

    I really dont know what is wrong. I need some help please !!!!

    Thanks
    Ignacio
Working...
X