Spring Upgrade: Spring Integration JMS java.lang.AbstractMethodError: org.springframework.integration.config.xml.AbstractRouterParser.parseRouter

Issue

I am getting the below error while deploying my application in Weblogic. The functionality was working fine with the older Spring version. After upgrading the spring from 2 to 4, we are getting this error :

java.lang.AbstractMethodError:
org.springframework.integration.config.xml.AbstractRouterParser.parseRouter(Lorg/w3c/dom/Element;Lorg/springframework/beans/factory/support/BeanDefinitionBuilder;Lorg/springframework/beans/factory/xml/ParserContext;)V

Below is the XML file content :

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:beans="http://www.springframework.org/schema/beans" 
xmlns:ctx="http://www.springframework.org/schema/context"   
xmlns:int="http://www.springframework.org/schema/integration" 
xmlns:jms="http://www.springframework.org/schema/integration/jms"
xmlns:stream="http://www.springframework.org/schema/integration/stream" 
xmlns:si-xml="http://www.springframework.org/schema/integration/xml" 
xmlns:util="http://www.springframework.org/schema/util" 
xsi:schemaLocation="http://www.springframework.org/schema/beans 
  http://www.springframework.org/schema/beans/spring-beans-4.3.xsd 
  http://www.springframework.org/schema/context 
  http://www.springframework.org/schema/context/spring-context-4.3.xsd 
  http://www.springframework.org/schema/integration 
  http://www.springframework.org/schema/integration/spring-integration-4.3.xsd 
  http://www.springframework.org/schema/integration/jms
  http://www.springframework.org/schema/integration/jms/spring-integration-jms-4.3.xsd 
  http://www.springframework.org/schema/integration/stream 
  http://www.springframework.org/schema/integration/stream/spring-integration-stream-4.3.xsd 
  http://www.springframework.org/schema/integration/xml 
  http://www.springframework.org/schema/integration/xml/spring-integration-xml-4.3.xsd 
  http://www.springframework.org/schema/util 
  http://www.springframework.org/schema/util/spring-util.xsd">
  
<ctx:component-scan base-package="com.abc.xyz"/>    

<beans:bean id="resultToDocumentTransformer" class="org.springframework.integration.xml.transformer.ResultToDocumentTransformer"/>  
<beans:bean id="resultToStringTransformer"   class="org.springframework.integration.xml.transformer.ResultToStringTransformer"/>
<int:channel id="PBWCMAuditInputChannel"/>
<int:channel id="PBWCMInputJMSChannel"/>
<jms:message-driven-channel-adapter id="PBWCMInputJMSAdapter"
  destination="FMOB_IN" extract-payload="true" 
  connection-factory="connectionFactory" 
  channel="PBWCMAuditInputChannel" 
  error-channel="errorChannel"/>
<int:service-activator id="PBWCMMessageAuditor" 
input-channel="PBWCMAuditInputChannel" 
output-channel="PBWCMInputJMSChannel"
ref="mobileMessageAuditor"
method="auditRequest"/>
<si-xml:xpath-router id="wcmRequestRouter" input-channel="PBWCMInputJMSChannel">
 <si-xml:mapping value="WCM" channel="WCMChannel"/>
  </si-xml:xpath-router>
<si-xml:xpath-router id="WCMRequestRouter" input-channel="WCMChannel">
  <si-xml:xpath-expression expression="/faml/request/scrseqnumber"/>
  <si-xml:mapping value="01" channel="WCM01ValidateChannel"/>
</si-xml:xpath-router>
<int:channel id="WCM01ValidateChannel"/>
<si-xml:validating-filter id="WCM01Validator" 
input-channel="WCM01ValidateChannel" 
output-channel="WCM01InChannel"  
schema-location="classpath:xsd/request/WCM_01_Request.xsd" 
discard-channel="invalidMessageChannel"/>   
<int:channel id="WCM01InChannel"/>
<int:channel id="WCM01OutChannel"/>     
<si-xml:unmarshalling-transformer id="WCM01Unmarshaller" unmarshaller="WCM01ReqUnmarshaller"
  input-channel="WCM01InChannel"
  output-channel="WCM01OutChannel"/>    
<int:channel id="WCM01ResponseChannel" />   
<int:service-activator id="WCM01ServiceActivator" 
input-channel="WCM01OutChannel" 
output-channel="WCM01ResponseChannel" 
ref="WCMRequestProcessor"
method="processWCM01Request"/>  
<jms:outbound-channel-adapter id="WCM01ResponseOutAdapter" destination="responseQueue" channel="WCM01ResponseChannel"/> 
<beans:bean id="WCM01ReqUnmarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> 
<beans:property name="contextPaths">
  <beans:list>
    <beans:value>com.abc.xyz.jms.jaxb.WCM_01_request</beans:value>
  </beans:list>
</beans:property>
</beans:bean>
</beans:beans>

The JARs available in the lib folder are

org.springframework.integration-1.0.3.RELEASE.jar
org.springframework.integration.jms-1.0.3.RELEASE-1.0.3.RELEASE.jar
org.springframework.integration.stream-1.0.3.RELEASE-1.0.3.RELEASE.jar
spring-beans-4.3.20.RELEASE.jar
spring-context-4.3.18.RELEASE.jar
spring-integration-jms-4.3.17.RELEASE.jar
spring-integration-stream-4.3.17.RELEASE.jar
spring-integration-xml-4.3.17.RELEASE.jar

If I remove this XML from my web.xml (contextConfigLocation), my EAR gets deployed successfully.

Help me figure out the issue in the XML.

Solution

All the Spring Integration dependencies must be in the same version. In your case 4.3.17.RELEASE. Same applies for Spring Framework dependencies.

Note: both those versions are EOL already . You need to think to upgrade to the latest one : https://spring.io/projects/spring-integration#learn.

Also, please, study what is dependency management and how you can avoid extra config relying on the transitive dependencies by the library you use.

Another useful tool these days is Spring Boot with its version management: https://spring.io/projects/spring-boot

Answered By – Artem Bilan

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published