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

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

我在 Weblogic 中部署我的应用程序时遇到以下错误。该功能在旧 Spring 版本中运行良好。将 spring 从 2 升级到 4 后,我们收到此错误:

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

下面是XML文件内容:

<?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>

lib 文件夹中可用的 JAR 是

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

如果我从我的 web.xml (contextConfigLocation) 中删除这个 XML,我的 EAR 就会成功部署。

帮我解决XML中的问题。

所有 Spring 集成依赖项必须在同一版本中。在你的情况下 4.3.17.RELEASE。 Spring 框架依赖项也是如此。

注意:这两个版本都已经停产了。您需要考虑升级到最新版本:https://spring.io/projects/spring-integration#learn.

此外,请研究什么是依赖管理,以及如何避免依赖您使用的库的传递依赖的额外配置。

最近另一个有用的工具是 Spring 引导版本管理:https://spring.io/projects/spring-boot