首页 > 解决方案 > xml中的Spring集成xsd版本参考

问题描述

出现错误org.xml.sax.SAXParseException:cvc-complex-type.2.4.c:匹配的通配符是严格的,但找不到元素“通道”的声明。在更改xml文件中xsd的版本后在weblogic中部署应用程序ear时。

以下是升级后的 jar 文件列表:

  1. org.springframework.integration-1.0.3.RELEASE.jar

  2. org.springframework.integration.jms-1.0.3.RELEASE-1.0.3.RELEASE.jar

  3. org.springframework.integration.stream-1.0.3.RELEASE-1.0.3.RELEASE.jar

  4. spring-beans-4.3.20.RELEASE.jar spring-context-4.3.18.RELEASE.jar

  5. spring-integration-jms-4.3.17.RELEASE.jar

  6. spring-integration-stream-4.3.17.RELEASE.jar

  7. spring-integration-xml-4.3.17.RELEASE.jar

    旧的 xml 文件:

    <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: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- 2.5.xsd http://www.springframework.org/schema/context http://www.springframework。org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
    http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/ jms/spring-integration-jms-2.0.xsd http://www.springframework.org/schema/integration/stream http://www.springframework.org/schema/integration/stream/spring-integration-stream-2.0。 xsd http://www.springframework.org/schema/integration/xml http://www.springframework.org/schema/integration/xml/spring-integration-xml-2.0.xsd http://www.springframework.org /schema/util http://www.springframework.org/schema/util/spring-util.xsd">

    <ctx:component-scan base-package="com.iflexsolutions.abc"/>

    <beans:bean id="resultToDocumentTransformer" class="org.springframework.integration.xml.transformer.ResultToDocumentTransformer"/>
    <beans:bean id="resultToStringTransformer" class="org.springframework.integration.xml.transformer.ResultToStringTransformer" />

    <si-xml:xpath-router id="wcmRequestRouter" input-channel="PBWCMInputJMSChannel"> <si-xml:xpath-expression expression="/faml/request/txnid"/> <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>

<!-- Processing WCM 01 request starts -->

<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"/> 

<channel id="WCM01InChannel"/>
<channel id="WCM01OutChannel"/>
    
<si-xml:unmarshalling-transformer id="WCM01Unmarshaller" unmarshaller="WCM01ReqUnmarshaller"
    input-channel="WCM01InChannel"
    output-channel="WCM01OutChannel"        
/>

<channel id="WCM01ResponseChannel" />

<service-activator id="WCM01ServiceActivator" 
    input-channel="WCM01OutChannel" 
    output-channel="WCM01ResponseChannel" 
    ref="WCMRequestProcessor"
    method="processWCM01Request"/>

<jms:outbound-channel-adapter id="WCM01ResponseOutAdapter" destination="responseQueue" channel="WCM01ResponseChannel"/> 

<!-- Processing WCM 01 request ends -->
                
<beans:bean id="WCM01ReqUnmarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> 
    <beans:property name="contextPaths">
        <beans:list>
            <beans:value>com.abc.xyz.mobilebanking.jms.jaxb.WCM_01_request</beans:value>
        </beans:list>
    </beans:property>
</beans:bean>   
<!--  WCM 01 FLOW ENDS  -->
<!--  WCM FLOW ENDS  -->    



<channel id="errorChannel"/>
<channel id="invalidMessageChannel"/>

<service-activator input-channel="errorChannel" ref="wmMQMessageErrorHandler" method="handleFailedMessage" />

<service-activator input-channel="invalidMessageChannel" ref="wmMQMessageErrorHandler" method="handleInvalidMessage" />

<logging-channel-adapter id="logger" log-full-message="true" level="DEBUG"/>

<!-- read response content starts 

<channel id="InputJMSChannel11"/>

<stream:stdout-channel-adapter id="stdout"/>

<jms:message-driven-channel-adapter id="TestJMSAdapter11"
        destination="responseQueue" extract-payload="true" 
        connection-factory="connectionFactory" 
        channel="InputJMSChannel11" 
        error-channel="errorChannel"
/>  
<bridge input-channel="InputJMSChannel11" output-channel="stdout"/>

 read response content ends -->



</beans:beans>

**new xml file:**
<?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:jms="http://www.springframework.org/schema/integration/jms"
    xmlns:int="http://www.springframework.org/schema/integration"
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/jms
        http://www.springframework.org/schema/integration
        http://www.springframework.org/schema/integration/spring-integration-4.3.xsd
        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.iflexsolutions.abc"/> 

<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="PBWCMAuditInputint:channel"/>
<int:channel id="PBWCMInputJMSint:channel"/>
<jms:message-driven-int:channel-adapter id="PBWCMInputJMSAdapter"
        destination="FCIS_IN" extract-payload="true"
        connection-factory="connectionFactory"
        int:channel="PBWCMAuditInputint:channel"
        error-int:channel="errorint:channel"
/>
<int:service-activator id="PBWCMMessageAuditor"
    input-int:channel="PBWCMAuditInputint:channel"
    output-int:channel="PBWCMInputJMSint:channel"
    ref="mobileMessageAuditor"
    method="auditRequest"/>
<si-xml:xpath-router id="wcmRequestRouter" input-int:channel="PBWCMInputJMSint:channel">
    <si-xml:xpath-expression expression="/faml/request/txnid"/>
    <si-xml:mapping value="WCM" int:channel="WCMint:channel"/>      
</si-xml:xpath-router>
<!--  WCM FLOW STARTS  -->      
    
    
<!-- Routing incoming WCM request messages starts -->
<si-xml:xpath-router id="WCMRequestRouter" input-int:channel="WCMint:channel">
    <si-xml:xpath-expression expression="/faml/request/scrseqnumber"/>
    <si-xml:mapping value="01" int:channel="WCM01Validateint:channel"/>
</si-xml:xpath-router>
<!-- Routing incoming WCM request messages ends -->
<!--  WCM 01 FLOW STARTS  -->   
<!-- Processing WCM 01 request starts -->

<int:channel id="WCM01Validateint:channel"/>

<si-xml:validating-filter id="WCM01Validator"
input-int:channel="WCM01Validateint:channel"
output-int:channel="WCM01Inint:channel"
schema-location="classpath:xsd/request/WCM_01_Request.xsd"
discard-int:channel="invalidMessageint:channel"/>

<int:channel id="WCM01Inint:channel"/>
<int:channel id="WCM01Outint:channel"/>
    
<si-xml:unmarshalling-transformer id="WCM01Unmarshaller" unmarshaller="WCM01ReqUnmarshaller"
    input-int:channel="WCM01Inint:channel"
    output-int:channel="WCM01Outint:channel"       
/>

<int:channel id="WCM01Responseint:channel" />

<int:service-activator id="WCM01ServiceActivator"
    input-int:channel="WCM01Outint:channel"
    output-int:channel="WCM01Responseint:channel"
    ref="WCMRequestProcessor"
    method="processWCM01Request"/>

<jms:outbound-int:channel-adapter id="WCM01ResponseOutAdapter" destination="responseQueue" int:channel="WCM01Responseint:channel"/>

<!-- Processing WCM 01 request ends -->
                
<beans:bean id="WCM01ReqUnmarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> 
    <beans:property name="contextPaths">
        <beans:list>
            <beans:value>com.xyz.abc.xyz.jms.jaxb.WCM_01_request</beans:value>
        </beans:list>
    </beans:property>
</beans:bean>   
<!--  WCM 01 FLOW ENDS  -->
<!--  WCM FLOW ENDS  -->    
<!-- read response content starts -->

<int:channel id="InputJMSChannel11"/>

<stream:stdout-channel-adapter id="stdout"/>

<jms:message-driven-channel-adapter id="TestJMSAdapter11"
        destination="responseQueue" extract-payload="true"
        connection-factory="connectionFactory"
        channel="InputJMSChannel11"
        error-channel="errorChannel"
/>  
<bridge input-channel="InputJMSChannel11" output-channel="stdout"/>

<!-- read response content ends -->


</beans:beans>

标签: xmlspring

解决方案


推荐阅读