找不到元素[stored-proc-outbound-gateway]的BeanDefinitionParser

时间:2014-09-11 07:52:28

标签: spring spring-integration

我在项目中使用Spring-Integration。我试图在另一个配置文件中导入配置文件。主要配置文件代码是:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:int-xml="http://www.springframework.org/schema/integration/xml"
    xmlns:int="http://www.springframework.org/schema/integration"
    xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:util="http://www.springframework.org/schema/util"
    xmlns:int-http="http://www.springframework.org/schema/integration/http" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/integration
            http://www.springframework.org/schema/integration/spring-integration.xsd
            http://www.springframework.org/schema/integration/xml
            http://www.springframework.org/schema/integration/xml/spring-integration-xml.xsd
            http://www.springframework.org/schema/util
            http://www.springframework.org/schema/util/spring-util.xsd 
            http://www.springframework.org/schema/integration/jdbc  
            http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd 
            http://www.springframework.org/schema/integration/http
            http://www.springframework.org/schema/integration/http/spring-integration-http.xsd ">

    <import resource="spring-integration/Jobs/*.xml"/>

    <!-- map of namespace prefix to URI -->
    <util:map id="xmlMessageNamespace">
        <entry key="SOAP" value="http://schemas.xmlsoap.org/soap/envelope/" />
    </util:map>
    <int:channel id="jobDesignerInputChannel" />
    <int:channel id="cs-exceptionHandlingChannel" />

    <bean id="msgHandler" class="com.dsths.cs.awd.jobs.PQMessageHandler" />
    <bean id="xmlAggregator" class="com.dsths.cs.awd.jobs.XmlAggregator" />
    <bean id="httpOutboundGatewayHandler" class="com.dsths.cs.awd.jobs.HttpOutboundGatewayHandler" />
    <bean id="xmlFilter" class="com.dsths.cs.awd.jobs.XmlFilter" />

    <int:chain input-channel="jobDesignerInputChannel" >

        <int-xml:xpath-header-enricher default-overwrite="true"  should-skip-nulls="true"  >
            <int-xml:header name="${headerNames.legacySystem}"  xpath-expression="//LegacySystem"  evaluation-type="STRING_RESULT"  overwrite="true" />   
        </int-xml:xpath-header-enricher>        

        <!-- Some of the AWD jobs contain Business Area info under <code> tag, we should not keep that business area info in the 
        header since it is not required.This will help us in identifying AWD and Non-AWD jobs-->
        <int:header-enricher>
            <int:header name="${headerNames.businessArea}" expression="#xpath(payload, '//businessArea/Code', 'boolean') ? null : #xpath(payload, '//businessArea')"/>
        </int:header-enricher>

        <int:router expression="${routing.jobChannel}"/>
    </int:chain>



    <int:chain input-channel="cs-exceptionHandlingChannel">
        <!-- Service Activator to handle the errors --> 
        <int:service-activator  ref="msgHandler" method="handleError" />

        <!-- Router to routing the error messages to appropriate job channel for xsl transormation -->      
        <int:router expression="${routing.jobErrorChannel}"/>
    </int:chain>           
</beans>

但是,当上述文件尝试导入时,会引发以下错误:

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [JobDesigner-springintegration.xml]
Offending resource: class path resource [CustomerServiceRD/applicationContext.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [spring-integration/Jobs/*.xml]
Offending resource: class path resource [CustomerServiceRD/JobDesigner-springintegration.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Cannot locate BeanDefinitionParser for element [stored-proc-outbound-gateway]
Offending resource: file [D:\CustomerServiceRD-Workspace\CustomerServiceRD\csWeb\container\conf\CustomerServiceRD\spring-integration\Jobs\PQProviderSearch.xml]
    at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
    at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
    at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:271)

需要导入的文件在这里(PQProviderSearch.xml):

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:int-xml="http://www.springframework.org/schema/integration/xml"
    xmlns:int="http://www.springframework.org/schema/integration"
    xmlns:int-jdbc="http://www.springframework.org/schema/integration/jdbc" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:util="http://www.springframework.org/schema/util"
    xmlns:int-http="http://www.springframework.org/schema/integration/http" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/integration
            http://www.springframework.org/schema/integration/spring-integration.xsd
            http://www.springframework.org/schema/integration/xml
            http://www.springframework.org/schema/integration/xml/spring-integration-xml.xsd
            http://www.springframework.org/schema/util
            http://www.springframework.org/schema/util/spring-util.xsd 
            http://www.springframework.org/schema/integration/jdbc
            http://www.springframework.org/schema/integration/jdbc/spring-integration-jdbc.xsd 
            http://www.springframework.org/schema/integration/http
            http://www.springframework.org/schema/integration/http/spring-integration-http.xsd  ">

    <int:channel id="PQProviderSearch-InputChannel" />

    <int:chain input-channel="PQProviderSearch-InputChannel" output-channel="PQProviderSearch-LegacySystem-Router">

        <!-- Split the Search Request Params from Xml  -->
        <int-xml:xpath-splitter>
            <int-xml:xpath-expression expression="//ProviderSearch"  namespace-map="xmlMessageNamespace" />
        </int-xml:xpath-splitter>

        <!-- Store the original payload in header for future purpose -->
        <int:header-enricher default-overwrite="true"  should-skip-nulls="true"  >
            <int:header name="${headerNames.originalPayload}" expression="payload" />   
        </int:header-enricher>  

        <!-- Store the job name in header for future purpose -->
        <int:header-enricher default-overwrite="true"  should-skip-nulls="true"  >
           <int:header name="jobName" value="PQProviderSearch"  />
        </int:header-enricher> 

    </int:chain>                

    <!-- Router routes the message to the appropriate legacy system channel -->
    <int:header-value-router input-channel="PQProviderSearch-LegacySystem-Router"
                             header-name="${headerNames.legacySystem}" >
            <int:mapping value="${legacySystem.amisys}"       channel="PQProviderSearch-Amisys-Channel"/>
            <int:mapping value="${legacySystem.powerstepp}"   channel="PQProviderSearch-PowerStepp-Channel"/>
            <int:mapping value="${legacySystem.mhc}"          channel="PQProviderSearch-MHC-Channel"/>      
            <int:mapping value="${legacySystem.awd}"          channel="PQProviderSearch-AWD-Channel"/>      
    </int:header-value-router>

    <!-- PowerStepp Channel -->
    <int:channel id="PQProviderSearch-PowerStepp-Channel" />
    <int:chain input-channel="PQProviderSearch-PowerStepp-Channel"  output-channel="PQProviderSearch-ExternalSystem-Response" >

        <int:service-activator ref="msgHandler" method="buildStoredProcOutboundGatewayRequest" />

        <int-jdbc:stored-proc-outbound-gateway
                        id="PQProviderSearch-PowerSTEPP-StoredProcedure" 
                        auto-startup="true"
                        data-source="routingDataSource" 
                        stored-procedure-name="${PQProviderSearch.storedProcedureName}"
                        skip-undeclared-results="true"
                        ignore-column-meta-data="true"  
                        use-payload-as-parameter-source = "false" 
                        expect-single-result="true" >

                        <int-jdbc:sql-parameter-definition name="ROWREQ" direction="IN" type="VARCHAR" />
                        <int-jdbc:sql-parameter-definition name="DBGFLG" direction="IN" type="VARCHAR" />
                        <int-jdbc:sql-parameter-definition name="SECDAT" direction="IN" type="VARCHAR" />
                        <int-jdbc:sql-parameter-definition name="PROVNO" direction="IN" type="VARCHAR" />
                        <int-jdbc:sql-parameter-definition name="PRVLST" direction="IN" type="VARCHAR" />
                        <int-jdbc:sql-parameter-definition name="PRVFST" direction="IN" type="VARCHAR" />
                        <int-jdbc:sql-parameter-definition name="FEDNUM" direction="IN" type="VARCHAR" />
                        <int-jdbc:sql-parameter-definition name="SPECCD" direction="IN" type="VARCHAR" />
                        <int-jdbc:sql-parameter-definition name="NPINUM" direction="IN" type="VARCHAR" />
                        <int-jdbc:sql-parameter-definition name="ZIPCOD" direction="IN" type="VARCHAR" />

                        <int-jdbc:parameter name="ROWREQ" value="${PQProviderSearch.ROWREQ}" />
                        <int-jdbc:parameter name="DBGFLG" value="${PQProviderSearch.DBGFLG}" />
                        <int-jdbc:parameter name="SECDAT" value="${PQProviderSearch.SECDAT}" />
                        <int-jdbc:parameter name="PROVNO" expression="payload.PrvNum" />
                        <int-jdbc:parameter name="PRVLST" expression="payload.PrvLName" />
                        <int-jdbc:parameter name="PRVFST" expression="payload.PrvFName" />
                        <int-jdbc:parameter name="FEDNUM" expression="payload.PrvTaxID" />
                        <int-jdbc:parameter name="SPECCD" expression="payload.PrvSpec" />
                        <int-jdbc:parameter name="NPINUM" expression="payload.PrvNPI" />
                        <int-jdbc:parameter name="ZIPCOD" expression="payload.PrvZip" />

                <int-jdbc:returning-resultset name="rowMapper" row-mapper="com.dsths.cs.awd.utils.ResultSetRowMapper"/>

        </int-jdbc:stored-proc-outbound-gateway>

    </int:chain>    




    <!-- Service Activator to build the Message from the ExternalSystem Result -->
    <int:channel id="PQProviderSearch-ExternalSystem-Response" />
    <int:service-activator input-channel="PQProviderSearch-ExternalSystem-Response"
                           output-channel="PQProviderSearch-XsltTransformInputChannel" 
                           ref="msgHandler" 
                           method="buildMessageFromExtSysResponse" />


    <int:chain  input-channel="PQProviderSearch-XsltTransformInputChannel"  output-channel="PQProviderSearch-XsltTransformOutputChannel" >

        <!-- Transformer to transform the resultXml to the user understandable form using XSLT -->
        <int-xml:xslt-transformer xsl-resource="${stylesheet.PQProviderSearch}"  /> 

        <!-- Transformer to transform the resultXml with count to the user understandable form using XSLT -->
        <int-xml:xslt-transformer xsl-resource="${stylesheet.PQProviderSearchCount}"  />

    </int:chain>

        <!-- check whether the call is from PQProviderSearch job or PQIssueDetails job and redirect the response accordingly -->
    <int:router input-channel="PQProviderSearch-XsltTransformOutputChannel"  expression="headers['jobName'] ?: 'routingChannelForProviderSearch'"

                resolution-required="false"  >  

       <int:mapping value="PQProviderSearch" channel="PQProviderSearch-FinalEnrich"/>
       <int:mapping value="PQIssueDetails" channel="PQIssueDetails-PQProviderSearch-Response"/>
    </int:router>


    <!--  Service Activator to build the jobResponse xml making use of jobRequestXml and xlst transformed xml-->
    <int:channel id="PQProviderSearch-FinalEnrich" />
    <int:service-activator input-channel="PQProviderSearch-FinalEnrich" 
                           ref="msgHandler" 
                           method="enrichPayloadXml" />


    <int:recipient-list-router id="custmRouter" input-channel="routingChannelForProviderSearch"
                timeout="1234"
                ignore-send-failures="true"
                apply-sequence="true">
    <int:recipient channel="PQProviderSearch-FinalEnrichLast"/>
    <int:recipient channel="PQIssueDetails-PQProviderSearch-Response"/>
    </int:recipient-list-router>    

    <!--  Service Activator to build the jobResponse xml making use of jobRequestXml and xlst transformed xml-->
    <int:channel id="PQProviderSearch-FinalEnrichLast" />
    <int:service-activator input-channel="PQProviderSearch-FinalEnrichLast" 
                           ref="msgHandler" 
                           method="enrichPayloadXml" />                            

</beans>

关于我的配置有什么问题的任何想法?

1 个答案:

答案 0 :(得分:1)

  

找不到元素[stored-proc-outbound-gateway]

的BeanDefinitionParser

运行它时,必须检查应用程序的类路径。

即使您的IDE允许使用这些自定义标记,但在运行时您拥有正确的环境并不重要。

可能是一个问题是围绕一个错误的(旧的?)版本的Spring Integration:自2.1以来引入了存储过程适配器。