Announcement Announcement Module
Collapse
No announcement yet.
WebSphere MQ 6 + Spring 3.1 recevies AbstractMethodError Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • WebSphere MQ 6 + Spring 3.1 recevies AbstractMethodError

    I am trying to setup a basic DMLC and can't seem to instantiate the listener without a fatal error.

    Here's my configuration:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:jms="http://www.springframework.org/schema/jms"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
    http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-3.1.xsd">
    
    <!-- enables annotation based configuration -->
    <context:annotation-config />
    <!-- scans for annotated classes in the com.company package -->
    <context:component-scan base-package="com.wfb.bulk"/>
    <!-- creates an mq connection factory  -->
    <bean id="mqConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
    	<property name="transportType"><value>1</value></property>
    	<property name="hostName"><value>${input.mq.hostname}</value></property>
    	<property name="port"><value>${input.mq.port}</value></property>
    	<property name="queueManager"><value>${input.mq.queuemanager}</value></property>
    	<property name="channel"><value>${input.mq.channel}</value></property>
    </bean>
    	
    <!-- CachingConnectionFactory Definition, sessionCacheSize property is the number of sessions to cache -->
    <bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
        <constructor-arg ref="mqConnectionFactory" />
        <property name="exceptionListener" ref="indexExceptionListener" />
        <property name="sessionCacheSize" value="100" />
    </bean>
    
    	<!-- this is the Message Driven POJO (MDP) -->
    	<bean id="indexControlListener" class="com.wfb.bulk.utils.IndexListener"/>
    	
    	<bean id="controlQueue" class="com.ibm.mq.jms.MQQueue" depends-on="connectionFactory">
    		<property name="baseQueueManagerName" value="${input.mq.queuemanager}"/>
    		<property name="baseQueueName" value="${input.mq.controlq}"/>
    		<property name="targetClient" value="1"/>
    		<property name="persistence" value="-1"/>
    	</bean>
    
    
    	<!-- and this is the message listener container -->
    	<bean id="indexListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer102">
      		<property name="connectionFactory" ref="connectionFactory"/>
      		<property name="destination" ref="controlQueue"/>
      		<property name="messageListener" ref="indexControlListener" />
      		<property name="concurrentConsumers" value="5"/>
    		<property name="cacheLevelName" value="CACHE_CONNECTION"/>
    		<property name="autoStartup" value="true"/>
    		<property name="recoveryInterval" value="2000"/>
    	</bean>
    </beans>
    Here is my ever-so-basic listener:

    Code:
    package com.basic.listener;
    
    import javax.jms.BytesMessage;
    import javax.jms.JMSException;
    import javax.jms.Message;
    import javax.jms.MessageListener;
    import javax.jms.TextMessage;
    
    import org.springframework.stereotype.Component;
    
    @Component
    public class IndexListener implements MessageListener
    {
        public void onMessage( final Message message )
        {
        	Debug.log("onMessage triggered");
            if ( message instanceof TextMessage )
            {
                final TextMessage textMessage = (TextMessage) message;
                try
                {
                    System.out.println( textMessage.getText() );
                }
                catch (final JMSException e)
                {
                    e.printStackTrace();
                }
            } else {
            	
            	System.out.println("Raw message: " + message.toString());
            	BytesMessage msg = (BytesMessage) message;
            	System.out.println ("Raw message: " + msg.toString());
            }
        }
    }
    Despite analyzing this and looking for gaps, this is what I see when I attempt to run the code:

    Code:
    13139 [indexListenerContainer-3] WARN org.springframework.jms.listener.DefaultMessageListenerContainer102  - Setup of JMS message listener invoker failed for destination 'queue://QM/MY.CONTROL.QUEUE?persistence=-1&targetClient=1' - trying to recover. Cause: com.ibm.mq.jms.MQQueueSession.createConsumer(Ljavax/jms/Destination;Ljava/lang/String;)Ljavax/jms/MessageConsumer;
    java.lang.AbstractMethodError: com.ibm.mq.jms.MQQueueSession.createConsumer(Ljavax/jms/Destination;Ljava/lang/String;)Ljavax/jms/MessageConsumer;
    	at org.springframework.jms.connection.CachingConnectionFactory$CachedSessionInvocationHandler.getCachedConsumer(CachingConnectionFactory.java:390)
    	at org.springframework.jms.connection.CachingConnectionFactory$CachedSessionInvocationHandler.invoke(CachingConnectionFactory.java:330)
    	at $Proxy5.createReceiver(Unknown Source)
    	at org.springframework.jms.listener.DefaultMessageListenerContainer102.createConsumer(DefaultMessageListenerContainer102.java:104)
    	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.createListenerConsumer(AbstractPollingMessageListenerContainer.java:224)
    	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:308)
    	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:264)
    	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1071)
    	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1063)
    	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:960)
    	at java.lang.Thread.run(Thread.java:662)
    13139 [indexListenerContainer-3] INFO org.springframework.jms.listener.DefaultMessageListenerContainer102  - Successfully refreshed JMS Connection
    13139 [indexListenerContainer-4] DEBUG org.springframework.jms.connection.CachingConnectionFactory  - Found cached JMS Session for mode 1: com.ibm.mq.jms.MQQueueSession@114a306
    13139 [indexListenerContainer-4] DEBUG org.springframework.jms.connection.CachingConnectionFactory  - Returned cached Session: com.ibm.mq.jms.MQQueueSession@114a306
    I've tried some obvious changes such as using DefaultMessageListenerContainer without the 1.02 JMS interface but that gives me a different error.

    I've tried looking though this example for anything obvious but I always come up empty. Do you see anything wrong?

    Thanks,

    AD

  • #2
    Update: Using Spring 2.5.x with some configuration altered to support the lesser version shows this works.

    I feel there is some kind of integration error between WebSphere JMS and Spring 3.x causing the AbstractMethodError

    Comment

    Working...
    X